pub struct IncrementalCheckpointManager { /* private fields */ }Expand description
Incremental checkpoint manager.
This manager creates and manages incremental checkpoints using directory-based snapshots with metadata tracking.
Implementations§
Source§impl IncrementalCheckpointManager
impl IncrementalCheckpointManager
Sourcepub fn new(config: CheckpointConfig) -> Result<Self, IncrementalCheckpointError>
pub fn new(config: CheckpointConfig) -> Result<Self, IncrementalCheckpointError>
Creates a new incremental checkpoint manager.
§Errors
Returns an error if the configuration is invalid or directory creation fails.
Sourcepub fn config(&self) -> &CheckpointConfig
pub fn config(&self) -> &CheckpointConfig
Returns the configuration.
Sourcepub fn set_source_offset(&mut self, source: String, offset: u64)
pub fn set_source_offset(&mut self, source: String, offset: u64)
Sets a source offset for exactly-once semantics.
Sourcepub fn source_offsets(&self) -> &HashMap<String, u64>
pub fn source_offsets(&self) -> &HashMap<String, u64>
Returns the source offsets.
Sourcepub fn set_watermark(&mut self, watermark: i64)
pub fn set_watermark(&mut self, watermark: i64)
Sets the current watermark.
Sourcepub fn latest_checkpoint_id(&self) -> Option<u64>
pub fn latest_checkpoint_id(&self) -> Option<u64>
Returns the latest checkpoint ID.
Sourcepub fn should_checkpoint(&self) -> bool
pub fn should_checkpoint(&self) -> bool
Checks if it’s time to create a checkpoint.
Sourcepub fn create_checkpoint(
&mut self,
wal_position: u64,
) -> Result<IncrementalCheckpointMetadata, IncrementalCheckpointError>
pub fn create_checkpoint( &mut self, wal_position: u64, ) -> Result<IncrementalCheckpointMetadata, IncrementalCheckpointError>
Creates a new incremental checkpoint.
This creates a checkpoint of the current state using directory-based snapshots.
§Errors
Returns an error if checkpoint creation fails.
Sourcepub fn create_checkpoint_with_state(
&mut self,
wal_position: u64,
source_offsets: HashMap<String, u64>,
watermark: Option<i64>,
state_data: &[u8],
) -> Result<IncrementalCheckpointMetadata, IncrementalCheckpointError>
pub fn create_checkpoint_with_state( &mut self, wal_position: u64, source_offsets: HashMap<String, u64>, watermark: Option<i64>, state_data: &[u8], ) -> Result<IncrementalCheckpointMetadata, IncrementalCheckpointError>
Creates a checkpoint with additional state data.
§Errors
Returns an error if checkpoint creation fails.
Sourcepub fn find_latest_checkpoint(
&self,
) -> Result<Option<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
pub fn find_latest_checkpoint( &self, ) -> Result<Option<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
Sourcepub fn load_checkpoint_metadata(
&self,
id: u64,
) -> Result<Option<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
pub fn load_checkpoint_metadata( &self, id: u64, ) -> Result<Option<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
Sourcepub fn load_checkpoint_state(
&self,
id: u64,
) -> Result<Vec<u8>, IncrementalCheckpointError>
pub fn load_checkpoint_state( &self, id: u64, ) -> Result<Vec<u8>, IncrementalCheckpointError>
Sourcepub fn list_checkpoints(
&self,
) -> Result<Vec<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
pub fn list_checkpoints( &self, ) -> Result<Vec<IncrementalCheckpointMetadata>, IncrementalCheckpointError>
Lists all checkpoints sorted by ID (newest first).
§Errors
Returns an error if reading checkpoints fails.
Sourcepub fn cleanup_old_checkpoints(&self) -> Result<(), IncrementalCheckpointError>
pub fn cleanup_old_checkpoints(&self) -> Result<(), IncrementalCheckpointError>
Sourcepub fn cleanup_old_checkpoints_keep(
&self,
keep_count: usize,
) -> Result<(), IncrementalCheckpointError>
pub fn cleanup_old_checkpoints_keep( &self, keep_count: usize, ) -> Result<(), IncrementalCheckpointError>
Cleans up old checkpoints, keeping only keep_count most recent.
§Errors
Returns an error if cleanup fails.
Sourcepub fn delete_checkpoint(
&mut self,
id: u64,
) -> Result<(), IncrementalCheckpointError>
pub fn delete_checkpoint( &mut self, id: u64, ) -> Result<(), IncrementalCheckpointError>
Auto Trait Implementations§
impl !Freeze for IncrementalCheckpointManager
impl RefUnwindSafe for IncrementalCheckpointManager
impl Send for IncrementalCheckpointManager
impl Sync for IncrementalCheckpointManager
impl Unpin for IncrementalCheckpointManager
impl UnsafeUnpin for IncrementalCheckpointManager
impl UnwindSafe for IncrementalCheckpointManager
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<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