pub struct HeartbeatMonitor { /* private fields */ }Expand description
Tracks last heartbeat timestamps and detects timeout conditions.
The dispatch loop calls check_timeouts
once per tick to find actors whose heartbeat has expired.
Implementations§
Source§impl HeartbeatMonitor
impl HeartbeatMonitor
Sourcepub fn record_registration(
&mut self,
actor_id: ActorId,
policy: HeartbeatPolicy,
now: u64,
)
pub fn record_registration( &mut self, actor_id: ActorId, policy: HeartbeatPolicy, now: u64, )
Records actor registration with initial heartbeat timestamp.
Sourcepub fn record_heartbeat(&mut self, actor_id: ActorId, timestamp: u64)
pub fn record_heartbeat(&mut self, actor_id: ActorId, timestamp: u64)
Records a heartbeat for an active actor.
Sourcepub fn remove(&mut self, actor_id: ActorId)
pub fn remove(&mut self, actor_id: ActorId)
Removes tracking for an actor (called on deregistration).
Sourcepub fn check_timeouts(&self, now: u64) -> Vec<ActorId>
pub fn check_timeouts(&self, now: u64) -> Vec<ActorId>
Returns actor IDs whose heartbeat has timed out at now.
An actor times out when now >= last_heartbeat_at + timeout_secs.
Trait Implementations§
Source§impl Default for HeartbeatMonitor
impl Default for HeartbeatMonitor
Source§fn default() -> HeartbeatMonitor
fn default() -> HeartbeatMonitor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HeartbeatMonitor
impl RefUnwindSafe for HeartbeatMonitor
impl Send for HeartbeatMonitor
impl Sync for HeartbeatMonitor
impl Unpin for HeartbeatMonitor
impl UnsafeUnpin for HeartbeatMonitor
impl UnwindSafe for HeartbeatMonitor
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