pub struct EventCountCheckpoint<E: Context> { /* private fields */ }Expand description
A durable “last known committed event count” for one conversation partition, stored independently of that partition’s own journal files.
See the module docs for why this exists and the guarantee it provides.
Implementations§
Source§impl<E: Context> EventCountCheckpoint<E>
impl<E: Context> EventCountCheckpoint<E>
Sourcepub async fn open(context: E, partition: &str) -> Result<Self, EventLogError>
pub async fn open(context: E, partition: &str) -> Result<Self, EventLogError>
Open (or create) the checkpoint store tracking partition.
§Errors
Returns EventLogError::Checkpoint if the underlying metadata store
fails to initialize.
Sourcepub fn expected_count(&self) -> u64
pub fn expected_count(&self) -> u64
The last durably recorded event count, or 0 if none was ever
recorded — a fresh partition, or one whose checkpoint was cleared by
Self::clear.
Sourcepub async fn record(&mut self, count: u64) -> Result<(), EventLogError>
pub async fn record(&mut self, count: u64) -> Result<(), EventLogError>
Durably record count as the new expected minimum.
Callers must only pass a count already observed durably committed (see the module docs) — this store does not itself validate that.
§Errors
Returns EventLogError::Checkpoint if the durable sync fails.
Sourcepub async fn clear(&mut self) -> Result<(), EventLogError>
pub async fn clear(&mut self) -> Result<(), EventLogError>
Clear the checkpoint because the partition it tracks was destroyed or
erased, so a subsequent Self::open of a reused partition name
starts fresh at 0 rather than remembering content the partition no
longer has.
§Errors
Returns EventLogError::Checkpoint if the durable sync fails.
Auto Trait Implementations§
impl<E> !RefUnwindSafe for EventCountCheckpoint<E>
impl<E> !UnwindSafe for EventCountCheckpoint<E>
impl<E> Freeze for EventCountCheckpoint<E>
impl<E> Send for EventCountCheckpoint<E>
impl<E> Sync for EventCountCheckpoint<E>
impl<E> Unpin for EventCountCheckpoint<E>
impl<E> UnsafeUnpin for EventCountCheckpoint<E>
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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