Writing a description
Every field of a description can be written by a verb, and taken away by one, so that a project is
never half tool-made and half typed by hand. A field has a verb of its own where the act deserves one,
and set otherwise.
yoke-compose add unit <name> --kind K [--exec P | --image R | --plugin ID] [--arg A]... [--depends-on U]...
yoke-compose add channel <name> --transport T --clients C [--unit U] [--class C [--host H] [--port N]] [--on-suspend G]
yoke-compose add parameter <group>.<name> --type T [--range R] [--pattern P] [--values A,B] [--required] [--default V] [--label L]
yoke-compose set <path> <value>
yoke-compose remove <path>
yoke-compose arbitrate <channel> over <channel>...
| Verb | Writes |
|---|---|
add unit | a unit: its kind, its program, image or Plugin, its arguments in order, its dependencies; for a program under components/, its digest beside it |
add channel | a channel: its transport, its cardinality, the unit serving it, its address |
add parameter | a parameter in a group: its type, its domain, whether it is required, its default, its label |
set | any other field, of either document |
remove | takes a unit, a channel, a parameter or any field away, addressed by the same path |
arbitrate | one precedence relation: the first channel prevails over the others |
set takes a field by the path a finding carries — units.acquire.policy.startup_window,
parameters.second.line.default — so what a report names is what a verb takes. Its value is read as YAML:
true, 5s, [a, b] and { entries: 500 } are a boolean, a duration, a list and a mapping.
What a verb refuses
A verb never accepts what the gate refuses. After writing, the composer runs the gate over the result; where the gate refuses anything at or beneath the path written, nothing is kept, and the document is byte for byte what it was. What the gate finds elsewhere is the rest of the project's business — a project is written one field at a time, and its first unit is added to a descriptor that declares none.
Taking something away
remove is set's inverse, and is held to the same rule. It takes away the node at the path and
everything beneath it, and keeps the result only where the gate refuses nothing it did not already
refuse.
| Removing | Is |
|---|---|
| a unit another depends on, a parameter a reference resolves to, a field the model requires | refused with the gate's own finding; the project is left unchanged |
| a path that names nothing | refused as one |
| the last of a unit and a channel a parameter group is named after | done, and the group goes with it, in the same change and judged with it |
| a unit placed from a block | done, and its line goes from blocks.yaml |
| a unit or a field a waiver was written at | done; the waiver stays in advisories.yaml, where waivers marks it stale |
- Nothing else is taken along. A channel serving a unit is removed before the unit.
- No file beside the descriptor is deleted — a component or a Manifest put in the project is the author's to remove.
The descriptor, or a composition document
By default a verb writes the descriptor of the project in --dir. With --file, it writes the
composition document that path names, checked against the Manifests --manifests names: the same verbs,
the same paths, the same refusals.
A project, start to finish
yoke-compose init com.yoke.station --version 1.0.0
yoke-compose add parameter probe.greeting --type string --default hello --label "What the probe writes"
yoke-compose add unit probe --kind oneshot --exec components/probe --arg '${greeting}'
yoke-compose set units.probe.policy.restart.on_failure true
yoke-compose block add ../blocks/writer.yaml --as second
yoke-compose check
yoke-compose waive oneshot.restart.unchecked --at units.probe.policy.restart.on_failure --reason "Writing a file twice is harmless."
yoke-compose build
yoke app install com.yoke.station-1.0.0.yoke
Two loops, and they are not the same loop. A refusal has to be fixed: the loop ends when the description is one that can start. Advice has to be answered: by changing the project, or by saying in a waiver why the combination is meant.