Skip to main content
Version: 0.15.0

The architecture

A running Yoke application is an instance: one Core process and the units it launches, on one host. The Core sits in the middle of everything. Every unit talks to it and to nothing else, and every interface and every administrative tool reaches the units through it. The Core supervises, routes and keeps records, and it never reads what your units say to each other or to a screen.

This page builds the picture in four steps: the programs Yoke ships, what runs inside an instance, the three contracts around the Core, and three paths through it.

The programs​

Yoke ships five programs, and a family of libraries for the ones you write.

ProgramWhat it isWhere it runs
yoke-corethe Core: one per instance. Launches and supervises the units, admits them, routes their traffic, binds the channels, and keeps the instance's two storesthe host
yokethe manager, the one command a person types. Installs applications, creates and starts instances, and checks that an application's parts fit each other and fit the host before anything starts. Its other half is an ordinary client of a running instance: yoke unit ask, yoke log followthe host
yoke-guardianthe guardian: one per account, self-contained form only. Keeps each declared instance in the state its record asks for, and makes sure that an instance whose Core dies loses every process in itthe host
yoke-authasks the host's own authentication service whether a person may sign in, for a channel that requires it, so that the host's authentication modules never run inside the Corethe host
yoke-composethe composer: writes and checks an application's description, and builds its packagethe workstation only, never the device

The libraries come in five families: Go, Rust, Python, C and C++. A family holds one library per contract: one to write a Plugin, one to write an interface, and, in Go, one to write administrative tooling. Each library is held to one conformance suite, so what one family can do the others can too (what each family offers).

Yoke builds no container images and no init system. It uses the host's init system to start the system-installed form and to keep the guardian running. A container engine is needed only for the units that ask to run in a container (containerised units).

Inside an instance​

A unit is one thing the instance runs. There are three kinds, and they are kinds of one thing:

  • a Plugin unit is a long-running program holding a Session with the Core. It answers questions, accepts commands, reports occurrences and publishes streams. This is the ordinary case;
  • a unit that runs to completion starts, does one job, and exits. Its exit status is its result, and the units that depend on it wait for it. It prepares a store or migrates data before the rest start;
  • a managed interface is an interface the Core launches and supervises because the application declares it. The panel on a device's own screen is the typical one.

Any of the three may run in a container instead of on the host. What changes is how it is started and isolated, never what it is.

One program may run as several units. A Plugin that drives a camera, on a machine with three cameras, runs as three units with three names, camera-1 to camera-3. Who the program is, its plugin identity such as com.example.camera, is what an operator authorises, once for every copy. Each copy is a unit, which is what is launched, addressed, restarted and logged.

The Core keeps two stores, each a local file with one writer:

  • the Registry records what an operator decided: which plugins are known, which are enabled, what each is granted, and who decided it and when;
  • the log store keeps every unit's output, and the lasting record of what happened to each unit.

What is happening now is not stored anywhere. Whether a unit is running, how often it has restarted, and which streams flow are worked out by the Core at the moment you ask. A stored "current state" would be a claim about now written at some earlier moment, and it would be stale exactly when you need it.

The three contracts​

Everything that crosses the Core's boundary crosses one of three published contracts, which the documentation calls surfaces. The Core binds each one itself: the plugin and administrative surfaces as local sockets inside the instance's own directory, and each interface channel at the address the application declares for it. Each surface has its own section in the reference.

SurfaceWho speaks itWhat it carries
the plugin surfaceevery Plugin unitadmission, then one Session: the questions, commands, occurrences and streams the unit declared
the interface surfacepanels, browsers, remote tools: the interfaces an application is used throughreading what the deployment is doing, following its changes, commanding and asking units, starting and receiving streams
the administrative surfaceyoke, scripts, a person at a shelladministering the instance from the inside: grants, enablement, starting and stopping units, the log

The interface surface is plural: an application declares its channels. Each channel is one way in, with its own address. It may be a local socket for a panel on the same host, a loopback port for a browser on the device, or a routable port behind TLS for a technician on the network. The contract on every channel is the same. What differs is the projection it is carried in: local for a program that can open a socket, http+ws for a browser, which can speak nothing else. A channel may require a person to sign in, and an application may declare that one channel prevails over another, which is called arbitration.

The traffic is separated by its shape. Commands and questions travel as a request and its answer. Live data travels as a stream, on a transport of its own that the Core creates for it, so that a fast stream never queues behind a command. A unit never talks to another unit, or to an interface, directly. Everything passes through the Core, and the Core carries what passes without decoding it: to the Core, your payloads are bytes.

Three paths through an instance​

A question, from a panel to a unit and back​

The panel names a unit, not a process or an address, and the Core finds the unit's Session. The check before the question is forwarded uses what the operator granted, not what the unit declared. The payload is passed through as the unit wrote it, and only the panel and the unit agree on its meaning.

A stream, from a unit to a browser​

A unit does not start a stream by itself. A stream flows because an interface asked for it:

  1. The interface asks the Core to start station.spectra on acquire.
  2. The Core creates the transport and activates the stream on the unit's Session.
  3. The unit writes frames until it is told to stop.
  4. Each interface that subscribes is told where its frames will arrive:
    • a socket of its own, for a program on the host;
    • frames on its own connection, for a client reaching the channel through a port;
    • a WebSocket, for a browser.

The stream flows until an interface or an administrative caller stops it, or until the unit's Session ends, which takes every stream of the unit with it. An interface that stops reading gives up only its own delivery, and the others keep receiving (streams to clients).

A start, from nothing to a running unit​

Nothing starts until the description has been checked against the host: the right programs at the right digests, the devices that are needed present, nothing contradicting anything else. Every failure is reported at once, not the first one only. In the self-contained form the guardian runs this check on every start. In the system-installed form the init system runs the manager, which runs the check and then the Core (an application as a service).

A unit is admitted, not merely launched. The Core hands each process a one-time token. Admission checks four things:

  • that the token is genuine;
  • that the program describes itself as its Manifest does;
  • that it is a plugin the operator has enabled;
  • what the operator has granted it.

A unit that declares more than it was granted is admitted with less: a declaration grants nothing (admission). A unit that falls is restarted according to its policy, and each life of its process is a new incarnation, numbered and kept in the log.

Where to go next​