governance.MarkerNametypeno test imports ittype MarkerName = Brand<string, "anyfs posix marker name">;The name of the marker object that keeps a directory: one segment of a path. Made only by parseMarkerName.
What a program decides about the view before it opens it: whether an empty directory is kept (and as which marker object), who the objects belong to and with which mode, whether the ancestors of a new object are checked, how much a read cache may hold and how many times an append tries again. The policy is a value, made by smart constructors and held by the view, so that two views of one store can differ and nothing is read from the process.
import { defaultPolicy, keepMarkers } from "./policy.ts";
defaultPolicy().markers.kind; // "none": an empty directory is not kept
const m = keepMarkers(".keep");
m.kind === "ok" && m.value.kind; // "keep"governance.MarkerNametypeno test imports ittype MarkerName = Brand<string, "anyfs posix marker name">;The name of the marker object that keeps a directory: one segment of a path. Made only by parseMarkerName.
governance.parseMarkerNamefunctionno test imports itfunction parseMarkerName(text: string): Result<MarkerName, string>The name of a marker, or why the text is not one: one segment, which a path can hold.
governance.Markerstypeno test imports ittype Markers = { readonly kind: "none" } | { readonly kind: "keep"; readonly name: MarkerName };Whether an empty directory is kept: not at all, or as an empty object of this name below it.
governance.keepMarkersfunctionno test imports itfunction keepMarkers(name: string): Result<Markers, string>Keeping empty directories as marker objects of a name.
governance.Ownershiptypeno test imports ittype Ownership = { readonly uid: number; readonly gid: number; readonly fileMode: number; readonly dirMode: number };Whom an object belongs to and with which mode, for a view that has no such thing in its store: a number each.
governance.DEFAULT_OWNERSHIPconstno test imports itconst DEFAULT_OWNERSHIP: OwnershipThe owner of everything, root, and the modes of a file system's usual defaults.
governance.parseOwnershipfunctionno test imports itfunction parseOwnership(uid: number, gid: number, fileMode: number, dirMode: number): Result<Ownership, string>An ownership from numbers, or why they are not one: whole numbers from 0, and modes of at most four octal digits.
governance.AncestorCheckstypeno test imports ittype AncestorChecks = "check" | "trust";Whether the directories above a new object are checked to be directories (check: a stat for each), or trusted (trust: none).
governance.Policytypeno test imports ittype Policy = {
readonly markers: Markers;
readonly ownership: Ownership;
readonly ancestors: AncestorChecks;
/*… (432 characters)type Policy = {
readonly markers: Markers;
readonly ownership: Ownership;
readonly ancestors: AncestorChecks;
/** The most bytes the read cache holds; 0 holds none. */
readonly readCacheBytes: number;
/** How many entries a list is asked for at a time. */
readonly listPage: number;
/** How many times an append reads and writes again after another writer changed the object. */
readonly appendAttempts: number;
};What the view is told.
governance.defaultPolicyfunctionno test imports itfunction defaultPolicy(): PolicyThe default policy: no markers, the default ownership, the ancestors checked, 8 MiB of cache, pages of 1000 and 5 attempts.
governance.withPolicyfunctionno test imports itfunction withPolicy(base: Policy, changes: Partial<Policy>): Result<Policy, string>A policy with changes, or why they make none: the sizes are whole numbers, the page at least 1 and the attempts at least 1.
MarkerNametypeno test imports ittype MarkerName = Brand<string, "anyfs posix marker name">;The name of the marker object that keeps a directory: one segment of a path. Made only by parseMarkerName.
parseMarkerNamefunctionfunction parseMarkerName(text: string): Result<MarkerName, string>The name of a marker, or why the text is not one: one segment, which a path can hold.
Markerstypeno test imports ittype Markers = { readonly kind: "none" } | { readonly kind: "keep"; readonly name: MarkerName };Whether an empty directory is kept: not at all, or as an empty object of this name below it.
keepMarkersfunctionfunction keepMarkers(name: string): Result<Markers, string>Keeping empty directories as marker objects of a name.
Ownershiptypeno test imports ittype Ownership = { readonly uid: number; readonly gid: number; readonly fileMode: number; readonly dirMode: number };Whom an object belongs to and with which mode, for a view that has no such thing in its store: a number each.
DEFAULT_OWNERSHIPconstconst DEFAULT_OWNERSHIP: OwnershipThe owner of everything, root, and the modes of a file system's usual defaults.
parseOwnershipfunctionfunction parseOwnership(uid: number, gid: number, fileMode: number, dirMode: number): Result<Ownership, string>An ownership from numbers, or why they are not one: whole numbers from 0, and modes of at most four octal digits.
AncestorCheckstypeno test imports ittype AncestorChecks = "check" | "trust";Whether the directories above a new object are checked to be directories (check: a stat for each), or trusted (trust: none).
Policytypetype Policy = {
readonly markers: Markers;
readonly ownership: Ownership;
readonly ancestors: AncestorChecks;
/*… (432 characters)type Policy = {
readonly markers: Markers;
readonly ownership: Ownership;
readonly ancestors: AncestorChecks;
/** The most bytes the read cache holds; 0 holds none. */
readonly readCacheBytes: number;
/** How many entries a list is asked for at a time. */
readonly listPage: number;
/** How many times an append reads and writes again after another writer changed the object. */
readonly appendAttempts: number;
};What the view is told.
defaultPolicyfunctionfunction defaultPolicy(): PolicyThe default policy: no markers, the default ownership, the ancestors checked, 8 MiB of cache, pages of 1000 and 5 attempts.
withPolicyfunctionfunction withPolicy(base: Policy, changes: Partial<Policy>): Result<Policy, string>A policy with changes, or why they make none: the sizes are whole numbers, the page at least 1 and the attempts at least 1.