Skip to main content

CheckpointStore

Trait CheckpointStore 

Source
pub trait CheckpointStore: Send + Sync {
Show 14 methods // Required methods fn save<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_latest<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_by_id<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn prune<'life0, 'async_trait>( &'life0 self, keep_count: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_state_data<'life0, 'life1, 'async_trait>( &'life0 self, id: u64, chunks: &'life1 [Bytes], ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_state_data<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn vnode_count(&self) -> u16 { ... } fn list_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn update_manifest<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn validate_checkpoint<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<ValidationResult, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn recover_latest_validated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RecoveryReport, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn cleanup_orphans<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn save_with_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, state_data: Option<&'life2 [Bytes]>, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}
Expand description

Trait for checkpoint persistence backends.

Implementations must guarantee atomic manifest writes (readers never see a partial manifest). The latest.txt pointer is updated only after the manifest is fully written and synced.

Required Methods§

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically persists a checkpoint manifest. Implementations must guarantee readers never observe a partial manifest.

§Errors

Returns CheckpointStoreError on I/O or serialization failure.

Source

fn load_latest<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads the most recent checkpoint manifest, or Ok(None) on a fresh store.

§Errors

Returns CheckpointStoreError on I/O or deserialization failure.

Source

fn load_by_id<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads a specific manifest, or Ok(None) if absent.

§Errors

Returns CheckpointStoreError on I/O or deserialization failure.

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all available checkpoints as (id, epoch) pairs, sorted ascending by ID. May read every manifest; callers that only need IDs should use Self::list_ids.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn prune<'life0, 'async_trait>( &'life0 self, keep_count: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Prunes old checkpoints, keeping at most keep_count recent ones. Returns the number of checkpoints removed.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn save_state_data<'life0, 'life1, 'async_trait>( &'life0 self, id: u64, chunks: &'life1 [Bytes], ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes operator state sidecar bytes for a checkpoint.

Accepts a chain of Bytes chunks (one per operator) rather than a single concatenated slice. Backends that support native multi-chunk writes (object-store PutPayload) avoid copying the chunks into a contiguous buffer; backends without such support write sequentially.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn load_state_data<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads operator state sidecar bytes for a checkpoint, or Ok(None) if no sidecar was written.

§Errors

Returns CheckpointStoreError on I/O failure.

Provided Methods§

Source

fn vnode_count(&self) -> u16

Runtime vnode count that manifests written by this store are expected to use. Consulted when validating loaded manifests — a mismatch is reported as a manifest warning. Defaults to crate::checkpoint_manifest::DEFAULT_VNODE_COUNT when the implementation has no configured value.

Source

fn list_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all checkpoint IDs, sorted ascending. Unlike Self::list this enumerates corrupt manifests too (used by crash recovery). Callers rely on the ascending invariant.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn update_manifest<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Overwrites an existing manifest, bypassing the conditional-PUT fence used by Self::save. Used after a successful sink commit to record per-sink status transitions.

§Errors

Returns CheckpointStoreError on I/O or serialization failure.

Source

fn validate_checkpoint<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<ValidationResult, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validate a specific checkpoint’s integrity.

Checks that the manifest is parseable and, if a state_checksum is present, verifies the sidecar data matches.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn recover_latest_validated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RecoveryReport, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Walk backward from latest to find the first valid checkpoint.

Returns a RecoveryReport describing the walk. If no valid checkpoint is found, chosen_id is None (fresh start).

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn cleanup_orphans<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete orphaned state files that have no matching manifest.

Returns the number of orphans cleaned up.

§Errors

Returns CheckpointStoreError on I/O failure.

Source

fn save_with_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, state_data: Option<&'life2 [Bytes]>, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically saves a checkpoint manifest with optional sidecar state data.

When state_data is provided, the sidecar (state.bin) is written and fsynced before the manifest. This ensures that if the sidecar write fails, the manifest is never persisted and latest.txt still points to the previous valid checkpoint.

Orphaned state.bin files (written but no manifest) are harmless and cleaned up by prune().

§Errors

Returns CheckpointStoreError on I/O or serialization failure.

Implementors§