Amarula.Storage.DETS (amarula v0.1.0)

View Source

DETS Amarula.Storage adapter for durable account state — a peer to Amarula.Storage.File.

One DETS table per connection profile (<root>/<profile>/storage.dets), holding every entry keyed by {namespace, key}. Select it per connection:

Amarula.new(%{profile: :primary, storage: {Amarula.Storage.DETS, root: "./data"}})
|> Amarula.connect()

or as the default for all connections:

config :amarula, default_storage_adapter: Amarula.Storage.DETS

Trade-offs vs. File

File writes one term file per entry; DETS keeps a single on-disk table per profile — fewer files, O(1) keyed access, but a table lifecycle. The table is opened lazily on first use (per {root, profile}) and left open for the VM's lifetime; DETS auto-repairs an uncleanly-closed table on reopen and serialises concurrent ops. A corrupt/unreadable lookup is treated as a miss, matching File's fail-soft behaviour.

Options

  • :root — base directory holding one .dets file per profile (required).