UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

38 lines • 2.16 kB
import type { BaseVFS } from '../../vfs/base.ts'; import { type PathSpec } from '../../types.ts'; import type { SessionAccess } from '../../view/types.ts'; import type { MountRegistry } from './registry.ts'; export declare function vfsStorageLocation(vfs: BaseVFS): string; /** * Build the transfer generics' identity function for a mount set. * * `cp` and `mv` compare two operands to decide whether they name the same * file. Within one mount the mount-relative path answers that, but across * mounts it does not: two prefixes can address one store, and there a move * would copy an object over itself and then unlink the source. * * The VFS's storage id and the mount-relative path are joined into * one path-like string rather than kept as separate components, so nested * backings collapse onto the same key. Two disk mounts rooted at * `/srv/data` and `/srv/data/sub` make `/a/sub/x` and `/b/x` the same * file, and both render as `disk:/srv/data/sub/x`. A delimiter between * the two parts would keep them apart and let the move through. * * The mount-relative path keeps its leading slash so the generics' * `startsWith(key + '/')` containment test still marks a directory as an * ancestor of its children, and only within one storage. */ export declare function makeStorageKey(registry: MountRegistry): (path: PathSpec) => string; /** * Refuse up front a delete a mount under the path could not condition: a * move across mounts copies before it deletes, and on a conditional mount * whose backend ignores delete conditions the delete would be refused after * the copy landed. The owning mount counts, and so does any mount nested * under the path, which the walk would cross; a mount above the owner is * never touched. A live pipe at or below the source cannot be deleted either, * and copying it would drain it, so it is refused with EPERM, as `rm` refuses * it; it is looked up as the moving command's own session sees /dev. Mirrors * Python's `make_check_unlink`. */ export declare function makeCheckUnlink(registry: MountRegistry, access?: SessionAccess): (path: PathSpec) => void; //# sourceMappingURL=storage.d.ts.map