pub struct SharedFenceClock { /* private fields */ }Implementations§
pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, FenceClockError>
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, FenceClockError>
pub fn capacity(&self) -> usize
Current shared cross-process cached wall clock (microseconds). This is the freshest cache any process on the host has published to the MMF; it advances when any process ticks. One atomic load.
Sourcepub fn register(&self, pid: u32) -> Result<usize, FenceClockError>
pub fn register(&self, pid: u32) -> Result<usize, FenceClockError>
Register the calling process. CAS-claims the first empty slot; returns slot index.
Sourcepub fn unregister(&self, idx: usize)
pub fn unregister(&self, idx: usize)
Release a slot so another process can claim it.
Sourcepub fn tick(&self, idx: usize) -> Hlc
pub fn tick(&self, idx: usize) -> Hlc
Local internal-event HLC tick. Advances this slot’s HLC per the standard rules.
Sourcepub fn merge(&self, idx: usize, remote: Hlc) -> Hlc
pub fn merge(&self, idx: usize, remote: Hlc) -> Hlc
Merge a remote HLC (e.g., received in a message) into this slot. Returns the new local HLC.
Sourcepub fn compute_global_fence(&self) -> Hlc
pub fn compute_global_fence(&self) -> Hlc
Walk all slots and compute max(slot.hlc) across all non-vacant
slots. This is the global fence: the timestamp at which all
peers’ events are observable.
Sourcepub fn publish_global_fence(&self) -> Hlc
pub fn publish_global_fence(&self) -> Hlc
Publish the computed global fence to the header so other
processes can read it via read_global_fence at O(1).
Sourcepub fn read_global_fence(&self) -> Hlc
pub fn read_global_fence(&self) -> Hlc
Read the most-recently-published global fence (O(1); set by a publisher process / coordinator).
Sourcepub fn slot_snapshot(&self, idx: usize) -> Option<HlcSlotSnapshot>
pub fn slot_snapshot(&self, idx: usize) -> Option<HlcSlotSnapshot>
Snapshot a specific slot (returns None when vacant).
Sourcepub fn fence_epoch(&self) -> u64
pub fn fence_epoch(&self) -> u64
Total fence-publish epochs (counter bumped by publish_global_fence).
pub fn flush(&self) -> Result<(), FenceClockError>
Sourcepub fn flush_async(&self) -> Result<(), FenceClockError>
pub fn flush_async(&self) -> Result<(), FenceClockError>
Non-blocking flush: schedules a writeback via the OS. Note: Windows is only partially async (sync to page cache, not to disk).