Skip to main content
Version: 0.5.0

Arbitration

A deployment may declare that one channel prevails over others. While a channel that prevails is held, the channels it prevails over are suspended — they may not act, and keep what their grade lets them keep.

What the declaration says, and what holding means​

A rule is one relation between channels, in the arbitration block: one channel prevails over a list of others. Exclusion without a declared winner cannot be written. A channel named in any rule must confirm its subscription (attaching).

A channel holds when a client is attached to it and its picture is current.

attachedat least one client, whatever the cardinality
currentits subscription is confirming, where the channel is named in a rule
therefore not holdinga channel nobody is attached to, and a channel whose subscription has gone stale

When it is computed​

On every event that can change whether a channel holds, and never on a clock.

Trigger
a client attaches, or the last one detaches
a channel's subscription goes stale, or confirms again after being stalechannel.subscription.stale
a managed interface's process endsits connection closes with it
reclaimbelow
the channels are boundnothing holds yet, so nothing is suspended

The computation is total and stateless: it reads which channels hold and which have reclaimed, and produces the set of suspended channels.

effective_rules():
for each declared rule (prevails p, over O):
for each d in O:
if reclaimed(d) and local_socket(d) and holding(d):
yield (prevails d, over p) # a local reclaim inverts this relation
else:
yield (prevails p, over d)

suspended(x):
return any (prevails p, over o) in effective_rules()
where o == x and holding(p)

grade(x):
return on_suspend declared on x # read-only unless the declaration says dark
  • Only a change is announced: channel.suspended when a channel becomes suspended, channel.resumed when it stops being suspended, and nothing for a recomputation that changes nothing.
  • A declared cycle is not refused. Two rules in which each channel prevails over the other suspend both while both hold.

What each grade withdraws​

The grade is declared on the channel that loses, as on_suspend.

OperationActiveSuspended read-onlySuspended dark
authenticate, read, subscribe, confirm✅✅✅
what a subscription carrieseverything this channel observeseverything this channel observesonly its own channel state
query✅✅withdrawn
stream.subscribe, stream.unsubscribe, and deliveries already held✅✅withdrawn
command✅withdrawnwithdrawn
stream.start, stream.stop✅withdrawnwithdrawn
reclaim✅✅✅
  • A withdrawn operation is refused with channel.suspended, carrying the grade and the channel that prevails, so a client can display the technician has control.
  • Read-only is the default. It removes the hazard — two parties commanding one machine — and leaves the local operator able to see what is being done.

How a displaced client learns​

As an ordinary subscriber to its own channel. One event tells the channel that lost control and anything else watching; there is no directed notification. Suspension is a state of the channel, so a client that missed the event finds it in its next snapshot. The suspension carries why it happened, and a local reclaim is the same event with a different reason.

How a suspension ends​

The caseWhat ends it
the displacing client went away — the browser closed, the cable pulledits channel stops holding: a detach, or a subscription stale after 3 missed 10 s intervals
the displacing client is still there and has forgottena reclaim from a local channel, below

A local channel may always reclaim control​

A channel bound as a local socket can take control back from whatever displaced it, by a deliberate act, at any time. It resumes, the channel that displaced it is suspended in its own declared grade, and the exchange is announced like every other arbitration event.

Property
deliberate, never automaticit is the reclaim operation. Attaching does not reclaim, and neither does touching a screen
it cannot be declared awayno field expresses it and none suppresses it
locality is measured, not claimedit belongs to channels the Core bound as local sockets. A channel on the loopback address does not qualify
  • A reclaim holds while the reclaiming channel holds, and is cleared when it detaches or goes stale; the declared rules then apply unchanged.
  • A reclaim on a channel nothing had suspended succeeds and changes nothing, and the answer says so.
  • reclaim on a channel not bound as a local socket is refused with channel.not_local.

What arbitration is not​

  • Precedence is not privilege. A channel that prevails obtains access first, and never operations the others lack.
  • Arbitration is not authorisation. A suspended interface may not act now; what any interface may do at all is bounded by what an operator granted the unit's plugin (the operations).
  • Reclaiming widens nothing. A channel that could not command before a reclaim cannot after it.