Channels
The interface surface is the contract an application is used through: a panel on an instrument, a browser, a remote operator's tool, a second application. A deployment declares the interfaces it presents, and the Core opens one channel per declaration and serves them all at once.
One contract, one channel per declaration
A channel is declared in the channels block of the deployment's description.
| Declared | Means |
|---|---|
| the channel's name | the key, unique by construction, and part of the address the Core binds |
unit | the unit of kind interface that serves this channel — present makes it managed, absent makes it attached |
transport | the projection this channel carries: local or http+ws (the projections) |
clients | single or multiple (attaching) |
address | absent means a local socket; otherwise its class, and what a routable one must carry |
on_suspend | what this channel keeps while suspended: read-only, the default, or dark (arbitration) |
A deployment with a panel the Core launches, and a browser channel on loopback that the panel prevails over:
units:
acquire:
kind: plugin
plugin: com.example.acquire
panel:
kind: interface
exec: /usr/libexec/example/panel
channels:
front: { unit: panel, transport: local, clients: single }
remote: { transport: http+ws, clients: multiple,
address: { class: loopback, port: 8080 }, on_suspend: read-only }
arbitration:
- prevails: front
over: [ remote ]
front is managed — the Core launches panel, which connects to it — and bound as a local socket.
remote is attached: the Core binds it on 127.0.0.1:8080 and waits for a client. A rule names one
channel that prevails and the list it prevails over.
- No channel is privileged over another. A deployment may declare precedence between channels, which is arbitration: a channel that prevails obtains access first, and never obtains operations the others lack.
- Every channel is bound before any unit is launched, and a channel that cannot be bound stops the instance from starting. A channel missing would change which channel prevails.
- A channel bound as a local socket is at
<instance root>/interfaces/<channel>.sock. A channel bound on an address is not in the instance's tree at all.
Managed and attached
The only difference is who starts the client's process.
| Managed | Attached | |
|---|---|---|
| The declaration | the channel names a unit of kind interface | the channel names no unit |
| Who starts the client | the Core launches and supervises it, as it does any unit | nobody — the Core binds the channel and waits |
| Typical | the panel on the front of an instrument | a browser, a remote operator's tool, a second application |
| To the Core, once connected | indistinguishable — the same channel, contract, admission and authority |
- A managed interface connects to a channel and never serves one, so it has no socket of its own.
- A managed interface may run in a container, and binds no port when it does: the channel is the Core's.
- Nothing may depend on a unit of kind
interface. Adepends_onnaming one is refused when the description is checked.
Where a channel is bound
The address is a second axis beside the projection, and it decides how much protection the channel has before a byte is parsed.
| Class | The listener can identify the peer | What the caller must already have | What the channel must carry |
|---|---|---|---|
| local | yes — the directory decides who may attempt, the kernel names the account | a place in the group, or the account that owns the tree | nothing further |
| loopback | no | an account on the host | nothing — a declared weaker configuration, reported and never refused |
| routable | no | nothing but reachability | an authenticated and encrypted transport and a credential establishing the caller, or it may not be declared |
The class is computed when the description is checked, before anything runs, so a routable channel declared without what it must carry is refused with everything else. The class also decides which channel may reclaim control, and whether the caller must be established before anything else.
The two traffic shapes
| Shape | Is | Carried by |
|---|---|---|
| control | a request that gets one answer — ask a unit something, tell it to do something, start a stream | the projection's request path (the operations) |
| live | facts that arrive unasked, many times a second — events, and a stream's data | the projection's push path (what a channel sees, streams to clients) |
- An interface never has to poll. A channel carries the same subscription contract the administrative surface does, on the same terms.
- A stream's data has a path of its own in every projection, and is never multiplexed onto the control path.
What the surface is not
The surface is the contract, and any client in any language obeys the same one. Nothing in it exists for the sake of one client, and the Core serves the contract and never a client's assets: what a browser loads before it speaks the contract is served by whatever fronts the channel.
The surface is not administrative, and an interface being managed by the Core grants it no administrative reach.
| Not on this surface | Where it is |
|---|---|
| enabling or disabling a plugin, granting or withdrawing a capability | the administrative operations |
| starting, stopping or restarting a unit | the same |
| querying or following the log store | reads and the log |
| stopping the instance | nowhere — it is declared, and whatever supervises the instance acts on it |