pub struct HostWatch { /* private fields */ }Expand description
Deterministic worker-health state machine.
Every now_ms argument must come from one monotonic clock and share the
epoch passed to HostWatch::new. While running, observe the current worker
counter with HostWatch::heartbeat before calling HostWatch::tick at
that observation time; otherwise tick can declare a healthy worker silent
before recording its latest heartbeat (audit #11 TD-94).
Implementations§
Source§impl HostWatch
impl HostWatch
pub fn new(now_ms: u64) -> Self
pub fn state(&self) -> WatchState
pub fn received(&mut self, now_ms: u64, message: Received) -> Action
Sourcepub fn heartbeat(&mut self, now_ms: u64, value: u64) -> Action
pub fn heartbeat(&mut self, now_ms: u64, value: u64) -> Action
Silence is counted only across time the host was observing: when the host polls late, the worker may have been frozen together with it (a stalled machine), which is no evidence that the worker stopped.
Sourcepub fn request_sent(
&mut self,
now_ms: u64,
request: u32,
_kind: RequestKind,
) -> Action
pub fn request_sent( &mut self, now_ms: u64, request: u32, _kind: RequestKind, ) -> Action
Starts the request deadline. State saves and editor operations use the
same bound because both are control-thread round trips: neither is safe
to leave pending while worker health is uncertain. kind remains in the
public contract for diagnostics and future policy without changing the
current deadline (audit #11 TD-92).