Skip to main content

Crate gridwork

Crate gridwork 

Source
Expand description

gw — one binary, and for now one of its three modes.

What is here is the CLI: it opens the host-local socket, asks one question, and prints the answer as the protocol produced it. Nothing is reshaped on the way through. A health answer is the contract’s health value and a refusal is the contract’s error object, so a caller that already knows the wire needs no second vocabulary for the command line — and this program has no view of its own to drift out of step.

Three rules hold everywhere:

  • The answer is JSON on standard output. --pretty changes the formatting and never the value. --help is the single exception, because a caller asking for the command tree is asking for prose.
  • The exit says what to do about it (exit). One table, derived from the refusal’s own code, so the exit and the JSON can never disagree.
  • No database, no key material. Every verb here goes through the socket. The database and the KEK belong to daemon and admin, which is the whole reason those two are separate verbs.

Modules§

admin
The two verbs that hold a database and a key.
args
The command line, parsed by hand.
client
The client half of the local wire.
exit
What an invocation is worth to a caller: one error shape, one exit table.

Constants§

PUBLIC_REVISION
The revision this build came from, or nothing if it was not stamped.

Functions§

run
Run one invocation and return the exit it earned.