pub struct EpochTracker { /* private fields */ }Expand description
Monotonic write-epoch tracker keyed by BlockKey.
Each call to record_write increments a
global counter and associates the new epoch with the given key. Readers
can later check whether their snapshot is stale via
is_stale.
Implementations§
Source§impl EpochTracker
impl EpochTracker
Sourcepub fn record_write(&mut self, key: BlockKey) -> u64
pub fn record_write(&mut self, key: BlockKey) -> u64
Record a write for key, returning the new epoch number.
The epoch is strictly monotonically increasing across all keys.
Sourcepub fn check_epoch(&self, key: BlockKey) -> Option<u64>
pub fn check_epoch(&self, key: BlockKey) -> Option<u64>
Return the latest write epoch for key, if any write has been recorded.
Trait Implementations§
Source§impl Clone for EpochTracker
impl Clone for EpochTracker
Source§fn clone(&self) -> EpochTracker
fn clone(&self) -> EpochTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EpochTracker
impl Debug for EpochTracker
Auto Trait Implementations§
impl Freeze for EpochTracker
impl RefUnwindSafe for EpochTracker
impl Send for EpochTracker
impl Sync for EpochTracker
impl Unpin for EpochTracker
impl UnwindSafe for EpochTracker
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