IF Commons GitHub

logical/namespace

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-anyfs-logical FR-005

A namespace: many stores mounted at prefixes and seen as one. A path is resolved to the store of the longest prefix that holds it, with the path below the prefix; a list across mounts merges the lists in the order of the paths and hides what a mount at a longer prefix covers. Mounts are values in code, never a table read from a file, and an operation that would cross two mounts (a rename, a batch) is refused, because no store can make it as one change.

import { emptyNamespace, mount } from "./namespace.ts";
// const ns = mount(mount(emptyNamespace, fleetPrefix, fleetStore), secretsPrefix, secretsStore)

Source: commons/anyfs/src/logical/namespace.ts

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

Mounttypeno test imports it
type Mount = { readonly prefix: Prefix; readonly store: AnyStore };

A store mounted at a prefix.

Namespacetypeno test imports it
type Namespace = { readonly mounts: readonly Mount[] };

The mounts of a namespace, the longest prefix first.

emptyNamespaceconst
const emptyNamespace: Namespace

A namespace with no mount.

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

mountfunction
function mount(ns: Namespace, prefix: Prefix, store: StoreBase): Result<Namespace, string>

A namespace with one more mount, or why it cannot: a prefix holds one mount.

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

resolvefunction
function resolve(ns: Namespace, path: Path): Result<{ readonly mount: Mount; readonly path: Path; }, Problem>

The mount that holds a path and the path below its prefix, or the refusal where no mount holds it.

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

asStorefunction
function asStore<C extends OpCapability>(ns: Namespace, id: string, capabilities: readonly C[]): Result<Store<C>, string>

The namespace as one store of the capabilities given, which every mount has: or the capability a mount lacks. Search is not made across mounts.

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

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