IF Commons GitHub

governance/types

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-posix-governance FR-007

What the operations of the view are given and give back: the kind of a name, what a stat says, an entry of a directory, the modes an object is opened in, the number of an open object and what an operation ends with. A result is a Result of an outcome (the value, how it was carried out, and what the operation noticed on the way) or of an error with a code, one sentence and how the operation would have been carried out, so that nothing a program reads is a guess.

import { openFlags } from "./types.ts";
openFlags("a").append; // true

Source: commons/anyfs-posix/src/governance/types.ts

2 of 28 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

governance.FileTypetypeno test imports it
type FileType = "file" | "dir";

What a name is: a file (an object) or a directory (a prefix).

governance.PosixStattypeno test imports it
type PosixStat = {
  readonly type: FileType;
  readonly size: number;
  readonly mode: number;
  readonly uid: number;
  readonly gid: number;
  readonly mtime?: string;
  readonly rev?: Revision;
};

What a stat says. A file has the size and the revision of its object and the time the store gives; a directory has no size.

governance.DirEntrytypeno test imports it
type DirEntry = { readonly name: string; readonly type: FileType; readonly size?: number; readonly rev?: Revision; readonly mtime?: string };

One name in a directory. A file has its size, its revision and its time.

governance.OPEN_MODESconstno test imports it
const OPEN_MODES: readonly ["r", "r+", "w", "w+", "wx", "a", "a+"]

The modes an object is opened in, as a file system names them: read, read and write, make and write, make and read and write, make where none is, add to the end, and add to the end and read.

governance.OpenModetypeno test imports it
type OpenMode = (typeof OPEN_MODES)[number];

One mode.

governance.OpenFlagstypeno test imports it
type OpenFlags = { readonly read: boolean; readonly write: boolean; readonly create: boolean; readonly exclusive: boolean; readonly truncate: boolean; readonly append: boolean };

What a mode means, as flags.

governance.openFlagsfunctionno test imports it
function openFlags(mode: "a" | "a+" | "r" | "r+" | "w" | "w+" | "wx"): OpenFlags

The flags of a mode.

governance.Fdtypeno test imports it
type Fd = Brand<number, "anyfs posix fd">;

The number of an open object. Made only by the table of handles.

governance.PartialReporttypeno test imports it
type PartialReport = { readonly done: readonly PosixPath[]; readonly failed: readonly { readonly path: PosixPath; readonly errno: Errno }[] };

What a walk over many objects did: those it did and those it could not.

governance.PosixErrortypeno test imports it
type PosixError = {
  readonly errno: Errno;
  readonly message: string;
  readonly path?: PosixPath;
  /** How the operation would have been carried out. */
  readonly fidelity: Fidelity;
  /** What the store said, where it said it. */
  readonly problem?: Problem;
  /** What a walk did before it failed, where it was one. */
  readonly report?: PartialReport;
};

What an operation ends with where it did not do what it was asked.

governance.Outcometypeno test imports it
type Outcome<T> = { readonly value: T; readonly fidelity: Fidelity; readonly notes: readonly string[] };

What an operation did: its value, how it was carried out, and what it noticed on the way.

governance.Donetypeno test imports it
type Done<T> = Promise<Result<Outcome<T>, PosixError>>;

What every operation of the view ends with.

governance.Countedtypeno test imports it
type Counted = { readonly count: number };

What a directory that was removed or a walk that was run says it did.

governance.Locatedtypeno test imports it
type Located = { readonly path: Path; readonly shown: PosixPath };

A key and the path it is shown at, for a walk.

FileTypetypeno test imports it
type FileType = "file" | "dir";

What a name is: a file (an object) or a directory (a prefix).

PosixStattypeno test imports it
type PosixStat = {
  readonly type: FileType;
  readonly size: number;
  readonly mode: number;
  readonly uid: number;
  readonly gid: number;
  readonly mtime?: string;
  readonly rev?: Revision;
};

What a stat says. A file has the size and the revision of its object and the time the store gives; a directory has no size.

DirEntrytypeno test imports it
type DirEntry = { readonly name: string; readonly type: FileType; readonly size?: number; readonly rev?: Revision; readonly mtime?: string };

One name in a directory. A file has its size, its revision and its time.

OPEN_MODESconst
const OPEN_MODES: readonly ["r", "r+", "w", "w+", "wx", "a", "a+"]

The modes an object is opened in, as a file system names them: read, read and write, make and write, make and read and write, make where none is, add to the end, and add to the end and read.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

OpenModetypeno test imports it
type OpenMode = (typeof OPEN_MODES)[number];

One mode.

OpenFlagstypeno test imports it
type OpenFlags = { readonly read: boolean; readonly write: boolean; readonly create: boolean; readonly exclusive: boolean; readonly truncate: boolean; readonly append: boolean };

What a mode means, as flags.

openFlagsfunction
function openFlags(mode: "a" | "a+" | "r" | "r+" | "w" | "w+" | "wx"): OpenFlags

The flags of a mode.

Imported by 15 tests of the run (15 passed, 0 failed): the library's results

Fdtypeno test imports it
type Fd = Brand<number, "anyfs posix fd">;

The number of an open object. Made only by the table of handles.

PartialReporttypeno test imports it
type PartialReport = { readonly done: readonly PosixPath[]; readonly failed: readonly { readonly path: PosixPath; readonly errno: Errno }[] };

What a walk over many objects did: those it did and those it could not.

PosixErrortypeno test imports it
type PosixError = {
  readonly errno: Errno;
  readonly message: string;
  readonly path?: PosixPath;
  /** How the operation would have been carried out. */
  readonly fidelity: Fidelity;
  /** What the store said, where it said it. */
  readonly problem?: Problem;
  /** What a walk did before it failed, where it was one. */
  readonly report?: PartialReport;
};

What an operation ends with where it did not do what it was asked.

Outcometypeno test imports it
type Outcome<T> = { readonly value: T; readonly fidelity: Fidelity; readonly notes: readonly string[] };

What an operation did: its value, how it was carried out, and what it noticed on the way.

Donetypeno test imports it
type Done<T> = Promise<Result<Outcome<T>, PosixError>>;

What every operation of the view ends with.

Countedtypeno test imports it
type Counted = { readonly count: number };

What a directory that was removed or a walk that was run says it did.

Locatedtypeno test imports it
type Located = { readonly path: Path; readonly shown: PosixPath };

A key and the path it is shown at, for a walk.

Titles, headings, exports, tables, columns and requirements. Esc closes.