Mounttypeno test imports ittype Mount = { readonly prefix: Prefix; readonly store: AnyStore };A store mounted at a prefix.
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)Mounttypeno test imports ittype Mount = { readonly prefix: Prefix; readonly store: AnyStore };A store mounted at a prefix.
Namespacetypeno test imports ittype Namespace = { readonly mounts: readonly Mount[] };The mounts of a namespace, the longest prefix first.
emptyNamespaceconstconst emptyNamespace: NamespaceA namespace with no mount.
mountfunctionfunction 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.
resolvefunctionfunction 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.
asStorefunctionfunction 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.