View Source ProcessHub.Service.Storage.Dets (ProcessHub v0.6.0)

DETS-backed registry storage. Selected via registry_backend: {:dets, opts} on ProcessHub.t().

Durability

Every successful mutation (insert/3, insert/4, remove/2, clear_all/1) calls :dets.sync/1 before returning, so any operation observed as :ok by the caller is durable on disk.

File location

By default the file is stored at priv/process_hub/<hub_id>/registry.dets resolved against the application's priv directory. Override with the :path option:

registry_backend: {:dets, path: "/var/lib/myapp/hub.dets"}

The parent directory is created if it does not exist.

Recovery on corruption

On open the file is passed repair: true. If :dets.open_file/2 still returns {:error, _}, the corrupt file is rotated to <path>.corrupt-<system_monotonic>, telemetry [:process_hub, :registry, :backend_corrupt] is emitted, and a fresh empty file is opened at the original path.

TTL

DETS has no native TTL. Entries inserted with :ttl are stored as {key, value, expire_ms} (matching the ETS layout). Reads filter expired entries on the way out. A periodic sweeper is out of scope — expired entries accumulate until manually swept.