aarondb/storage/mnesia
storage/mnesia — recovery-oriented Mnesia StorageAdapter
Thin Gleam wrapper over the aarondb_mnesia_ffi Erlang FFI: creates a
disc-copy datoms schema and persists/recovers datoms transactionally.
Initialization never rewrites an existing incompatible schema: it reports a
descriptive Error and leaves persisted data untouched. Back up and
migrate explicitly—or intentionally reset the table—before retrying.
Coverage: the round-trip (persist → restart → recover) is exercised by
recovery_durability_test in test/aarondb/history_test.gleam.
STATUS: This adapter is supported for the existing local recovery path. It is not a production multi-node persistence/HA contract: schema lifecycle, concurrent failure behavior, node failure recovery, and multi-node validation remain deliberately unproven. See ADR 0002.
Values
pub fn adapter() -> storage.StorageAdapter
pub fn init_mnesia() -> Result(Nil, String)
pub fn persist_batch(datoms: List(fact.Datom)) -> Nil
pub fn persist_datom(datom: fact.Datom) -> Nil
pub fn recover_datoms() -> Result(List(fact.Datom), String)