import { E as EmscriptenBuiltinFilesystem, a as PGlite, b as PostgresMod } from '../interface-ymvJB3xs.js'; interface FileWrite { path: string; size: number; full: boolean; truncate: boolean; chunks: Array<{ at: number; data: Uint8Array; }>; } interface ChangeSet { ops: Array<{ op: 'remove' | 'mkdir'; path: string; }>; files: { wal: FileWrite[]; data: FileWrite[]; control: FileWrite[]; }; } type StorageEntry = { kind: 'dir'; path: string; } | { kind: 'file'; path: string; data: Uint8Array; mtime?: number; }; /** * Where a MemfsFrontendFS persists its files. */ interface StorageBackend { /** * Called once, before the emscripten module starts. */ init(): Promise; /** * List the persisted entries, parents before their children. */ load(): AsyncIterable; /** * Persist the changes of one flush. Never called concurrently, if it throws * the changes stay pending and are passed again with the next flush. */ apply(changes: ChangeSet, options: { relaxedDurability: boolean; }): Promise; /** * Called once, after the final flush. */ close(): Promise; } interface MemfsFrontendOptions { debug?: boolean; } /** * PGlite filesystem with a MEMFS frontend and a pluggable storage backend. * All operations act on an emscripten MEMFS mounted at PGDATA, so the database * behaves exactly as with the in-memory filesystem. The node and stream ops of * that mount are wrapped to record which files and directories were touched, * and these changes are passed to the backend in `syncToFs`, ie. after each * query. */ declare class MemfsFrontendFS extends EmscriptenBuiltinFilesystem { #private; readonly backend: StorageBackend; readonly debug: boolean; constructor(backend: StorageBackend, { debug }?: MemfsFrontendOptions); init(pg: PGlite, opts: Partial): Promise<{ emscriptenOpts: Partial; }>; /** * Load the files persisted by the backend into the MEMFS mount. */ initialSyncFs(): Promise; syncToFs(relaxedDurability?: boolean): Promise; closeFs(): Promise; } export { type ChangeSet, type FileWrite, MemfsFrontendFS, type MemfsFrontendOptions, type StorageBackend, type StorageEntry };