Tracks known chats using ETS (fast reads) backed by DETS (persistence).
Automatically subscribes to PubSub and records chats from incoming updates. Survives restarts via DETS.
Data at rest
Tracked chats are personal data (names, usernames) persisted unencrypted
in the DETS file. On init the registry locks its directory to 0700 before
creating the file — closing the brief world-readable window :dets.open_file
would otherwise leave on the freshly created file — and then restricts the file
itself to 0600 (best effort — skipped with a warning on filesystems without
POSIX modes). Operators are responsible for:
- storing
:dets_pathin a private, app-owned subdirectory — not the shared defaultpriv/. Because the registry locks the containing directory to0700, pointing it at barepriv/over-broadly restricts every otherpriv/asset; give it a dedicated dir (e.g.priv/hotline/chats.detsor an external data dir), which also keeps chat PII out of anything published in a release or Hex package, and - applying disk-level encryption if the data warrants it.
Usage
Add to your supervision tree (after PubSub):
{Hotline.ChatRegistry, dets_path: "priv/chats.dets"}Then query:
Hotline.ChatRegistry.list()
Hotline.ChatRegistry.get(7644580464)
Hotline.ChatRegistry.count()
Summary
Functions
Returns a specification to start this module under a supervisor.
Count known chats.
Get a chat by ID.
List all known chats.
Manually track a chat.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Count known chats.
Get a chat by ID.
List all known chats.
Manually track a chat.