fs-zoo
Version:
File system abstractions and implementations
35 lines (34 loc) • 1.58 kB
TypeScript
import type * as crud from '../crud/types';
type CowState = {
files: Set<string>;
cols: Set<string>;
};
/**
* Copy-on-write CRUD-fs. Accepts two file systems: (1) *base* the source of data;
* (2) *overlay* the writable layer. Initially all reads are served from the
* *base* layer, if a file or folder structure gets "tainted" (modified) a copy
* of those resources are copied and modified in the *overlay* layer. Subsequently,
* the reads of tainted resources will be served from the *overlay* layer.
*/
export declare class CowCrud implements crud.CrudApi {
protected readonly base: crud.CrudApi;
protected readonly overlay: crud.CrudApi;
protected readonly _state: CowState;
protected readonly _prefix: string[];
constructor(base: crud.CrudApi, overlay: crud.CrudApi, state?: CowState, prefix?: string[]);
private _fullPath;
private _isColTombstoned;
private _isFileTombstoned;
private _existsResource;
private _existsCollection;
private _clearFileTombstone;
readonly put: (path: string, data?: Uint8Array | undefined, options?: crud.CrudPutOptions) => Promise<void>;
readonly getStream: (path: string) => Promise<ReadableStream>;
readonly del: (path: string, silent?: boolean) => Promise<void>;
readonly info: (path: string) => Promise<crud.CrudResourceInfo>;
readonly drop: (path: string, silent?: boolean) => Promise<void>;
readonly scan: any;
readonly list: (path: string) => Promise<crud.CrudCollectionEntry[]>;
readonly from: (path: string) => Promise<crud.CrudApi>;
}
export {};