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.
STATUS: Supported for one local BEAM node’s recovery path only. init_mnesia
and reads/writes return explicit errors, including startup, schema-mismatch,
and aborted-transaction failures; they never reset an incompatible table.
Concurrent initialization is safe: the second initializer re-checks the
existing table schema. This adapter does not provide multi-node durability,
HA, schema migration, crash-consistency testing across power loss, or a
concurrent-writer performance guarantee. See ADR 0002.
Values
pub fn adapter() -> storage.StorageAdapter
pub fn init_mnesia() -> Result(Nil, String)
pub fn persist_batch(
datoms: List(fact.Datom),
) -> Result(Nil, String)
pub fn persist_datom(datom: fact.Datom) -> Result(Nil, String)
pub fn recover_datoms() -> Result(List(fact.Datom), String)