Skip to main content

Checkpointer

Trait Checkpointer 

Source
pub trait Checkpointer: Send + Sync {
    // Required methods
    fn save<'life0, 'async_trait>(
        &'life0 self,
        checkpoint: Checkpoint,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load_latest<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_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 list_sessions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Persistent storage and retrieval of workflow execution state.

Implementations must be Send + Sync and handle concurrent access to the same session gracefully. The save operation replaces any existing snapshot for the session; load_latest returns None for absent sessions.

Required Methods§

Source

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

Persist a checkpoint, replacing any prior snapshot for the same session.

Source

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

Return the most recent checkpoint for a session, or None if absent.

Source

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

Return all session IDs that have at least one stored checkpoint.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Checkpointer for InMemoryCheckpointer

Source§

impl Checkpointer for PostgresCheckpointer

Available on crate feature postgres only.
Source§

impl Checkpointer for SQLiteCheckpointer

Available on crate feature sqlite only.