mcl_core_lan_hosts (mcl_core v1.0.0)

View Source

The processes that serve hosted services on the LAN: one mcl_core_lan_capability per served capability and one mcl_core_lan_subscriber per subscription, each under the hosted service's key, so a second boot of a service replaces its own and no other service's.

WHAT IS HOSTED IS KEPT OUTSIDE THIS SUPERVISOR. Each host/3 and subscribe/2 records its child specs in a persistent_term once they have all started, and init/1 starts every recorded spec. A set that does not start is taken down again and not recorded, so a restart never retries what a boot was refused. When this supervisor restarts -- after the pg scope it joins groups in restarts, say -- every capability and subscription comes back, without the services booting again (macula-services/mcl-core#3 r1). forget/0 clears the record when mcl_core itself starts afresh.

Summary

Functions

Forget every recorded spec: a fresh mcl_core hosts nothing until its services boot.

Serve Caps under Org for Key, instead of what Key served.

Run Subs for Key, instead of Key's earlier ones. transient: a subscriber that stops normally stays stopped, as on the mesh.

Functions

forget()

-spec forget() -> ok.

Forget every recorded spec: a fresh mcl_core hosts nothing until its services boot.

host(Key, Org, Caps)

-spec host(term(), binary(), [mcl_core_service:capability()]) -> ok | {error, term()}.

Serve Caps under Org for Key, instead of what Key served.

init(_)

start_link()

subscribe(Key, Subs)

-spec subscribe(term(), [mcl_core_service:subscription()]) -> ok | {error, term()}.

Run Subs for Key, instead of Key's earlier ones. transient: a subscriber that stops normally stays stopped, as on the mesh.