callOffunctionfunction callOf(helper: Helper, transport: Transport, command: Command, root: string, args: readonly string[]): readonly string[]The argument vector of a call: every word is one word, quoted by the executor, never joined here.
The protocol between the store and the helper, as pure functions: the argument vector of a call (the helper is carried in the call or kept on the host), the answer of the helper as a closed union (its exit status and its standard output, read once), and the lines the helper writes for each command. Nothing here runs a program.
import { callOf, replyOf } from "./protocol.ts";
import { helperOf, POSIX } from "./dialect.ts";
callOf(helperOf(POSIX), { kind: "installed", path: "/home/a/.local/state/anyfs/helper-x.sh" }, "stat", "/srv/fleet", ["a.json"]).slice(2); // ["stat", "/srv/fleet", "a.json"]callOffunctionfunction callOf(helper: Helper, transport: Transport, command: Command, root: string, args: readonly string[]): readonly string[]The argument vector of a call: every word is one word, quoted by the executor, never joined here.
Commandtypeno test imports ittype Command = "probe" | "install" | "read" | "stat" | "statmany" | "list" | "write" | "delete" | "rename";The commands of the helper.
Factstypeno test imports ittype Facts = { readonly size: number; readonly rev: Revision; readonly modified?: string };What the helper says of an object.
HostFactstypeno test imports ittype HostFacts = {
readonly dialect: "posix";
readonly hash: "sha256sum" | "shasum" | "openssl" | "sha256" | "none";
readonly stat: "gnu" | "bsd" | "none";
readonly caseSensitive: boolean | undefined;
};What a host is: what the probe of the helper said, as a closed record.
Replytypeno test imports ittype Reply =
| { readonly kind: "done"; readonly stdout: Uint8Array }
| { readonly kind: "missing" }
| { readonly … (549 characters)type Reply =
| { readonly kind: "done"; readonly stdout: Uint8Array }
| { readonly kind: "missing" }
| { readonly kind: "conflict"; readonly found: Found; readonly at: "path" | "to" }
| { readonly kind: "refused"; readonly reason: string }
| { readonly kind: "locked" }
| { readonly kind: "too-large" }
| { readonly kind: "no-root" }
| { readonly kind: "no-hash" }
| { readonly kind: "bad-hash"; readonly got: string }
| { readonly kind: "failed"; readonly detail: string }
| { readonly kind: "lost"; readonly detail: string };What the helper answered: a closed union.
Transporttypeno test imports ittype Transport = { readonly kind: "installed"; readonly path: string } | { readonly kind: "carried" };How the helper reaches the host: kept there at a path (verified once by its hash), or carried in each call as the argument of sh -c.
Writtentypeno test imports ittype Written = { readonly rev: Revision; readonly created: boolean };What a write told: whether it made the object, and the revision.