Amarula.Storage.File (amarula v0.2.2)

View Source

Filesystem Amarula.Storage adapter — the default plugin.

Isolates each connection by its profile in a subfolder under a configured root:

<root>/<profile>/<prefix><base64url(key)>.term

where <prefix> is fixed per namespace (creds/session-/sender-key-/ lidmap-/devices-). Values are :erlang.term_to_binary/1 — lossless for Elixir terms (the creds/record maps hold atom keys and raw binaries), so the file is Elixir-specific, not interchangeable with Baileys' JSON state.

Writes are atomic (temp file + rename) so a crash mid-write can't corrupt state. A genuinely corrupt or unreadable entry is logged and treated as a miss, matching the prior stores' fail-soft behaviour — but a valid, self-written term is always recovered, even when it carries atoms not yet loaded on a cold BEAM (see decode/2).

Options

  • :root — the base directory holding one subfolder per connection profile (required).