Skip to main content

BaseCheckpointSaver

Trait BaseCheckpointSaver 

Source
pub trait BaseCheckpointSaver: Send + Sync {
    // Required methods
    fn get_tuple<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 Config,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointTuple>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        checkpoint: &'life1 Checkpoint,
        metadata: &'life2 CheckpointMetadata,
        config: &'life3 Config,
    ) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 Config,
        limit: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointTuple>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        checkpoint_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn delete_thread<'life0, 'life1, 'async_trait>(
        &'life0 self,
        thread_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn prune<'life0, 'life1, 'async_trait>(
        &'life0 self,
        thread_id: &'life1 str,
        keep: usize,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Trait for checkpoint storage backends.

Implementations of this trait provide persistent storage for checkpoints, enabling save/resume functionality across process restarts.

Required Methods§

Source

fn get_tuple<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 Config, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointTuple>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a checkpoint tuple for the given configuration.

If config.checkpoint_id is set, returns that specific checkpoint. Otherwise, returns the latest checkpoint for the thread.

Source

fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, checkpoint: &'life1 Checkpoint, metadata: &'life2 CheckpointMetadata, config: &'life3 Config, ) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Save a checkpoint.

Returns an updated Config with the checkpoint ID set.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 Config, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointTuple>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List checkpoints for a given configuration.

Returns checkpoints in reverse chronological order.

Provided Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, checkpoint_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a specific checkpoint by ID

Source

fn delete_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete all checkpoints for a thread

Source

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

Prune old checkpoints, keeping only the most recent ones

Implementors§