pub struct SqliteStore { /* private fields */ }Expand description
SQLite-backed storage engine.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open_or_create(db_path: &Path) -> Result<Self>
pub fn open_or_create(db_path: &Path) -> Result<Self>
Open or create ledger.db with full schema.
Sourcepub fn append_event(&self, event: &Event) -> Result<()>
pub fn append_event(&self, event: &Event) -> Result<()>
Append an event. Append-only (CONTRACT LEDGER-02).
If the event is a decision (note with "decision" tag), the decisions
table is also updated atomically within the same transaction.
Sourcepub fn iter_events(&self) -> Result<Vec<Event>>
pub fn iter_events(&self) -> Result<Vec<Event>>
Read all events in insertion order.
Sourcepub fn last_event_hash(&self) -> Result<Option<String>>
pub fn last_event_hash(&self) -> Result<Option<String>>
Get the hash of the last event.
Sourcepub fn head_branch(&self) -> Result<String>
pub fn head_branch(&self) -> Result<String>
Read the current HEAD branch name.
Sourcepub fn set_head_branch(&self, name: &str) -> Result<()>
pub fn set_head_branch(&self, name: &str) -> Result<()>
Write the HEAD branch name.
Sourcepub fn branches_json(&self) -> Result<Value>
pub fn branches_json(&self) -> Result<Value>
Read branches.json equivalent from refs table.
Sourcepub fn set_branches_json(&self, value: &Value) -> Result<()>
pub fn set_branches_json(&self, value: &Value) -> Result<()>
Write branches.json equivalent to refs table.
Sourcepub fn active_decisions(
&self,
domain: Option<&str>,
key_pattern: Option<&str>,
) -> Result<Vec<DecisionRow>>
pub fn active_decisions( &self, domain: Option<&str>, key_pattern: Option<&str>, ) -> Result<Vec<DecisionRow>>
Query active decisions, optionally filtered by domain or key prefix.
Sourcepub fn decision_timeline(&self, key: &str) -> Result<Vec<DecisionRow>>
pub fn decision_timeline(&self, key: &str) -> Result<Vec<DecisionRow>>
All decisions for a key (active + superseded), ordered by time.
Sourcepub fn domain_timeline(&self, domain: &str) -> Result<Vec<DecisionRow>>
pub fn domain_timeline(&self, domain: &str) -> Result<Vec<DecisionRow>>
All decisions for a domain (active + superseded), ordered by time.
Sourcepub fn list_domains(&self) -> Result<Vec<String>>
pub fn list_domains(&self) -> Result<Vec<String>>
Distinct domain values from active decisions.
Sourcepub fn find_active_decision(
&self,
branch: &str,
key: &str,
) -> Result<Option<DecisionRow>>
pub fn find_active_decision( &self, branch: &str, key: &str, ) -> Result<Option<DecisionRow>>
Find the active decision for a specific key on a branch.