@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
39 lines • 2.36 kB
TypeScript
import type { StatPath } from '../../view/types.ts';
import type { FileStat } from '../../types.ts';
import type { MountRegistry } from '../mount/registry.ts';
import type { Namespace } from '../mount/namespace/namespace.ts';
/** GNU's line for a `-newer` reference that does not exist. */
export declare function missingReferenceLine(ref: string): Uint8Array;
/** GNU's line for a `-newer` reference that is a symlink loop, under a
* policy that follows it. */
export declare function loopReferenceLine(ref: string): Uint8Array;
/**
* The stat a `-newer` reference compares by, or null when absent.
*
* GNU reads the reference with the link policy the leading option set:
* `-P` (the default) takes a symlink's own mtime, `-H` and `-L` take its
* target's. A link lives in the namespace, so its own row comes from
* there and never touches a backend, which is also what makes a loop
* under `-P` an ordinary reference. Under a following policy the target
* is resolved through the namespace, which throws CycleError on a loop,
* and a dangling one falls back to the link's own row, as GNU's
* stat-then-lstat does.
*/
export declare function referenceStat(virtual: string, statPath: StatPath, namespace: Namespace | null, follow: boolean): Promise<FileStat | null>;
/**
* Each `-newer FILE` reference's modification time.
*
* A backend's find op can stat nothing outside its own mount, while the
* reference may live on any mount and carry a namespace-overlay mtime (a
* `touch -d` on a backend that stores none). So the executor resolves each
* reference through the dispatcher once, before it binds the parsed
* expression, and the tree holds a timestamp that needs no further I/O. A
* reference that does not exist is GNU's error, exit 1, and no walk runs;
* so is a symlink loop under `-H` or `-L`, in GNU's other words. `follow`
* is whether the leading `-H`/`-L` follows a reference that is a symlink;
* `-P`, the default, reads the link itself. Returns the times in epoch
* seconds and null, or an empty list and the error line for the first
* reference that does not exist.
*/
export declare function resolveNewerRefs(refs: readonly string[], registry: MountRegistry, cwd: string, statPath: StatPath, namespace?: Namespace | null, follow?: boolean): Promise<[number[], Uint8Array | null]>;
//# sourceMappingURL=find_refs.d.ts.map