@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
37 lines • 2.01 kB
TypeScript
import type { Accessor } from '../../accessor/base.ts';
import { type ObjectStoreDriver, type PathFn } from './driver.ts';
/** Build single-key deletion over one driver. */
export declare function makeUnlink<A extends Accessor, C>(driver: ObjectStoreDriver<A, C>): PathFn<A>;
/**
* Build recursive prefix deletion over one driver.
*
* Serves both the `rmR` and `rmdir` slots: on a keyed store an empty
* directory is its marker object, so removing it and removing a subtree
* are the same prefix delete.
*/
export declare function makeRemovePrefix<A extends Accessor, C>(driver: ObjectStoreDriver<A, C>): PathFn<A>;
/**
* Build POSIX `rmdir` over one driver: refuse a non-empty prefix.
*
* Not `makeRemovePrefix`. On a keyed store an empty directory is its
* zero-byte marker object, so a prefix delete removes an empty directory
* correctly and a *non-empty* one recursively, which is `rm -r`, not
* `rmdir`. Sharing one function between the two slots made `rmdir` destroy
* a whole subtree for every caller that does not pre-check emptiness
* itself, and the command builders are the only callers that do: FUSE,
* `ws.vfs` and the sandbox runtimes all reach the op directly.
*
* The listing is the same one `readdir` reads, so the two agree on what a
* child is: a `marker` entry is the prefix's own marker (or a key the
* delimiter listing could not classify) and proves only that the directory
* exists, while any `f` or `d` entry is a child and makes this ENOTEMPTY.
* The walk stops at the first child rather than listing the whole directory
* to answer a yes/no question.
*
* A prefix holding no key at all -- not even the marker -- is a directory
* the store does not have, and rmdir(2) reports ENOENT for it.
* `makeRemovePrefix` stays silent there on purpose, because `rm -r` owns
* that refusal through its own `-f` handling.
*/
export declare function makeRmdir<A extends Accessor, C>(driver: ObjectStoreDriver<A, C>): PathFn<A>;
//# sourceMappingURL=remove.d.ts.map