pub struct CommitToken { /* private fields */ }Expand description
An opaque, scoped commit identity used as a causal freshness fence.
V2 binds (database_id, history_incarnation, commit_sequence). Public diagnostics redact
the payload; callers that need wire bytes use CommitToken::as_bytes.
Implementations§
Source§impl CommitToken
impl CommitToken
Sourcepub fn new(history_incarnation: u64, commit_sequence: CommitSequence) -> Self
pub fn new(history_incarnation: u64, commit_sequence: CommitSequence) -> Self
Builds a legacy V1 token with no database scope. Followers refuse V1.
Sourcepub fn new_scoped(
database_id: DatabaseId,
history_incarnation: u64,
commit_sequence: CommitSequence,
) -> Self
pub fn new_scoped( database_id: DatabaseId, history_incarnation: u64, commit_sequence: CommitSequence, ) -> Self
Builds a V2 token bound to one database and exact history position.
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<Self, FreshnessTokenError>
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, FreshnessTokenError>
Parses opaque token bytes produced by Self::as_bytes.
Sourcepub const fn database_id(&self) -> Option<DatabaseId>
pub const fn database_id(&self) -> Option<DatabaseId>
Database scope; absent only on legacy V1 tokens.
Sourcepub fn frontier(&self) -> ProjectionFrontier
pub fn frontier(&self) -> ProjectionFrontier
The exact required frontier, preserving the complete token scope.
Sourcepub const fn history_incarnation(&self) -> u64
pub const fn history_incarnation(&self) -> u64
History incarnation bound into the token.
Sourcepub const fn commit_sequence(&self) -> CommitSequence
pub const fn commit_sequence(&self) -> CommitSequence
Commit sequence bound into the token.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consumes the token and returns its opaque bytes.
Trait Implementations§
Source§impl Clone for CommitToken
impl Clone for CommitToken
Source§impl Debug for CommitToken
impl Debug for CommitToken
impl Eq for CommitToken
Source§impl Hash for CommitToken
impl Hash for CommitToken
Source§impl Ord for CommitToken
impl Ord for CommitToken
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for CommitToken
impl PartialEq for CommitToken
Auto Trait Implementations§
impl Freeze for CommitToken
impl RefUnwindSafe for CommitToken
impl Send for CommitToken
impl Sync for CommitToken
impl Unpin for CommitToken
impl UnsafeUnpin for CommitToken
impl UnwindSafe for CommitToken
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