Skip to main content
Version: 0.9.0

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.

DeclaredMeans
the channel's namethe key, unique by construction, and part of the address the Core binds
unitthe unit of kind interface that serves this channel — present makes it managed, absent makes it attached
transportthe projection this channel carries: local or http+ws (the projections)
clientssingle or multiple (attaching)
addressabsent means a local socket; otherwise its class, and what a routable one must carry
on_suspendwhat 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.

ManagedAttached
The declarationthe channel names a unit of kind interfacethe channel names no unit
Who starts the clientthe Core launches and supervises it, as it does any unitnobody — the Core binds the channel and waits
Typicalthe panel on the front of an instrumenta browser, a remote operator's tool, a second application
To the Core, once connectedindistinguishable — 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. A depends_on naming 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.

ClassThe listener can identify the peerWhat the caller must already haveWhat the channel must carry
localyes — the directory decides who may attempt, the kernel names the accounta place in the group, or the account that owns the treenothing further
loopbacknoan account on the hostnothing — a declared weaker configuration, reported and never refused
routablenonothing but reachabilityan 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​

ShapeIsCarried by
controla request that gets one answer — ask a unit something, tell it to do something, start a streamthe projection's request path (the operations)
livefacts that arrive unasked, many times a second — events, and a stream's datathe 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 surfaceWhere it is
enabling or disabling a plugin, granting or withdrawing a capabilitythe administrative operations
starting, stopping or restarting a unitthe same
querying or following the log storereads and the log
stopping the instancenowhere — it is declared, and whatever supervises the instance acts on it