Struct CommitToken
pub struct CommitToken { /* private fields */ }Expand description
Freshness policy and commit token types used by projected queries. 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§
§impl CommitToken
impl CommitToken
pub fn new(
history_incarnation: u64,
commit_sequence: CommitSequence,
) -> CommitToken
pub fn new( history_incarnation: u64, commit_sequence: CommitSequence, ) -> CommitToken
Builds a legacy V1 token with no database scope. Followers refuse V1.
pub fn new_scoped(
database_id: DatabaseId,
history_incarnation: u64,
commit_sequence: CommitSequence,
) -> CommitToken
pub fn new_scoped( database_id: DatabaseId, history_incarnation: u64, commit_sequence: CommitSequence, ) -> CommitToken
Builds a V2 token bound to one database and exact history position.
pub fn from_bytes(bytes: Vec<u8>) -> Result<CommitToken, FreshnessTokenError>
pub fn from_bytes(bytes: Vec<u8>) -> Result<CommitToken, FreshnessTokenError>
Parses opaque token bytes produced by Self::as_bytes.
pub const fn database_id(&self) -> Option<DatabaseId>
pub const fn database_id(&self) -> Option<DatabaseId>
Database scope; absent only on legacy V1 tokens.
pub fn frontier(&self) -> ProjectionFrontier
pub fn frontier(&self) -> ProjectionFrontier
The exact required frontier, preserving the complete token scope.
pub const fn history_incarnation(&self) -> u64
pub const fn history_incarnation(&self) -> u64
History incarnation bound into the token.
pub const fn commit_sequence(&self) -> CommitSequence
pub const fn commit_sequence(&self) -> CommitSequence
Commit sequence bound into the token.
pub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consumes the token and returns its opaque bytes.
Trait Implementations§
§impl Clone for CommitToken
impl Clone for CommitToken
§fn clone(&self) -> CommitToken
fn clone(&self) -> CommitToken
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for CommitToken
impl Debug for CommitToken
impl Eq for CommitToken
§impl Hash for CommitToken
impl Hash for CommitToken
§impl Ord for CommitToken
impl Ord for CommitToken
§fn cmp(&self, other: &CommitToken) -> Ordering
fn cmp(&self, other: &CommitToken) -> Ordering
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
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].