mcl_core_claim (mcl_core v1.0.0)
View SourceBoot-time provider-authorization claim.
Once the mesh pool is connected, this worker asks the realm — over the mesh, by this service's own wire-authenticated identity — for the D25 delegation its org-namespaced procedures need: io.macula/_realm/_realm/identity/request_provider_authorization_v1.
The realm verifies the caller (the connection proves it), checks membership + org binding, and either issues immediately or records the request as a pending row for its operator. An issued claim ends this worker's retries. A pending one is asked again every RETRY_MS: the realm answers a repeat with not_admitted while the row is pending and issues at once after an operator admits the node, so the state /health shows moves to issued within a minute of the admission (mcl-om#12). The advertise path (mcl_core_capabilities, through macula:provider_authorization/3) resolves the delegation independently once it exists.
No credentials travel: there is nothing to configure here beyond the informational labels the realm's operator sees on the pending row, service_name and box (see labels/0).
THE CLAIM'S STATE IS LOUD. Each change (not delivered, pending, issued) is one log line naming the realm and the org, and /health carries it under claim (status/0). A pending claim is an operator's to admit; it must be visible without reading debug logs.
AN ISSUED CLAIM IS ASKED AGAIN WHEN ITS CHAIN GOES MISSING (mcl-om#25). The realm tombstones a delegation the moment it lapses (an ended membership, an admin's withdraw or revoke), and the org directory with the org's last provider. mcl_core_capabilities reports a chain the DHT no longer holds through chain_missing/0; while the claim stands issued it is sent again, at most once per RETRY_MS. A live member is re-issued at once (macula-realm#81) and the service comes back without a restart; an ended one answers not_admitted and the claim shows pending.
ON A LAN, ONLY THE BRIDGE CLAIMS, AND ONLY FOR EXPORTED ORGS (mcl-core#7, design §3). A member (mcl_core_bridge:role/0) never starts this worker. The bridge starts with no org: the advertise run adds each org it advertises an exported capability for (add_org/1), so an org that exports nothing is never claimed, and an org exported from another node of the cluster is.
See PLAN_PROVIDER_AUTHORIZATION_FLOW.md §3.2 (macula-realm). -------------------------------------------------------------------
Summary
Functions
Claim for Org too, unless this node claims for it already: a boot adds the org of each service it hosts. Never blocks the caller; a no-op while the worker does not run (no seeds).
The log line a change of state deserves, or none when the state has not changed kind (a claim that cannot be delivered for an hour is one warning, not sixty lines). Names the realm and the org.
Whether a claim in this state is asked again after RETRY_MS: one not delivered, and one pending (an operator may admit the node at any time); never one issued.
The chain this service's claim produced is no longer in the DHT (procedure_delegation or org_directory not found). Never blocks the caller; a no-op while the worker does not run (no seeds) or the claim is not issued.
As chain_missing/0, for the claim of Org.
Whether an issued claim whose chain went missing is sent again at Now: only an issued one (any other state is retried already), and not within RETRY_MS of the last time.
The realm's reply, classified. The refusal of a not yet admitted node is the realm filing the claim as pending. Under macula 13 it arrives as a bare {error, <<"not_admitted">>}; before, as a call_error carrying the same text under whatever code the responder used (measured live as both handler_error and unknown_error). mcl_core 0.33.1 knew only the second shape, so on macula 13 a pending claim was taken for "not delivered" and re-sent every minute, silently.
The labels a claim carries, so the realm's operator can tell what is asking and where it runs. Each is mcl_core's app env if set, else an OS variable the deploy sets (MCL_SERVICE_NAME, MCL_BOX); service_name then falls back to the service's own name from info/0, box to empty. Only the app env existed before, which two services set and the template did not, so most claims arrived unlabelled.
The labels of the hosted service ServiceMod: its own name is the fallback of service_name (mcl-om#8).
The boot claim's state for /health: unsent (the pool or realm is not ready), not_delivered, pending (an operator must admit the node) or issued; no_mesh when the service runs without seeds, so there is no claim to make.
Types
-type claim() :: unsent | pending | issued | {not_delivered, term()}.
Functions
-spec add_org(binary()) -> ok.
Claim for Org too, unless this node claims for it already: a boot adds the org of each service it hosts. Never blocks the caller; a no-op while the worker does not run (no seeds).
The log line a change of state deserves, or none when the state has not changed kind (a claim that cannot be delivered for an hour is one warning, not sixty lines). Names the realm and the org.
Whether a claim in this state is asked again after RETRY_MS: one not delivered, and one pending (an operator may admit the node at any time); never one issued.
-spec chain_missing() -> ok.
The chain this service's claim produced is no longer in the DHT (procedure_delegation or org_directory not found). Never blocks the caller; a no-op while the worker does not run (no seeds) or the claim is not issued.
-spec chain_missing(binary()) -> ok.
As chain_missing/0, for the claim of Org.
Whether an issued claim whose chain went missing is sent again at Now: only an issued one (any other state is retried already), and not within RETRY_MS of the last time.
The realm's reply, classified. The refusal of a not yet admitted node is the realm filing the claim as pending. Under macula 13 it arrives as a bare {error, <<"not_admitted">>}; before, as a call_error carrying the same text under whatever code the responder used (measured live as both handler_error and unknown_error). mcl_core 0.33.1 knew only the second shape, so on macula 13 a pending claim was taken for "not delivered" and re-sent every minute, silently.
The labels a claim carries, so the realm's operator can tell what is asking and where it runs. Each is mcl_core's app env if set, else an OS variable the deploy sets (MCL_SERVICE_NAME, MCL_BOX); service_name then falls back to the service's own name from info/0, box to empty. Only the app env existed before, which two services set and the template did not, so most claims arrived unlabelled.
The labels of the hosted service ServiceMod: its own name is the fallback of service_name (mcl-om#8).
-spec status() -> map().
The boot claim's state for /health: unsent (the pool or realm is not ready), not_delivered, pending (an operator must admit the node) or issued; no_mesh when the service runs without seeds, so there is no claim to make.