hecate_om_read_model (hecate_om v0.16.0)

View Source

Canonical barrel_docdb read-model wiring for hecate-services.

Encapsulates "open (or create) a database at data_dir/read_model_id". Services don't call this module directly — hecate_om:boot/1 dispatches here when the service module exports the optional read_model_id/0 + data_dir/0 callbacks from hecate_om_service.

After boot, a service (its PRJ code, typically) reads/writes the read model with barrel_docdb directly, using the same read_model_id/0 binary as the database name — barrel_docdb accepts the name or the pid interchangeably everywhere, so there is no separate handle to thread through. This mirrors hecate_om_store, which likewise hands nothing back: the service already knows its own store_id/read_model_id.

Summary

Functions

Idempotent. Opens (creating on first boot) a barrel_docdb database named DbName at <DataDir>/<DbName>/.

Functions

ensure(DbName, DataDir)

-spec ensure(binary(), file:filename_all()) -> ok | {error, term()}.

Idempotent. Opens (creating on first boot) a barrel_docdb database named DbName at <DataDir>/<DbName>/.