pub struct FencingTokenState { /* private fields */ }Expand description
Volatile fencing-token state shared across the cluster node.
Stores the current packed fencing token as an AtomicU64 so that concurrent
readers (e.g. storage guards) can check staleness without taking a lock.
The high 32 bits encode the Raft term; the low 32 bits encode the monotonic
write sequence within that term.
Implementations§
Source§impl FencingTokenState
impl FencingTokenState
Sourcepub fn issue_token(&self) -> FencingToken
pub fn issue_token(&self) -> FencingToken
Atomically issue the next fencing token by incrementing the sequence.
Intended to be called on every write from the current leader.
Sourcepub fn bump_term_token(&self, new_term: u32)
pub fn bump_term_token(&self, new_term: u32)
Bump the token to a new leader term, resetting the sequence to zero.
This must be called atomically when a node wins an election.
Sourcepub fn current_raw(&self) -> u64
pub fn current_raw(&self) -> u64
Read the current raw token value (for serialisation / inspection).
Trait Implementations§
Source§impl Debug for FencingTokenState
impl Debug for FencingTokenState
Auto Trait Implementations§
impl !Freeze for FencingTokenState
impl RefUnwindSafe for FencingTokenState
impl Send for FencingTokenState
impl Sync for FencingTokenState
impl Unpin for FencingTokenState
impl UnsafeUnpin for FencingTokenState
impl UnwindSafe for FencingTokenState
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