Skip to main content

CheckpointSaver

Trait CheckpointSaver 

Source
pub trait CheckpointSaver:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get_tuple<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 RunnableConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointTuple>, CheckpointError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 RunnableConfig,
        filter: Option<CheckpointFilter>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointTuple>, CheckpointError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn put<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 RunnableConfig,
        checkpoint: Checkpoint,
        metadata: CheckpointMetadata,
    ) -> Pin<Box<dyn Future<Output = Result<RunnableConfig, CheckpointError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn put_writes<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        config: &'life1 RunnableConfig,
        writes: Vec<PendingWrite>,
        task_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Checkpoint persistence interface

Trait defining operations for saving, loading, and listing checkpoints. This trait is implemented by storage backends in the juncture-checkpoint crate.

§Example

use juncture_core::CheckpointSaver;
use juncture_checkpoint::MemorySaver;

let saver = MemorySaver::new();
// Use saver as a CheckpointSaver trait object...

Required Methods§

Source

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

Get checkpoint tuple by configuration

§Errors

Returns CheckpointError if retrieval fails.

Source

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

List checkpoints with optional filtering

§Errors

Returns CheckpointError if listing fails.

Source

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

Save a checkpoint

§Errors

Returns CheckpointError if saving fails.

Source

fn put_writes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, config: &'life1 RunnableConfig, writes: Vec<PendingWrite>, task_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Save incremental writes from a completed task

§Errors

Returns CheckpointError if saving fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§