pub struct StandbySlot {
pub workload_id: String,
pub primary_npub: String,
pub standby_index: usize,
pub standby_count: usize,
pub container_config: ContainerConfig,
pub spec_id: String,
pub expires_at: u64,
pub owner_npub: String,
pub created_at: u64,
pub peer_standby_npubs: Vec<String>,
}Expand description
A standby slot reserved for a warm-standby workload. The
consumer’s spawn request was paid for and acknowledged, but no
container has been created yet — the standby is “armed” and
waiting for a LeaseRevocation event from the primary.
Stored in ProviderService::standby_slots keyed by workload_id
(consumer-assigned UUID, shared by primary and all standbys).
On revocation, the standby’s promotion handler:
- Sleeps
index * promotion_delay_secs(ordered backoff for single-writer; standby 0 promotes immediately, standby 1 waits one delay window, etc.) - Spawns the container using
container_config - Removes the slot, adds to
active_workloads, registers with the state machine as primary
Fields§
§workload_id: String§primary_npub: String§standby_index: usize§standby_count: usize§container_config: ContainerConfig§spec_id: String§expires_at: u64§owner_npub: String§created_at: u64Unix-second timestamp at which the slot was reserved. Used as
the silence-baseline by the watchdog when no primary heartbeat
has been observed yet — without this, a fresh slot would treat
last_seen == 0 as immediate silence and promote a healthy
primary on the first watchdog tick (race window: 0–60s while
waiting for the primary’s next heartbeat to land on the relay).
peer_standby_npubs: Vec<String>Npubs of the OTHER standbys for this workload (excludes self and the primary). Used at promotion-time to detect that a lower-indexed peer has already promoted: a freshly-promoted peer publishes a heartbeat from its own npub immediately, and this standby queries those npubs before claiming the slot itself. Without this list, every standby would promote independently after the silence window, producing split-brain.
Trait Implementations§
Source§impl Clone for StandbySlot
impl Clone for StandbySlot
Source§fn clone(&self) -> StandbySlot
fn clone(&self) -> StandbySlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StandbySlot
impl RefUnwindSafe for StandbySlot
impl Send for StandbySlot
impl Sync for StandbySlot
impl Unpin for StandbySlot
impl UnsafeUnpin for StandbySlot
impl UnwindSafe for StandbySlot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more