/** * IndexedDB-backed filesystem. * * Modes: * - **persistent** (default): reads/writes go through IDB. An in-memory write * cache ensures write-then-read consistency for recently written files. * Reads are NOT cached in RAM — data is fetched from IDB on demand. * - **persistent + versioned**: same as persistent, but clears all data when the * supplied version string differs from the one stored in the DB (used for the * overlay write-layer so stale toolchain writes are invalidated on manifest change). * - **volatile** (`{ volatile: true }`): operates purely on an in-memory Map — * no IndexedDB is opened at all. Used for /tmp and other ephemeral paths. */ import type { FSStats, IFileSystem } from 'emception'; export interface IDBFSOptions { /** When true, skip all IndexedDB I/O — data lives only in writeCache. */ volatile?: boolean; /** * Version tag for cache invalidation. On `init()` the stored version is * compared to this value; if they differ, all entries are cleared. * Ignored when `volatile` is true. */ version?: string; } export declare class IDBFS implements IFileSystem { private dbName; private volatile; private version; private idb; private writeCache; constructor(dbName: string, options?: IDBFSOptions); init(): Promise; /** * @deprecated No longer preloads IDB into RAM. Use async readFile() instead. */ preloadAll(): Promise; private normalizePath; /** * Synchronously creates all ancestor directory entries in writeCache. * Mirrors MemFS.ensureParentDir — works for both volatile and persistent * modes (persistent will persist dirs via the normal writeFile/mkdir path * later; this just ensures the cache is coherent for fast lookups). */ private ensureParentDirInCache; private dbGet; private dbPut; private dbDelete; /** Clear every entry in the object store. */ private dbClear; private dbKeys; /** Collect keys from writeCache matching a prefix (for volatile readdir). */ private memKeys; readFile(path: string): Promise; /** Synchronous read from writeCache. Returns null on miss. */ readFileSync(path: string): Uint8Array | null; /** Synchronous write: updates writeCache immediately, fires async IDB persist. */ writeFileSync(path: string, data: Uint8Array): void; /** Synchronous stat from writeCache. */ statSync(path: string): FSStats | null; /** Synchronous readdir from writeCache keys. */ readdirSync(path: string): string[]; /** Synchronous existence check from writeCache. */ existsSync(path: string): boolean; /** Synchronous mkdir: creates directory entry in writeCache. */ mkdirSync(path: string): void; /** Synchronous delete from writeCache. */ deleteFileSync(path: string): boolean; writeFile(path: string, data: Uint8Array): Promise; /** Persist a directory and all its ancestors to IDB. */ private persistDirChain; exists(path: string): Promise; stat(path: string): Promise; readdir(path: string): Promise; deleteFile(path: string): Promise; mkdir(path: string): Promise; /** Clear all entries (writeCache + IDB). Re-creates the root dir entry. */ clear(): Promise; } //# sourceMappingURL=idb.d.ts.map