pub struct PersistentStore { /* private fields */ }Expand description
Persistent store wrapping a SQLite connection.
Implementations§
Source§impl PersistentStore
impl PersistentStore
Sourcepub fn open(data_dir: &Path) -> Result<Self, String>
pub fn open(data_dir: &Path) -> Result<Self, String>
Open (or create) the SQLite database at {data_dir}/agent-graph.db.
Sourcepub fn open_with_integrity_key(
data_dir: &Path,
integrity_key_path: Option<&Path>,
) -> Result<Self, String>
pub fn open_with_integrity_key( data_dir: &Path, integrity_key_path: Option<&Path>, ) -> Result<Self, String>
Open (or create) the SQLite database with an explicit integrity key path.
If integrity_key_path is None, falls back to the
AGENT_GRAPH_INTEGRITY_KEY_PATH environment variable.
pub fn has_integrity_key(&self) -> bool
pub fn capture_witness( &self, capture: WitnessCapture, ) -> Result<WitnessRecord, WitnessError>
pub fn get_witness( &self, witness_id: &str, ) -> Result<Option<WitnessRecord>, WitnessError>
pub fn save_graph( &self, name: &str, spec_json: &str, topology_hash: &str, overwrite: bool, ) -> Result<(), String>
pub fn load_graph(&self, name: &str) -> Result<Option<(String, String)>, String>
pub fn list_graphs(&self) -> Result<Vec<(String, String, String)>, String>
pub fn graph_is_tombstoned(&self, graph_id: &str) -> Result<bool, String>
pub fn graph_retention_review( &self, graph_id: Option<&str>, state: Option<&str>, limit: usize, ) -> Result<Vec<GraphRetentionReport>, String>
Sourcepub fn apply_operator_retention(
&self,
request: &OperatorRetentionRequest,
) -> Result<OperatorRetentionResult, OperatorRetentionError>
pub fn apply_operator_retention( &self, request: &OperatorRetentionRequest, ) -> Result<OperatorRetentionResult, OperatorRetentionError>
Apply one OS-authenticated retention mutation and its receipt atomically. The caller must have already validated peer credentials and the time window.
pub fn set_graph_retention( &self, graph_id: &str, state: &str, reason: &str, actor: &str, review_after: Option<&str>, ) -> Result<GraphRetentionRecord, GraphRetentionError>
pub fn graph_execution_allowed(&self, graph_id: &str) -> Result<bool, String>
pub fn delete_graph(&self, name: &str) -> Result<GraphDeleteResult, String>
pub fn load_graph_version( &self, name: &str, topology_hash: &str, ) -> Result<Option<String>, String>
pub fn list_graph_versions(&self, name: &str) -> Result<Vec<String>, String>
pub fn save_execution( &self, run_id: &str, graph_name: &str, graph_hash: &str, status: &str, input_json: &str, ) -> Result<(), String>
pub fn save_execution_with_budgets( &self, run_id: &str, graph_name: &str, graph_hash: &str, status: &str, input_json: &str, budgets_json: Option<&str>, ) -> Result<(), String>
pub fn update_execution_status( &self, run_id: &str, status: &str, final_state_json: Option<&str>, total_nodes: Option<usize>, failed_attempts: Option<usize>, ) -> Result<(), String>
pub fn persist_terminal_projection( &self, run_id: &str, status: &str, final_state_json: &str, total_nodes: usize, events: &[(u64, String, String)], receipt_json: &str, bundle_json: &str, ) -> Result<String, String>
pub fn load_terminal_receipt( &self, run_id: &str, ) -> Result<Option<Value>, String>
Sourcepub fn recover_incomplete_executions(&self) -> Result<(), String>
pub fn recover_incomplete_executions(&self) -> Result<(), String>
A server restart cannot resume an in-flight graph. Make that interruption
explicit instead of leaving a permanently misleading running row.
Sourcepub fn load_execution(&self, run_id: &str) -> Result<Option<Value>, String>
pub fn load_execution(&self, run_id: &str) -> Result<Option<Value>, String>
Return the terminal projection retained by SQLite. This is deliberately not a resumable checkpoint or replay artifact.
pub fn load_execution_contract( &self, run_id: &str, ) -> Result<Option<ExecutionContract>, String>
pub fn create_resume_checkpoint( &self, run_id: &str, graph_id: &str, graph_version: &str, next_node_cursor: &str, state: &Value, budgets: &Value, budget_counters: &Value, dependency_summary: &Value, terminal_cursor: u64, event_cursor: u64, ) -> Result<CheckpointRecord, CheckpointError>
pub fn load_resume_checkpoint( &self, checkpoint_id: Option<&str>, run_id: Option<&str>, ) -> Result<Option<CheckpointRecord>, CheckpointError>
pub fn consume_resume_checkpoint( &self, checkpoint_id: &str, ) -> Result<CheckpointRecord, CheckpointError>
pub fn create_checkpoint_approval( &self, checkpoint_id: &str, graph_id: &str, graph_version: &str, next_node_cursor: &str, expected_state: &Value, expected_budgets: &Value, expected_budget_counters: &Value, dependency_summary: &Value, audience: &str, prompt_digest: &str, allowed_decisions: &[String], expires_at: &str, ) -> Result<ApprovalRecord, ApprovalError>
pub fn get_checkpoint_approval( &self, approval_id: &str, ) -> Result<Option<ApprovalRecord>, ApprovalError>
pub fn list_checkpoint_approvals( &self, run_id: Option<&str>, status: Option<&str>, limit: usize, ) -> Result<Vec<ApprovalRecord>, ApprovalError>
pub fn checkpoint_approval_status( &self, checkpoint_id: &str, ) -> Result<Option<String>, ApprovalError>
pub fn decide_checkpoint_approval( &self, approval_id: &str, decision: &str, actor: &str, now: DateTime<Utc>, ) -> Result<ApprovedCheckpoint, ApprovalError>
pub fn approval_receipt_value(approval: &ApprovalRecord) -> Value
pub fn save_checkpoint( &self, run_id: &str, node_id: &str, attempt: u32, input_json: &str, output_json: Option<&str>, status: &str, error: Option<&str>, ) -> Result<(), String>
pub fn save_event( &self, run_id: &str, seq: u64, event_type: &str, event_json: &str, ) -> Result<(), String>
pub fn load_events( &self, run_id: &str, cursor: u64, limit: usize, ) -> Result<Option<Value>, String>
Sourcepub fn check_idempotency(
&self,
key: &str,
) -> Result<Option<(Option<String>, Value)>, String>
pub fn check_idempotency( &self, key: &str, ) -> Result<Option<(Option<String>, Value)>, String>
Look up a cached idempotent response together with the canonical request digest it was bound to. A NULL digest is a pre-migration record and must never be replayed for a new request.