hecate_om (hecate_om v0.14.2)
View SourcePublic facade for hecate-om.
Services typically only need a handful of these:
hecate_om:boot(MyServiceMod) %% one-call lifecycle wiring hecate_om:advertise_capabilities() %% (re-)publish my caps hecate_om:health() %% snapshot for /health hecate_om:service_cert() %% load my service-principal cert hecate_om:macula_client() %% returns the SDK client handle
Summary
Functions
(Re-)publish this service's capabilities onto the mesh. Typically called once at boot; call again when the capability set changes.
Wire a service module into hecate_om and start it.
Call a capability by name over the direct-dial data path: resolve a provider from the DHT, dial its serving station directly, and issue the CALL there (failing over to the next provider on error). The CALL uses CapName as the procedure, realm-scoped.
Snapshot of this service's health. Used by /health handler.
This service's stable signing keypair, or {error, no_keypair} when running on an ephemeral identity. Needed by every direct-dial PROVIDER desk (macula_response:advertise_direct/6,7, macula_streamer:advertise_direct/6,7, ...), which sign their own DHT advertisement record with it.
The {Pool, Realm} pair every PubSub/RPC-consumer/Content call needs together. Replaces the hand-rolled case {macula_client(), realm()} of {{ok,P},{ok,R}} -> ... pairing four independent hecate-services repos each wrote for themselves (hecate_mesh.erl, tom_ocean_mesh.erl, tom_wire_macula.erl, tom_crier.erl) because hecate_om gave them nothing to build on. Degrades to {error, mesh_unavailable} rather than crashing when either half is missing (mesh unreachable, or no client attached yet).
This service's realm tag (32-byte binary). Previously reachable only by calling hecate_om_identity:realm/0 directly, past the public facade -- every service wanting to publish/subscribe/advertise on the mesh needs this alongside macula_client/0, so it belongs here.
Functions
-spec advertise_capabilities() -> ok.
(Re-)publish this service's capabilities onto the mesh. Typically called once at boot; call again when the capability set changes.
Wire a service module into hecate_om and start it.
Typical call from the hosting service's _app:start/2:
start(_, _) -> hecate_om:boot(my_service).
Call a capability by name over the direct-dial data path: resolve a provider from the DHT, dial its serving station directly, and issue the CALL there (failing over to the next provider on error). The CALL uses CapName as the procedure, realm-scoped.
-spec health() -> hecate_om_service:health().
Snapshot of this service's health. Used by /health handler.
-spec keypair() -> {ok, macula_identity:key_pair()} | {error, term()}.
This service's stable signing keypair, or {error, no_keypair} when running on an ephemeral identity. Needed by every direct-dial PROVIDER desk (macula_response:advertise_direct/6,7, macula_streamer:advertise_direct/6,7, ...), which sign their own DHT advertisement record with it.
The {Pool, Realm} pair every PubSub/RPC-consumer/Content call needs together. Replaces the hand-rolled case {macula_client(), realm()} of {{ok,P},{ok,R}} -> ... pairing four independent hecate-services repos each wrote for themselves (hecate_mesh.erl, tom_ocean_mesh.erl, tom_wire_macula.erl, tom_crier.erl) because hecate_om gave them nothing to build on. Degrades to {error, mesh_unavailable} rather than crashing when either half is missing (mesh unreachable, or no client attached yet).
This service's realm tag (32-byte binary). Previously reachable only by calling hecate_om_identity:realm/0 directly, past the public facade -- every service wanting to publish/subscribe/advertise on the mesh needs this alongside macula_client/0, so it belongs here.
-spec service_module() -> module() | undefined.