UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

43 lines • 2.44 kB
import type { TiDBFilesystemAccessor } from '../../accessor/tidb_filesystem.ts'; import type { FsError } from '../../errors/types.ts'; import type { PathSpec } from '../../types.ts'; import type { Entry, Kinds } from './types.ts'; /** * What each mount-local path is, in one fs:batch-stat. drive9 creates missing * parents on a write, a mkdir and a file rename, and keeps a file and a * directory of one name side by side, so the errno open(2) or rename(2) would * answer has to be worked out here from what the paths are before the call. * Each path is asked bare, which answers the file of a name that is both, and * with a trailing slash, kept under `key + '/'`, which answers only a * directory. The mount root is always a directory and is not asked. */ export declare function kindsOf(accessor: TiDBFilesystemAccessor, keys: readonly string[]): Promise<Kinds>; /** * What `key` is as a folder on a longer path: the directory of a name that is * also a file, as a listing shows it, else what is there. */ export declare function folderOf(kinds: Kinds, key: string): Entry | null; /** * ENOTDIR for a file above `key`, ENOENT for a missing directory above it, * the first the walk meets, as the kernel resolves a path. */ export declare function brokenParent(kinds: Kinds, spec: PathSpec, key: string): FsError | null; export declare function lookupError(kinds: Kinds, spec: PathSpec, key: string): FsError; export declare function checkWriteTarget(kinds: Kinds, spec: PathSpec, key: string): void; /** * Refuse a mkdir GNU refuses; true when `-p` finds it done. Plain mkdir is * EEXIST for anything at the target and owes the parent chain the walk a * write owes it. `-p` names the component it trips on: a file above the * target is ENOTDIR, the target as a file EEXIST, and the target as a * directory is success. */ export declare function checkMkdirTarget(kinds: Kinds, spec: PathSpec, key: string, parents: boolean): boolean; /** * Refuse a rename rename(2) refuses once both ends resolve. A missing * destination parent is ENOENT and a file above it ENOTDIR; a file onto a * directory is EISDIR, a directory onto a file ENOTDIR, and into its own * subtree EINVAL. A directory onto one that holds entries is left to drive9, * which answers it with a conflict. */ export declare function checkRename(kinds: Kinds, src: PathSpec, s: string, dst: PathSpec, d: string): void; //# sourceMappingURL=dest.d.ts.map