Skip to main content

CheckpointStore

Trait CheckpointStore 

Source
pub trait CheckpointStore: Send + Sync {
    // Required methods
    fn load(&self, id: CheckpointId) -> Result<Checkpoint, CheckpointError>;
    fn compare_and_swap(
        &self,
        checkpoint: &Checkpoint,
        expected_revision: Option<u64>,
    ) -> Result<(), CheckpointError>;
}
Expand description

Atomic persistence boundary for checkpoints.

Required Methods§

Source

fn load(&self, id: CheckpointId) -> Result<Checkpoint, CheckpointError>

Loads the latest checkpoint revision.

§Errors

Returns CheckpointError when storage fails or the checkpoint does not exist.

Source

fn compare_and_swap( &self, checkpoint: &Checkpoint, expected_revision: Option<u64>, ) -> Result<(), CheckpointError>

Creates or atomically replaces a checkpoint.

expected_revision = None means create-only. An existing checkpoint makes that operation conflict. Updates must provide the exact current revision and a checkpoint whose revision is one greater.

§Errors

Returns CheckpointError on storage failure or revision conflict.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§