pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
pub fn open(path: impl AsRef<Path>) -> Result<Self, StoreError>
pub fn open_in_memory() -> Result<Self, StoreError>
pub fn upsert_execution(&self, rec: &ExecutionRecord) -> Result<(), StoreError>
pub fn upsert_step(&self, rec: &ExecutionStepRecord) -> Result<(), StoreError>
pub fn record_interception( &self, rec: &InterceptionRecord, ) -> Result<(), StoreError>
Sourcepub fn record_ai_audit(&self, rec: &AiAuditRecord) -> Result<(), StoreError>
pub fn record_ai_audit(&self, rec: &AiAuditRecord) -> Result<(), StoreError>
Append one AI audit event. Insert-only: the trail is written as part of the execution cycle and never updated after the fact.
Sourcepub fn list_ai_audit(
&self,
execution_id: &str,
) -> Result<Vec<AiAuditRecord>, StoreError>
pub fn list_ai_audit( &self, execution_id: &str, ) -> Result<Vec<AiAuditRecord>, StoreError>
The AI audit trail for one execution, in insertion order.
Sourcepub fn load_memory(&self) -> Result<HashMap<String, Value>, StoreError>
pub fn load_memory(&self) -> Result<HashMap<String, Value>, StoreError>
Load the persisted working-memory map (durable agent memory, roadmap E1).
One row per {{memory.<key>}} entry; the value is JSON. Unparseable rows
are skipped rather than failing the whole load.
Sourcepub fn save_memory(
&self,
map: &HashMap<String, Value>,
) -> Result<(), StoreError>
pub fn save_memory( &self, map: &HashMap<String, Value>, ) -> Result<(), StoreError>
Replace the persisted working memory with a full snapshot of map.
Sourcepub fn clear_memory(&self) -> Result<(), StoreError>
pub fn clear_memory(&self) -> Result<(), StoreError>
Clear all persisted working memory.
pub fn list_executions( &self, limit: usize, ) -> Result<Vec<ExecutionRecord>, StoreError>
pub fn get_execution( &self, execution_id: &str, ) -> Result<Option<(ExecutionRecord, Vec<ExecutionStepRecord>, Vec<InterceptionRecord>)>, StoreError>
Sourcepub fn list_runs(&self, limit: usize) -> Result<Vec<RunSummary>, StoreError>
pub fn list_runs(&self, limit: usize) -> Result<Vec<RunSummary>, StoreError>
Run summaries for list views, newest first - each with its monotonic run
number (rowid) and the first failed node (for a failed @ <node> label).
pub fn list_template_collections( &self, ) -> Result<Vec<TemplateCollectionRecord>, StoreError>
pub fn get_template_collection( &self, slug: &str, ) -> Result<Option<TemplateCollectionRecord>, StoreError>
Sourcepub fn upsert_template_collection(
&self,
slug: &str,
name: &str,
is_system: bool,
) -> Result<TemplateCollectionRecord, StoreError>
pub fn upsert_template_collection( &self, slug: &str, name: &str, is_system: bool, ) -> Result<TemplateCollectionRecord, StoreError>
Insert if absent, otherwise update name + updated_at. is_system
is set only on first insert - a subsequent upsert with is_system = false does NOT downgrade an existing system row. This makes the
boot-time ensure_default idempotent without racing user renames.
pub fn rename_template_collection( &self, slug: &str, new_name: &str, ) -> Result<TemplateCollectionRecord, StoreError>
Sourcepub fn delete_template_collection(&self, slug: &str) -> Result<(), StoreError>
pub fn delete_template_collection(&self, slug: &str) -> Result<(), StoreError>
Refuses on is_system = true and on any extant membership row pointing
at the collection. Caller is expected to move templates out (set their
membership to another collection, or delete them) first.
pub fn list_template_memberships( &self, ) -> Result<Vec<TemplateMembershipRow>, StoreError>
pub fn get_template_membership( &self, template_slug: &str, ) -> Result<Option<TemplateMembershipRow>, StoreError>
pub fn upsert_template_membership( &self, row: &TemplateMembershipRow, ) -> Result<(), StoreError>
pub fn delete_template_membership( &self, template_slug: &str, ) -> Result<(), StoreError>
Sourcepub fn get_flow_workspace(
&self,
flow_id: &str,
) -> Result<Option<String>, StoreError>
pub fn get_flow_workspace( &self, flow_id: &str, ) -> Result<Option<String>, StoreError>
The per-flow workspace override, keyed by FlowGraph.id. None when the
flow uses the edition default. Local machine state - never in the flow file.
pub fn set_flow_workspace( &self, flow_id: &str, path: &str, ) -> Result<(), StoreError>
pub fn clear_flow_workspace(&self, flow_id: &str) -> Result<(), StoreError>
pub fn list_node_library_rows(&self) -> Result<Vec<NodeLibraryRow>, StoreError>
pub fn get_node_library_row( &self, slug: &str, ) -> Result<Option<NodeLibraryRow>, StoreError>
Sourcepub fn upsert_node_library_row(
&self,
row: &NodeLibraryRow,
) -> Result<NodeLibraryRow, StoreError>
pub fn upsert_node_library_row( &self, row: &NodeLibraryRow, ) -> Result<NodeLibraryRow, StoreError>
Insert if absent, else update version + installed_at.
pub fn delete_node_library_row(&self, slug: &str) -> Result<(), StoreError>
Sourcepub fn upsert_schedule(&self, rec: &ScheduleRecord) -> Result<(), StoreError>
pub fn upsert_schedule(&self, rec: &ScheduleRecord) -> Result<(), StoreError>
Insert or replace a flow’s schedule (keyed by template_slug). created_at
is preserved on update.
pub fn get_schedule( &self, template_slug: &str, ) -> Result<Option<ScheduleRecord>, StoreError>
pub fn list_schedules(&self) -> Result<Vec<ScheduleRecord>, StoreError>
Sourcepub fn list_due_schedules(
&self,
now: DateTime<Utc>,
) -> Result<Vec<ScheduleRecord>, StoreError>
pub fn list_due_schedules( &self, now: DateTime<Utc>, ) -> Result<Vec<ScheduleRecord>, StoreError>
Enabled schedules whose next_run_at is at or before now - the rows the
background scheduler should fire on this tick.
Sourcepub fn mark_schedule_run(
&self,
template_slug: &str,
last_run_at: DateTime<Utc>,
next_run_at: Option<DateTime<Utc>>,
last_status: &str,
) -> Result<(), StoreError>
pub fn mark_schedule_run( &self, template_slug: &str, last_run_at: DateTime<Utc>, next_run_at: Option<DateTime<Utc>>, last_status: &str, ) -> Result<(), StoreError>
Advance a schedule’s timer on a fire: set last_run_at, the recomputed
next_run_at, and bump the run counter.