An Ecto 3 adapter for Mnesia, the distributed, transactional database that ships with the BEAM.
Memory, recollected.
Unlike an ETS-backed adapter, Mnesia gives us real ACID transactions and
optional disk persistence (disc_copies) for free — they map almost directly
onto Ecto's Ecto.Adapter.Transaction and Ecto.Adapter.Storage behaviours.
Query translation reuses Erlang match specifications, which Mnesia and ETS
share verbatim.
Example
defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app, adapter: Ecto.Adapters.Recall
endConfiguration
:storage—:ram_copies(default),:disc_copies, or:disc_only_copies. Controls where auto-created tables live.:type—:ordered_set(default) or:set.:ordered_setkeeps records in primary-key order, so reads come back sorted; falls back to:setfor:disc_only_copies(which Mnesia doesn't allow with:ordered_set). A generatedRecall.Schemacan override it per table.:nodes— list of nodes that hold copies (defaults to[node()]).:dir— the Mnesia data directory (only relevant for disc storage).