Skip to main content

Crate mempill_sqlite

Crate mempill_sqlite 

Source
Expand description

mempill-sqlite — SQLite persistence adapter for mempill.

This crate provides the SQLite-backed implementation of the PersistencePort trait defined in mempill-core. It owns the database schema (DDL + indexes), the idempotent schema migration runner, and the full read + write path.

§Crate organisation

  • connection — connection lifecycle: open file or in-memory, apply mandatory PRAGMAs (journal_mode=WAL, synchronous=FULL, foreign_keys=ON), run migrations.
  • migrations — deterministic, idempotent schema migration runner; embeds DDL via include_str!.
  • txnSqliteTxn: the concrete Txn handle scoped to one agent_id.
  • storeSqlitePersistenceStore: impl PersistencePort — full read + write path.
  • DefaultEngine — convenience type alias + constructors for the most common setup.

§PRAGMA contract (applied at connection open — before migrations or any DML)

PRAGMA journal_mode = WAL;     -- concurrent reads during writes
PRAGMA synchronous  = FULL;    -- full-durability writes (mandatory; WAL+NORMAL can lose writes on power loss)
PRAGMA foreign_keys = ON;      -- enforce FK constraints defined in DDL

§DefaultEngine

For the common case (SQLite store, no oracle, no vector), use:

let engine = mempill_sqlite::open_default_in_memory();

Re-exports§

pub use store::SqlitePendingStore;
pub use store::SqlitePersistenceStore;

Modules§

connection
Connection lifecycle for mempill-sqlite.
migrations
Schema migration runner for mempill-sqlite.
store
SqlitePersistenceStore — impl of PersistencePort for mempill-sqlite.
txn
SqliteTxn — the concrete transaction handle wrapping a rusqlite connection.

Enums§

SqliteStoreError
Error type for all mempill-sqlite operations.

Traits§

OraclePort
The oracle port — pull-based, non-blocking.

Functions§

open_default
Open a file-backed DefaultEngine at the given path.
open_default_in_memory
Open an in-memory DefaultEngine.
open_with_oracle
Open a file-backed SQLite engine wired with a real oracle.
open_with_oracle_in_memory
Open an in-memory SQLite engine wired with a real oracle.

Type Aliases§

DefaultEngine
The default concrete engine type: SQLite persistence, no oracle, no vector.
OracleEngine
An EngineHandle backed by SQLite persistence, a caller-supplied oracle, and no vector.