pub struct WatchCursor { /* private fields */ }Expand description
Tracks (epoch, generation) across batches and says when a rescan is required.
use storage_kit::ns::{WatchBatch, WatchCursor};
let mut cursor = WatchCursor::new();
assert!(!cursor.observe(&WatchBatch::new(7, 1, vec![], false)));
assert!(!cursor.observe(&WatchBatch::new(7, 2, vec![], false)));
assert!(cursor.observe(&WatchBatch::new(7, 4, vec![], false)), "generation 3 was lost");
assert!(cursor.observe(&WatchBatch::new(8, 5, vec![], false)), "a new epoch");Implementations§
Source§impl WatchCursor
impl WatchCursor
Sourcepub fn observe(&mut self, batch: &WatchBatch) -> bool
pub fn observe(&mut self, batch: &WatchBatch) -> bool
Record batch. Returns true if the consumer must rescan: the batch says so, the epoch changed, or the
generation did not advance by exactly one (the first batch must be generation 1).
Trait Implementations§
Source§impl Clone for WatchCursor
impl Clone for WatchCursor
Source§impl Debug for WatchCursor
impl Debug for WatchCursor
Auto Trait Implementations§
impl Forget for WatchCursor
impl Freeze for WatchCursor
impl Move for WatchCursor
impl RefUnwindSafe for WatchCursor
impl Send for WatchCursor
impl Sync for WatchCursor
impl Unpin for WatchCursor
impl UnsafeUnpin for WatchCursor
impl UnwindSafe for WatchCursor
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,
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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.