pub struct CheckpointDriver { /* private fields */ }Expand description
Drives cursor checkpoints according to the channel’s configured policy.
Implementations§
Source§impl CheckpointDriver
impl CheckpointDriver
Sourcepub fn new(policy: impl Into<CheckpointPolicy>) -> Self
pub fn new(policy: impl Into<CheckpointPolicy>) -> Self
Creates a checkpoint driver from a checkpoint policy or full durability config.
Sourcepub const fn from_policy(policy: CheckpointPolicy) -> Self
pub const fn from_policy(policy: CheckpointPolicy) -> Self
Creates a checkpoint driver from an explicit checkpoint policy.
Sourcepub const fn from_config(config: DurabilityConfig) -> Self
pub const fn from_config(config: DurabilityConfig) -> Self
Creates a checkpoint driver from a durability configuration.
Sourcepub const fn policy(&self) -> CheckpointPolicy
pub const fn policy(&self) -> CheckpointPolicy
Returns the active checkpoint policy.
Sourcepub const fn messages_since_last_checkpoint(&self) -> usize
pub const fn messages_since_last_checkpoint(&self) -> usize
Returns the number of processed messages since the last successful checkpoint.
Sourcepub const fn pending_offset(&self) -> Option<u64>
pub const fn pending_offset(&self) -> Option<u64>
Returns the latest processed offset waiting to be checkpointed.
Sourcepub async fn record_processed(
&mut self,
cursor: &mut ConsumerCursor,
store: &dyn DurableStore,
next_offset: u64,
) -> Result<(), DurabilityError>
pub async fn record_processed( &mut self, cursor: &mut ConsumerCursor, store: &dyn DurableStore, next_offset: u64, ) -> Result<(), DurabilityError>
Records one processed message and checkpoints if the configured policy requires it.
next_offset is the partition offset from which the consumer should resume after the
processed message. The driver delegates all persistence to ConsumerCursor::checkpoint.
§Errors
Returns cursor checkpoint errors from the store, or a configuration error for an invalid raw batch policy.
Sourcepub async fn flush(
&mut self,
cursor: &mut ConsumerCursor,
store: &dyn DurableStore,
) -> Result<(), DurabilityError>
pub async fn flush( &mut self, cursor: &mut ConsumerCursor, store: &dyn DurableStore, ) -> Result<(), DurabilityError>
Flushes any processed offset that is waiting to be checkpointed.
§Errors
Returns cursor checkpoint errors from the store, or a configuration error for an invalid raw batch policy.
Trait Implementations§
Source§impl Clone for CheckpointDriver
impl Clone for CheckpointDriver
Source§fn clone(&self) -> CheckpointDriver
fn clone(&self) -> CheckpointDriver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CheckpointDriver
impl Debug for CheckpointDriver
impl Eq for CheckpointDriver
Source§impl PartialEq for CheckpointDriver
impl PartialEq for CheckpointDriver
Source§fn eq(&self, other: &CheckpointDriver) -> bool
fn eq(&self, other: &CheckpointDriver) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CheckpointDriver
Auto Trait Implementations§
impl Freeze for CheckpointDriver
impl RefUnwindSafe for CheckpointDriver
impl Send for CheckpointDriver
impl Sync for CheckpointDriver
impl Unpin for CheckpointDriver
impl UnsafeUnpin for CheckpointDriver
impl UnwindSafe for CheckpointDriver
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.