import type { MirageFsSeed } from './seed.ts'; import type { FSNode, NodeHost, NodeOps, StreamOps } from './types.ts'; /** * The node table for one mount prefix. * * Everything about *which* nodes exist and what they are called lives * here: creating them, naming them, moving them, and translating between * the guest's absolute paths and positions in this tree. It records no * mutations and reports no errno, so the filesystem above it is left with * only the semantics of each call. */ export declare class NodeTree { private readonly host; private readonly nodeOps; private readonly streamOps; private readonly prefix; private root; /** * Args: * host: the Emscripten FS namespace, for `createNode` and the mode * predicates. * prefix: the mount prefix this tree serves, trailing slash optional. * nodeOps: op table every node created here must carry. * streamOps: stream op table every node created here must carry. */ constructor(host: NodeHost, prefix: string, nodeOps: NodeOps, streamOps: StreamOps); /** Build the root. Emscripten calls this through `FSType.mount`. */ mount(): FSNode; /** * Populate the tree from a collected seed. * * Must run after `FS.mount`, never inside it: `FSNode` copies `mount` * from its parent, and Emscripten assigns the root's only once * `type.mount()` has returned. Seeding early leaves every nested node * with an undefined mount, and two undefined mounts compare equal, * which silently defeats the kernel's cross-mount rename check. * * Args: * seed: tree collected from the bridge before the run. */ seed(seed: MirageFsSeed): void; /** * Put the mount's own mode and stamp on a node the seed just placed. * * Without it a seeded node carries `makeNode`'s defaults: 0o644 * whatever the mount holds, and the moment the node was built, so a * chmod the shell made was invisible and every file the guest stats * looked modified this second. Only seeded nodes are restamped: a * file the guest creates during the run really was modified now. * * Args: * seed: the collected tree, holding what the rows reported. * path: guest-absolute path of the node. * node: the node just placed for it. */ private stamp; /** * Create a node and file it under its parent. * * Args: * parent: directory to file it under, null only for the root. * name: the child's name. * mode: type and permission bits. */ makeNode(parent: FSNode | null, name: string, mode: number, rdev?: number): FSNode; childOf(parent: FSNode, name: string): FSNode | undefined; childNames(node: FSNode): string[]; detach(parent: FSNode, name: string): void; /** * Move a node to a new parent and name. * * Args: * node: the node being moved. * newDir: its new parent directory. * newName: its new name. */ move(node: FSNode, newDir: FSNode, newName: string): void; /** The guest-absolute path of a node, which is what the journal names. */ pathOf(node: FSNode): string; private rootNode; private relative; private ensureDir; /** * Create a leaf node at `path`, building the directories above it. * * Args: * path: guest-absolute path of the leaf. * mode: type and permission bits, a regular file by default. */ private placeFile; } //# sourceMappingURL=tree.d.ts.map