Skip to main content

CheckpointBackend

Trait CheckpointBackend 

Source
pub trait CheckpointBackend:
    Send
    + Sync
    + Debug {
Show 13 methods // Required methods fn init_run(&self, run_id: RunId, task: &str, run_dir: &str) -> Result<()>; fn init_run_with_meta( &self, run_id: RunId, task: &str, run_dir: &str, workflow_meta: Value, ) -> Result<()>; fn open_run(&self, run_id: RunId) -> Result<Option<RunCheckpoint>>; fn append_event(&self, event: &AgentEvent) -> Result<()>; fn upsert_agent_result(&self, cache: &AgentResultCache) -> Result<()>; fn upsert_agent_session( &self, session: &AgentSessionCheckpoint, ) -> Result<()>; fn get_checkpoint(&self) -> Option<RunCheckpoint>; fn get_findings(&self) -> Vec<Finding>; fn get_event_log(&self) -> Result<Vec<AgentEvent>>; fn can_resume(&self) -> bool; fn reset_status_to_running(&self) -> Result<()>; fn cancel(&self) -> Result<()>; fn save_checkpoint(&self, checkpoint: &RunCheckpoint) -> Result<()>;
}
Expand description

Persistence backend for a single run.

Implementations (e.g. SqliteCheckpointBackend in luft-storage) provide checkpoint + event log storage. All methods are synchronous; async backends bridge internally via block_in_place.

Required Methods§

Source

fn init_run(&self, run_id: RunId, task: &str, run_dir: &str) -> Result<()>

Initialize a new run.

Source

fn init_run_with_meta( &self, run_id: RunId, task: &str, run_dir: &str, workflow_meta: Value, ) -> Result<()>

Initialize a new run with declarative workflow metadata.

Source

fn open_run(&self, run_id: RunId) -> Result<Option<RunCheckpoint>>

Open an existing run for resume. Returns None if not found.

Source

fn append_event(&self, event: &AgentEvent) -> Result<()>

Append an event to the log and update checkpoint state.

Source

fn upsert_agent_result(&self, cache: &AgentResultCache) -> Result<()>

Insert or update an agent result.

Source

fn upsert_agent_session(&self, session: &AgentSessionCheckpoint) -> Result<()>

Insert or update an agent session.

Source

fn get_checkpoint(&self) -> Option<RunCheckpoint>

Get current checkpoint (from in-memory cache).

Source

fn get_findings(&self) -> Vec<Finding>

Get all findings.

Source

fn get_event_log(&self) -> Result<Vec<AgentEvent>>

Get event log as a vector.

Source

fn can_resume(&self) -> bool

Check if a run can be resumed.

Source

fn reset_status_to_running(&self) -> Result<()>

Reset checkpoint status to Running.

Source

fn cancel(&self) -> Result<()>

Mark run as cancelled.

Source

fn save_checkpoint(&self, checkpoint: &RunCheckpoint) -> Result<()>

Save checkpoint (full overwrite).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§