pub trait Checkpointer: Send + Sync {
// Required methods
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint: &'life1 Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<String, GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn load_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn prune<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_thread_id: &'life1 str,
_policy: &'life2 RetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<usize, GraphError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait { ... }
}Available on crate feature
graph only.Expand description
Checkpointer trait for persistence
Required Methods§
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint: &'life1 Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<String, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint: &'life1 Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<String, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Save a checkpoint
Sourcefn load<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Load the latest checkpoint for a thread
Sourcefn load_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn load_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Load a specific checkpoint by ID
Provided Methods§
Sourcefn prune<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_thread_id: &'life1 str,
_policy: &'life2 RetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<usize, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn prune<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_thread_id: &'life1 str,
_policy: &'life2 RetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<usize, GraphError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Removes the checkpoints a retention policy discards, keeping the newest.
Returns how many were removed. The default keeps everything, so a backend written before this existed is unaffected and a thread grows as before.
§Errors
Returns an error when the backend cannot be read or written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".