pub trait Checkpointer<S: StateSchema>: Send + Sync {
// Required methods
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 S,
recursion_count: usize,
) -> Pin<Box<dyn Future<Output = GraphResult<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = GraphResult<S>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = GraphResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn last<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Option<(S, usize)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn snapshots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<CheckpointInfo<S>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn update_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
state: &'life2 S,
expected_version: u64,
) -> Pin<Box<dyn Future<Output = GraphResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Checkpointer trait for state persistence
Required Methods§
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 S,
recursion_count: usize,
) -> Pin<Box<dyn Future<Output = GraphResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 S,
recursion_count: usize,
) -> Pin<Box<dyn Future<Output = GraphResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Insert a new checkpoint, recording how much of the recursion budget had been consumed by the run at that point (M6).
Sourcefn load<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = GraphResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = GraphResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the state saved under the given checkpoint id.
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List checkpoint ids, ordered from oldest to most recent (H5).
Provided Methods§
Sourcefn snapshots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<CheckpointInfo<S>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn snapshots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GraphResult<Vec<CheckpointInfo<S>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List every checkpoint as a full snapshot (state + ordering keys + recursion budget), oldest first.
Used by CompiledGraph::get_state_history
and time-travel forks. The default reconstructs a state-only history from
list + load and reports an unknown
timestamp/seq/recursion_count of 0; backends that store the full
CheckpointData (or its columns) override this to report the real
ordering keys and budget.
Sourcefn update_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
state: &'life2 S,
expected_version: u64,
) -> Pin<Box<dyn Future<Output = GraphResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
checkpoint_id: &'life1 str,
state: &'life2 S,
expected_version: u64,
) -> Pin<Box<dyn Future<Output = GraphResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Replace the state stored in an existing checkpoint (the LangGraph
updateState analogue), using optimistic concurrency control.
expected_version is the version of the state the edit is based on
(every fresh checkpoint starts at version 1, and each successful
update_state bumps it). When the stored version has moved on because
another writer edited the checkpoint first, the call fails with
GraphError::CheckpointVersionConflict instead of overwriting that
edit. Returns the new version.
Backends without edit support keep the default implementation, which
fails with GraphError::CheckpointError.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".