pub struct Cursor {
pub epoch: String,
pub sequence: u64,
}Expand description
A place in one store’s arrival order, and which store’s order it is.
"<epoch>.<sequence>" on the wire, opaque to a caller. The epoch is
minted when the store is created, so a cursor a daemon is holding across
a restart names an order that no longer exists and is read as “from the
beginning” rather than as a sequence this store has not reached yet.
Without it a restart strands every client: the counter begins again at
zero, a daemon holding 3 asks for everything after 3, and the answer
is empty for as long as it takes the new store to mint four records —
which for a quiet account is never. The failure is silent on both sides,
which is what makes it worth a self-describing cursor rather than a
durable counter.
Fields§
§epoch: StringWhich store’s arrival order this names.
sequence: u64How far into that order the caller has read.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn read(raw: Option<&str>, epoch: &str) -> u64
pub fn read(raw: Option<&str>, epoch: &str) -> u64
Reads a cursor a caller sent back, against the epoch in force now.
Anything that is not this store’s order — a different epoch, a malformed string, an absent cursor — is the beginning of this one. A caller is never told its cursor was discarded, because there is nothing it could usefully do differently: the answer it gets carries the current epoch, and sending that back works.
Trait Implementations§
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
§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
key and return true if they are equal.§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
§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>
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