pub struct InMemoryCheckpointStore { /* private fields */ }Expand description
A bounded in-memory checkpoint store.
Each stream maintains its own sorted list of checkpoints. When the number
of checkpoints for a stream exceeds max_per_stream, the oldest ones are
evicted automatically.
Implementations§
Source§impl InMemoryCheckpointStore
impl InMemoryCheckpointStore
Sourcepub fn new(max_per_stream: usize) -> Self
pub fn new(max_per_stream: usize) -> Self
Create a store that retains at most max_per_stream checkpoints per stream.
Sourcepub fn save(&mut self, state: CheckpointState) -> Result<(), StreamingError>
pub fn save(&mut self, state: CheckpointState) -> Result<(), StreamingError>
Save a checkpoint state. The list is kept sorted by sequence number.
Sourcepub fn latest(&self, stream_id: &str) -> Option<&CheckpointState>
pub fn latest(&self, stream_id: &str) -> Option<&CheckpointState>
Return the most recent checkpoint for the given stream, or None.
Sourcepub fn list(&self, stream_id: &str) -> Vec<&CheckpointState>
pub fn list(&self, stream_id: &str) -> Vec<&CheckpointState>
Return all checkpoints for the given stream, sorted ascending by sequence.
Sourcepub fn delete_before(&mut self, stream_id: &str, sequence: u64)
pub fn delete_before(&mut self, stream_id: &str, sequence: u64)
Remove all checkpoints for stream_id with sequence number less than sequence.
Sourcepub fn checkpoint_count(&self, stream_id: &str) -> usize
pub fn checkpoint_count(&self, stream_id: &str) -> usize
Number of checkpoints currently stored for the given stream.
Auto Trait Implementations§
impl Freeze for InMemoryCheckpointStore
impl RefUnwindSafe for InMemoryCheckpointStore
impl Send for InMemoryCheckpointStore
impl Sync for InMemoryCheckpointStore
impl Unpin for InMemoryCheckpointStore
impl UnsafeUnpin for InMemoryCheckpointStore
impl UnwindSafe for InMemoryCheckpointStore
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