mcl_core_sup (mcl_core v1.0.0)

View Source

Top-level supervisor for mcl-core.

Owns five workers and one nested supervisor, all shared by the hosting service: 1. mcl_core_identity — keeps the realm cert + UCAN cached 2. mcl_core_capabilities — fans capability advertisements out 3. mcl_core_guard — the inbound guard''s counters, audit ring and alert facts (mcl-om#13), up before capabilities so no inbound call can outrun its table 4. mcl_core_pubsub_sup — dynamic supervisor of this service''s macula_subscriber children (piece D) 5. mcl_core_pubsub_subscriptions — reconciles the desired subscription set against (4)'s actual running children 6. mcl_core_health — bookkeeping for /health responses

and, when health_port is configured, the Cowboy listener that actually serves GET /health on it (so Podman''s HEALTHCHECK and k8s liveness probes have something to hit).

When station seeds are configured, also the mesh pool itself (piece A, guides/mesh_native_services.md): an ordinary restart => permanent child wrapping 'macula_client:connect/2' (via mcl_core_bridge:start_mesh_pool/0, which needs this gen_server''s already-loaded keypair — hence positioned right after it). A pool crash is no longer this app''s problem to notice and react to; OTP just restarts the child, same as any other. With no seeds configured the child is omitted entirely — same health_ listener/0 pattern as the HTTP listener below — so mcl_core_identity:macula_client/0 degrades to '{error, no_client}' exactly as it did before this piece, not a harmlessly-idle pool masking "nothing configured" as "connected".

On a LAN, only the bridge node runs the pool (mcl-core#7): a member (mcl_core_bridge:role/0) has none whatever its seeds, and every LAN node runs mcl_core_bridge_sup, where members find the bridge.

Summary

Functions

Starts the /health listener on the Unix socket Path: the stale file a previous container left is removed first (a bind on an existing path fails), and the socket is made mode 0600 once it exists.

Functions

init(_)

start_health_socket(Path, Dispatch)

-spec start_health_socket(file:filename(), cowboy_router:dispatch_rules()) ->
                             {ok, pid()} | {error, term()}.

Starts the /health listener on the Unix socket Path: the stale file a previous container left is removed first (a bind on an existing path fails), and the socket is made mode 0600 once it exists.

start_link()