pub struct WorkloadStateMachine { /* private fields */ }Expand description
The state machine. Holds a map of tracked workloads keyed by
workload_id. Drives transitions on each tick.
Implementations§
Source§impl WorkloadStateMachine
impl WorkloadStateMachine
pub fn new(config: QuorumConfig) -> Self
pub fn track(&mut self, workload: DurableWorkload)
pub fn untrack(&mut self, workload_id: u32)
pub fn state_of(&self, workload_id: u32) -> Option<&WorkloadState>
pub fn workload(&self, workload_id: u32) -> Option<&DurableWorkload>
Sourcepub fn tick(
&mut self,
now: u64,
observations: &[HeartbeatObservation],
) -> Vec<StateMachineEvent>
pub fn tick( &mut self, now: u64, observations: &[HeartbeatObservation], ) -> Vec<StateMachineEvent>
Apply observations and advance every tracked workload. Returns the side-effects the controller must perform.
Sourcepub fn notify_respawn_failed(&mut self, workload_id: u32, reason: &str)
pub fn notify_respawn_failed(&mut self, workload_id: u32, reason: &str)
Controller reports that a respawn attempt for a workload
failed. The state machine either retries (if attempts
remain) or marks the workload Failed.
Sourcepub fn notify_respawn_succeeded(&mut self, workload_id: u32, now: u64)
pub fn notify_respawn_succeeded(&mut self, workload_id: u32, now: u64)
Controller reports that a respawn attempt succeeded. State transitions back to Live (heartbeats from the new container will keep it there).
Auto Trait Implementations§
impl Freeze for WorkloadStateMachine
impl RefUnwindSafe for WorkloadStateMachine
impl Send for WorkloadStateMachine
impl Sync for WorkloadStateMachine
impl Unpin for WorkloadStateMachine
impl UnsafeUnpin for WorkloadStateMachine
impl UnwindSafe for WorkloadStateMachine
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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