Openedtypeno test imports ittype Opened = { readonly store: SshStore; readonly transport: Transport; readonly facts: HostFacts };A store on a host, with how it reaches the host and what the host is.
The store in a folder on a host reached by SSH. It speaks to the host only through an Executor of Headless (the one place where the options, the quoting and the host-key policy of ssh are held), and the executor runs the helper, a small script of POSIX whose SHA-256 is pinned: the helper is kept on the host at a path that carries its hash, checked when it is put there, or carried in each call where it cannot be kept. The bytes of an object go over standard input and output and never through an argument. A path of the store is a file below the folder; the revision of an object is sha256: and the digest of its bytes, computed by the host for stat and list and by this library for what it reads and writes, so a write that the host did not make as sent is tampered. A write goes whole through a temporary file and a rename, an expectation of no object is an exclusive link, an expectation of a revision is held under a lock the host makes with mkdir. It has no batch, no history, no range and no append, and it does not flush to the disk: a store does not claim what it cannot keep.
Limits, said once: the check that a path stays inside the folder and the use of the path are two steps, so a link made between them by another process of the same account is not caught; a lock that belongs to a process that is gone is taken over only where the host answers kill -0; a call keeps the whole object in memory on both sides (the store refuses an object of more than maxBytes); a host with none of sha256sum, shasum, openssl or sha256 cannot hold a store; the clock of the host is the modified of an object.
import { openSshStore } from "./store.ts";
// const opened = await openSshStore(sshExecutor(target, [target], config), { root: "/srv/fleet", place: { host: "alpha" }, create: true });
// opened.kind === "ok" && opened.value.store.consistency; // "strong"Openedtypeno test imports ittype Opened = { readonly store: SshStore; readonly transport: Transport; readonly facts: HostFacts };A store on a host, with how it reaches the host and what the host is.
openSshStorefunctionfunction openSshStore(executor: Executor, options: SshOptions): Promise<Result<Opened, string>>A store on a host, or why there is none. The executor is the one of Headless for the target; the folder is made if create says so.
SSH_CAPABILITIESconstconst SSH_CAPABILITIES: readonly ["read", "write", "list", "stat", "delete", "cas", "rename"]The capabilities of the store on a host.
SshHosttypeno test imports ittype SshHost = { readonly host: string; readonly user?: string; readonly port?: number };The host a store is on, as the place says it: the label of the target, and the account and port where they are not the executor's own.
SshOptionstypetype SshOptions = {
/** The host the executor reaches, for the place and the id of the store. */
readonly place: Ssh… (1001 characters)type SshOptions = {
/** The host the executor reaches, for the place and the id of the store. */
readonly place: SshHost;
/** The folder of the store on the host: an absolute path. */
readonly root: string;
/** Whether to make the folder where it is not there. */
readonly create?: boolean;
/** Whether to keep the helper on the host (the default) or to carry it in each call. */
readonly install?: boolean;
/** The folder the helper is kept in: the state folder of the account where it is `default` or left out. */
readonly stateDir?: string;
/** The most bytes an object may have, here and on the host. 32 MiB where it is left out. */
readonly maxBytes?: number;
/** Whether to refuse paths another file system could not hold (the default). */
readonly portable?: boolean;
/** How long a call may take before it is stopped. 60 s where it is left out. */
readonly timeoutMs?: number;
/** The language of the shell on the host. */
readonly dialect?: HostDialect;
};What the store on a host is made with.
SshStoretypetype SshStore = Store<(typeof SSH_CAPABILITIES)[number]>;The type of the store on a host.