pub struct HeartbeatTable { /* private fields */ }Expand description
Cross-process heartbeat registry. Each process opens this and
reserves one slot via HeartbeatTable::register.
Implementations§
Source§impl HeartbeatTable
impl HeartbeatTable
pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, HeartbeatError>
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, HeartbeatError>
pub fn capacity(&self) -> usize
pub fn header(&self) -> &HeartbeatHeader
Sourcepub fn register(&self, pid: u32) -> Result<usize, HeartbeatError>
pub fn register(&self, pid: u32) -> Result<usize, HeartbeatError>
Register the current process. Returns the slot index. CAS-claim of the first empty slot.
Sourcepub fn unregister(&self, idx: usize)
pub fn unregister(&self, idx: usize)
Release the slot at idx. Call before process exit.
Sourcepub fn beat(&self, idx: usize)
pub fn beat(&self, idx: usize)
Heartbeat: advance this slot’s last_seen_epoch to match the
global epoch. Call once per scan tick.
Sourcepub fn tick_global_epoch(&self) -> u64
pub fn tick_global_epoch(&self) -> u64
Advance the global epoch. Watchdog calls this once per scan interval. Returns the new epoch value.
pub fn global_epoch(&self) -> u64
Sourcepub fn mark_in_flight(&self, slot_idx: usize, bit: u8)
pub fn mark_in_flight(&self, slot_idx: usize, bit: u8)
Mark a work unit as in-flight for slot_idx.
pub fn clear_in_flight(&self, slot_idx: usize, bit: u8)
Sourcepub fn snapshot(&self, idx: usize) -> Option<HeartbeatSnapshot>
pub fn snapshot(&self, idx: usize) -> Option<HeartbeatSnapshot>
Snapshot a slot via SeqLock retry. Returns None if the slot
is vacant.
Trait Implementations§
Source§impl AdaptiveInstance for HeartbeatTable
impl AdaptiveInstance for HeartbeatTable
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
impl Send for HeartbeatTable
impl Sync for HeartbeatTable
Auto Trait Implementations§
impl !Freeze for HeartbeatTable
impl !UnwindSafe for HeartbeatTable
impl RefUnwindSafe for HeartbeatTable
impl Unpin for HeartbeatTable
impl UnsafeUnpin for HeartbeatTable
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