pub trait CheckpointStore<S> {
// Required methods
fn save(&self, checkpoint: Checkpoint<S>) -> Result<(), FoldError>
where S: Clone + Serialize;
fn load(&self, id: &str) -> Result<Option<Checkpoint<S>>, FoldError>
where S: Clone + Serialize;
fn load_latest(
&self,
prefix: &str,
) -> Result<Option<Checkpoint<S>>, FoldError>
where S: Clone + Serialize;
fn delete(&self, id: &str) -> Result<(), FoldError>;
fn list(&self) -> Result<Vec<String>, FoldError>;
}Expand description
Trait for checkpoint persistence backends.
The key is the checkpoint id string. load_latest returns the
checkpoint whose prefix matches — defined as all checkpoints whose
id starts with the given prefix, selecting the most recently created.
Ties on created_at are broken by uuid (lexicographic) for determinism.
Required Methods§
Sourcefn save(&self, checkpoint: Checkpoint<S>) -> Result<(), FoldError>
fn save(&self, checkpoint: Checkpoint<S>) -> Result<(), FoldError>
Persist a checkpoint, computing and storing an integrity hash.
Sourcefn load(&self, id: &str) -> Result<Option<Checkpoint<S>>, FoldError>
fn load(&self, id: &str) -> Result<Option<Checkpoint<S>>, FoldError>
Load a checkpoint by its exact id, verifying the integrity hash.
Returns Ok(None) when no checkpoint with that id exists.
Returns Err(FoldError::IntegrityMismatch) if the stored hash does not
match the recomputed hash of the loaded state.
Sourcefn load_latest(&self, prefix: &str) -> Result<Option<Checkpoint<S>>, FoldError>
fn load_latest(&self, prefix: &str) -> Result<Option<Checkpoint<S>>, FoldError>
Load the most recently created checkpoint whose id starts with prefix.
Ties on created_at are broken by uuid for determinism.
Returns None when no checkpoints match the prefix.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".