pub struct FenceToken {
pub epoch: u64,
pub revision: u64,
}Expand description
Opaque local-replica fencing token.
Combines a per-replica epoch (regenerated when the handle is rebuilt —
i.e. on daemon restart) with the local revision (the TaskList version
counter, which advances on every effective local snapshot change,
including remote merges). The token is opaque over the wire: clients
must echo it verbatim and MUST NOT interpret or construct it.
ABA safety: because the epoch changes across restart, a token captured before a restart can never match a post-restart token even if the revision counter later reaches the same value. This closes the restart-ABA window without persisting task state.
This is a LOCAL fence only (per-replica): two replicas at the same
(epoch, revision) can both accept. It is not a distributed CAS.
Fields§
§epoch: u64Per-replica epoch; regenerated on restart.
revision: u64Local revision = TaskList version counter.
Implementations§
Source§impl FenceToken
impl FenceToken
Sourcepub fn to_wire(&self) -> String
pub fn to_wire(&self) -> String
Opaque wire encoding: "epoch:revision". Clients echo this verbatim.
Sourcepub fn from_wire(s: &str) -> Result<Self, &'static str>
pub fn from_wire(s: &str) -> Result<Self, &'static str>
Parse an opaque wire token.
Returns Ok(token) for a well-formed "epoch:revision" string, or
Err(&'static str) if the token is malformed (missing colon,
non-numeric, or integer overflow). Callers MUST distinguish absent
(fence_token: None → unconditional advisory commit) from present but
malformed (Err → reject with 400/409 without mutation). Collapsing
the two into None would let a corrupt/legacy/attacker token silently
downgrade a fenced request to an unfenced one.
§Errors
Returns Err if the string is not exactly two colon-separated u64
fields.
Trait Implementations§
Source§impl Clone for FenceToken
impl Clone for FenceToken
Source§fn clone(&self) -> FenceToken
fn clone(&self) -> FenceToken
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FenceToken
Source§impl Debug for FenceToken
impl Debug for FenceToken
impl Eq for FenceToken
Source§impl PartialEq for FenceToken
impl PartialEq for FenceToken
impl StructuralPartialEq for FenceToken
Auto Trait Implementations§
impl Freeze for FenceToken
impl RefUnwindSafe for FenceToken
impl Send for FenceToken
impl Sync for FenceToken
impl Unpin for FenceToken
impl UnsafeUnpin for FenceToken
impl UnwindSafe for FenceToken
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more