Expand description
The public operations this server serves, declared once.
§One operation per public operation, and no more
The list here is the whole API. It is exactly one operation per variant of
PrintAction, of
SpoolCommand and of
RecoveryAction the contracts
declare, and the recovery read beside the last (RECOVERY_STATUS),
plus fifteen operations beside them — the prints listing, status, context,
image materialization, history, the event log followed in the order it was
stored, a fresh look at a print and one at the printer, the manifest’s read
and write, the four reads of the spool ledger: the spools, one spool, the
printer’s own history and a filament check — and the operator’s word that
the bed is clear, and nothing else. The router is built by folding
over this array rather than by writing routes out, so the set served and the
set declared are one thing; and this crate’s own tier derives the required
set from the contracts’ own PrintAction rather than from a list of its
own, so growing this array and the routes together cannot satisfy it.
§A read of one print may have a form for the printer as a whole
A fresh look is one print’s, and there is one of the printer with no print
named — before a print, between prints, after one. The two are two
operations, because they are two routes and two answers recorded in two
places; and one command, because what a caller asks for is a look either
way. So the print’s operation names the printer’s as its
Operation::printer_wide form: the command made from it takes its print
as optional and asks the printer’s operation when none is named, and the
printer’s operation has no command of its own (printer_wide_of).
The spool ledger’s operations name no print: a spool is the printer’s, not
one print’s, so they sit beneath /spools and /history rather than
beneath a print, and a supervision turn’s print binding constrains none of
them. Nor do the recovery operations, beneath /printer/recovery: what a
recovery moves is the printer, whatever the last print left on its bed.
Every operation sits beneath VERSION_PREFIX, takes JSON where it takes a
body at all, and answers JSON.
§Each operation declares what it takes and what it answers
Operation::request is the request schema of one route — every value a
caller supplies, where it travels and whether it is required — and
Operation::response_schema is the schema of each answer that route can
produce. Neither is written out for the fifteen mutating operations: their
body is derived from the contracts’ own
PrintAction or
SpoolCommand at run time, so a
variant that gains a field gains it here the moment the type does. The
command-line program builds its own parser from these declarations rather
than from a list of its own, which is what stops the two surfaces drifting.
§The ingress is not one of them
INGRESS_PATH is the endpoint Obico’s webhook notification plugin posts
to. It is the producer’s own ingress rather than an operation a client
calls — it is authenticated by a shared secret rather than by an actor, it
carries Obico’s body rather than this system’s, and it answers before its
handling completes. So it is declared separately and served outside the
versioned prefix, where no client can mistake one surface for the other.
Structs§
- Declared
- One value declared beside an operation, at one place in its request.
- Operation
- One public operation: what it is called, how it is reached, and what it does.
- Parameter
- One value a request to an operation carries.
Enums§
- Action
Kind - One action of the closed vocabulary, named without its payload.
- Answer
- One answer a route can produce.
- Effect
- What one operation does to the machine or the record.
- Located
- Where one value of a request travels.
- Method
- The method one operation is reached by.
- Print
Action - The whole vocabulary an actor may ask for, and there is no other.
- Recovery
Action - The whole recovery vocabulary, and there is no other.
- Recovery
Action Kind - One recovery action, named without its fields: what a grant names and what a refusal of an ungranted request names.
- Spool
Command - The whole vocabulary of the spool ledger, and there is no other.
- Spool
Command Kind - One command of the spool ledger’s vocabulary, and nothing else.
- Value
Kind - What kind of value one parameter takes.
Constants§
- BED_
CLEAR - The operator’s word that the bed is clear, recorded beside the recovery vocabulary it is decided into.
- BESIDE_
THE_ ACTIONS - The fifteen operations this server serves beside the vocabularies.
- COMMAND_
TAG - The field the spool ledger’s vocabulary carries its tag in, which a caller never supplies either.
- CONTEXT_
IMAGE_ PATH_ FIELD - The field a context answer carries the latest image’s own path in.
- IMAGE_
PATH_ FIELD - The field an image answer carries that image’s own path in.
- INGRESS_
PATH - Where
Obico’s webhook notification plugin posts, which is not a public operation. See this module’s own comment. - MEDIA_
TYPE - The media type every operation takes a body in and answers in.
- OPERATIONS
- Every public operation this server serves, and there is no other.
- PRINTER_
LOOK - The look at the printer with no print named, which
lookis asked as when it names none. - RECOVERY_
STATUS - The read beside the recovery vocabulary: what every recovery action is checked against now, and what each would meet.
- VERSION_
PREFIX - The one versioned prefix every public operation is served beneath.
Functions§
- command_
for - How one operation’s name is spelled as a command of the
printobserverprogram: each underscore a hyphen. - operation
- The operation of one name, when this server serves one.
- printer_
wide_ of - The operation whose command reaches this one, when this one is another’s
Operation::printer_wideform and so has no command of its own.