Skip to main content
Version: 0.6.0

The guardian and its channel

One long-lived process per account, with two duties and no others: it brings the declared instances to their desired state and keeps them there, and it makes an instance that loses its Core lose everything that belonged to it.

  • It is not a second supervisor. Restarting a unit is the Core's; the guardian's subject is the Core.
  • It belongs to the application form. The service form's one deployment is the init system's.

How it comes to be running​

Started byWhen
an init unitwhen the host comes up — one unit, which reads the records, makes autostart work
the manageron demand, where a verb needs one and nothing answers
  • Either way it is the same process reading the same records.
  • It takes a claim, $XDG_RUNTIME_DIR/yoke/guardian.lock, which the kernel releases when it dies. Two managers racing start one guardian.
  • It exits when it has nothing left to watch. An instance whose desired state is running still counts while it is failing to start; one the gate refused does not.

What it reads​

It readsFor
the instance recordswhat is declared, what each is pinned to, what should be true now
manager.confevery value: the install root, the Core binary, the engine's address and the retention ceiling, the last two handed to the Core it executes
the description, through the gatethe deployment's own figures, the restart figures among them

What it never acquires​

The guardian is kept far less likely to wedge than a Core, by rule.

It does notBecause
open an instance's storesthey are the Core's
speak an administrative surfaceits channel carries nothing about the inside of an instance
address the container engineconfinement is a control group's — except in the declared fallback
hold anything that can block on a peerthe last supervisor in the chain must be the least likely to need one

The init system watches the guardian. Where a host is not set up for that, a wedged guardian is not recovered.

Where its own account goes​

To its standard error: under an init unit, the host's journal; started by the manager, appended to $XDG_STATE_HOME/yoke/guardian.log. The file is what a person reads about a night nobody watched; the channel is how a manager learns why.

The channel​

$XDG_RUNTIME_DIR/yoke/guardian.sock, one per account, created by the guardian and reachable by that account alone. Presence is not availability: a manager connects, and starts a guardian where nothing answers.

MessageDirectionMeans
reconcile this recordmanager → guardianlook at this one again. It names a record and carries nothing else
reconcile everythingmanager → guardianthe same, over the set
report the setmanager → guardian, answeredwhat the guardian derived about each instance, and why one is not running
subscribe to changesmanager → guardian, a streamthe same, as it changes
  • The authority is in the record, never in the message. There is no start this.
  • A message that never arrives costs latency, never correctness: the guardian reconciles every record when it starts.
  • It carries nothing about the inside of an instance, and nothing reading needs: which instances exist is a directory listing, and whether one is alive is its claim.
  • A message naming a record that does not exist is refused.
  • It is not a published surface: one client, in the same account, on a local socket.

The why​

It saysWhich the filesystem cannot
refused, with the gate's findingsa refusal is not retried and leaves the desired state alone
waiting, with the attempt and the waitthe growing wait
failing repeatedlythe attempt count, and when it was last reset
stopping, or brought backan expected silence, distinct from a fault