Skip to main content
Version: 0.17.0

A need's channel

For each need of class unit, the Core binds a channel for the Plugin unit that declared it: a local socket on which that unit is the one client of the unit its need is bound to. It speaks the interface contract, the same one every other channel speaks, so the using unit needs no library but its family's interface library, and the unit used answers it as it answers any client.

What it is​

PropertyValue
contractthe interface contract, the typed local projection
pathneeds/<unit>/<need>.sock, under the instance's runtime directory
mode0600, the directory needs/<unit>/ 0700, both the account running the Core's
bound bythe Core, when the using unit is launched and before the process starts
removedwhen that incarnation ends, by every route an incarnation ends on
clientsone: the using unit. A second attachment is refused channel.in_use
controlalways held by its one client: nothing prevails over it and it never yields
declared in a descriptionnever: the composing document binds the need to a unit, and the channel follows

${bind.<need>} resolves to the path. For a containerised unit the socket is mounted at the same absolute path on both sides, as the Core's own socket is. The using unit learns the path and nothing else: not the name of the unit behind it, which it reads from the channel's opening.

One channel per need, per incarnation. A unit with two unit needs has two channels; four copies of one Plugin have four channels for one need, each under its own unit's directory.

What it sees, and what it may address​

Its subjects are the unit bound and nothing else. The opening, a read and a subscribe hold that one unit and the channel itself; every other unit, the instance and the other channels are subject.unknown.

OperationOn a need's channel
read, subscribe, confirmover the bound unit's subjects
querya type listed in the need's questions in the using Plugin's Manifest, and granted
stream.start, stream.stop, stream.subscribe, stream.unsubscribea stream listed in the need's streams, and granted
commandrefused, use.command: a unit never instructs another
authenticate, reclaimrefused operation.unknown: a local socket needs no credential, and a channel nothing prevails over has nothing to reclaim

Three checks are made, in this order, after those every channel makes (the operations):

CheckedRefusal
the subject is the bound unitsubject.unknown
the operation is not command, and the object is listed in the need's usesuse.command, use.undeclared
the object is declared by the bound unit, and the use is granted to the using Pluginscope.undeclared, scope.withheld

A use refused at the last two is reported with the event unit.use.refused on the using unit, carrying the need, the object and the code.

A question asked on it​

A question on a need's channel may name a cause: the identifier of a question the using unit was delivered and has not answered yet.

causechaindeadline
absenta new onenow + 30 s
names an outstanding question of this unitthat question'sthat question's deadline − 500 ms
names anything elserefused, use.cause.unknown—
leaves less than 100 msrefused, deadline.exhausted, the bound unit never asked—

The Core waits for the answer until the deadline, and answers the asker unit.unanswered past it, as for any question. A question from a declared channel never carries a cause: only a unit answers a question, so only a unit's question can have been caused by one. Each question with a cause is reported with the event unit.question.chained on the unit asked, carrying the chain, the asker and the type — never the payload, never the answer.

A chain may be as long as the application makes it; the gate refuses an application whose uses close a cycle, at any length.

A stream it holds​

A stream is held while a need's channel has a delivery of it open: started by that channel or found flowing, and subscribed by it.

A stop arriving fromWhile the stream is held
a declared channelrefused, stream.held, the detail naming the holding unit
the holding need's channel itselfstops it, unless another need's channel also holds it, which refuses stream.held
the administrative surfacestops it, and every delivery is told unit.stream.stopped with the reason operator

A stream started by a need's channel and no longer held by any keeps flowing, as a stream started by a client that detached does: holding prevents a stop and starts nothing.

When the unit bound restarts​

The using unit's delivery ends and nothing else does. Its channel stays bound, its outstanding questions and open deliveries end with unit.no_session, and the using unit is not restarted. Its library attaches again and resubscribes, as any interface client returns; a stream it held is started again where the new incarnation is not already emitting it.

What is kept​

KeptNever kept
unit.use.refused: the need, the object, the codea question's payload, an answer, a frame
unit.question.chained: the chain, the asker, the typewhat a token or a reading held
channel.attached and its ending, as for any channel

An answer and a frame are delivered and written nowhere — not in the log store, not in an event, not in the Core's captured output.