Expand description
The one request contract, independent of transport.
A request is a method id, a Caller, JSON params, and a JSON result or a
ServiceError. The local transport (framed JSON lines over a
current-user-only socket or pipe) is an adapter onto it; a later transport maps onto the same
types. This module holds no I/O.
Callersays who is asking: a local app (OS-verified peer) or a device (id and scopes).MethodTableis the single source of method policy (MethodPolicy); the localAllowlistis derived from it (MethodTable::allowlist) andMethodTable::authorizeanswers for any caller.Handler,CallContextandEmitare the serving side.status_for_codemaps an error code to an HTTP-style status for transports that need one.
Structs§
- Call
Context - What a handler knows about the request it is serving.
- Method
Policy - Policy for one method id: which local apps may call it and which scopes a device needs.
- Method
Table - Every method of a service with its policy: the one source the local allowlist and a remote
route table are both derived from.
pingis never listed and always allowed.
Enums§
- Caller
- Who is making a request.
- Table
Error - Why a method id or its policy was refused at table construction.
- Transport
- Which transports a method is reachable on.
Constants§
- ROLE_
SCOPE_ PREFIX - A scope that names a role instead of a capability:
role:<name>, for examplerole:operator.
Traits§
Functions§
- role_of
- The one role among
scopes:Someonly when exactly one scope is a role scope with a non-empty name. Two roles, or none, giveNone, so an ambiguous device never gets a role by the luck of an iteration order. - role_
scope - The scope that grants
role. - status_
for_ code - Status for a code;
Nonewhen the table does not know it. - status_
for_ error - Status for an error: the table, else 503 when retryable, else 500.
- validate_
method_ id - A method id must be a plain name: non-empty, no glob characters, whitespace, control
characters,
/,%or#.