Skip to main content

SqliteStore

Struct SqliteStore 

Source
pub struct SqliteStore { /* private fields */ }
Expand description

SQLite-backed storage engine.

Implementations§

Source§

impl SqliteStore

Source

pub fn open(db_path: &Path) -> Result<Self>

Open an existing ledger.db.

Source

pub fn open_or_create(db_path: &Path) -> Result<Self>

Open or create ledger.db with full schema.

Source

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.

Source

pub fn iter_events(&self) -> Result<Vec<Event>>

Read all events in insertion order.

Source

pub fn last_event_hash(&self) -> Result<Option<String>>

Get the hash of the last event.

Source

pub fn head_branch(&self) -> Result<String>

Read the current HEAD branch name.

Source

pub fn set_head_branch(&self, name: &str) -> Result<()>

Write the HEAD branch name.

Source

pub fn branches_json(&self) -> Result<Value>

Read branches.json equivalent from refs table.

Source

pub fn set_branches_json(&self, value: &Value) -> Result<()>

Write branches.json equivalent to refs table.

Source

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.

Source

pub fn decision_timeline(&self, key: &str) -> Result<Vec<DecisionRow>>

All decisions for a key (active + superseded), ordered by time.

Source

pub fn domain_timeline(&self, domain: &str) -> Result<Vec<DecisionRow>>

All decisions for a domain (active + superseded), ordered by time.

Source

pub fn list_domains(&self) -> Result<Vec<String>>

Distinct domain values from active decisions.

Source

pub fn find_active_decision( &self, branch: &str, key: &str, ) -> Result<Option<DecisionRow>>

Find the active decision for a specific key on a branch.

Trait Implementations§

Source§

impl Drop for SqliteStore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V