pub trait CheckpointStore: Send + Sync {
// Required methods
fn create_run(
&self,
graph_name: &str,
) -> Pin<Box<dyn Future<Output = Result<RunId>> + Send + '_>>;
fn record_attempt(
&self,
run_id: &str,
node_id: &str,
attempt: u32,
input: &Value,
) -> Pin<Box<dyn Future<Output = Result<CheckpointAttemptId>> + Send + '_>>;
fn complete_attempt(
&self,
attempt_id: &str,
output: &Value,
meta: &HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn fail_attempt(
&self,
attempt_id: &str,
error: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn record_interrupt(
&self,
attempt_id: &str,
interrupt: &Interrupt,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn save_state_snapshot(
&self,
run_id: &str,
state: &HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn load_run(
&self,
run_id: &str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunState>>> + Send + '_>>;
fn complete_run(
&self,
run_id: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn fail_run(
&self,
run_id: &str,
error: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
}Expand description
Granular checkpoint store for per-attempt recording.
This trait uses boxed futures instead of async-trait for forward compat.
Required Methods§
Sourcefn create_run(
&self,
graph_name: &str,
) -> Pin<Box<dyn Future<Output = Result<RunId>> + Send + '_>>
fn create_run( &self, graph_name: &str, ) -> Pin<Box<dyn Future<Output = Result<RunId>> + Send + '_>>
Create a new run and return its ID.
Sourcefn record_attempt(
&self,
run_id: &str,
node_id: &str,
attempt: u32,
input: &Value,
) -> Pin<Box<dyn Future<Output = Result<CheckpointAttemptId>> + Send + '_>>
fn record_attempt( &self, run_id: &str, node_id: &str, attempt: u32, input: &Value, ) -> Pin<Box<dyn Future<Output = Result<CheckpointAttemptId>> + Send + '_>>
Record a new node attempt (status: Running).
Sourcefn complete_attempt(
&self,
attempt_id: &str,
output: &Value,
meta: &HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn complete_attempt( &self, attempt_id: &str, output: &Value, meta: &HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Mark an attempt as completed with output.
Sourcefn fail_attempt(
&self,
attempt_id: &str,
error: &str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn fail_attempt( &self, attempt_id: &str, error: &str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Mark an attempt as failed.
Sourcefn record_interrupt(
&self,
attempt_id: &str,
interrupt: &Interrupt,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn record_interrupt( &self, attempt_id: &str, interrupt: &Interrupt, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Record an interrupt on an attempt.
Sourcefn save_state_snapshot(
&self,
run_id: &str,
state: &HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn save_state_snapshot( &self, run_id: &str, state: &HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Save the current state snapshot for a run.
Sourcefn load_run(
&self,
run_id: &str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunState>>> + Send + '_>>
fn load_run( &self, run_id: &str, ) -> Pin<Box<dyn Future<Output = Result<Option<RunState>>> + Send + '_>>
Load the full run state (for resume).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".