/** * sql.js-backed Kernel Backend * * Pure-WASM SQLite. Use this backend in environments that cannot load * native binaries or `bun:sqlite` — Node-without-Bun, WebContainer, browser. * * sql.js holds the database image in memory. Persistence is implemented by * snapshotting the full image to disk on close and at a configurable write * interval. Appropriate for kernel op-log sized datasets; not appropriate * for very large stores where incremental flushes matter. * * @module trellis/core/persist */ import type { KernelOp, KernelBackend } from './backend.js'; export interface SqlJsKernelBackendOptions { /** Filesystem path to load/persist DB image. Pass `:memory:` to disable disk I/O. */ dbPath: string; /** Auto-flush every N writes. Default 50. Set 0 to disable auto-flush. */ autoFlushEvery?: number; } export declare class SqlJsKernelBackend implements KernelBackend { private opts; private db; private stmts; private writes; private flushEvery; private initialized; private constructor(); /** * Async factory — sql.js WASM init is async, but the resulting backend * exposes the synchronous KernelBackend surface, so it slots into the * existing kernel without interface changes. */ static create(opts: SqlJsKernelBackendOptions): Promise; private bootstrap; private loadFromDisk; private flushToDisk; init(): void; private prepareStatements; append(op: KernelOp): void; readAll(): KernelOp[]; readUntil(hash: string): KernelOp[]; readAfter(hash: string): KernelOp[]; readUntilTimestamp(iso: string): KernelOp[]; getByHash(hash: string): KernelOp | undefined; getLastOp(): KernelOp | undefined; getOpCount(): number; saveSnapshot(lastOpHash: string, data: any): void; loadLatestSnapshot(): { lastOpHash: string; data: any; } | undefined; putBlob(hash: string, content: Uint8Array): void; getBlob(hash: string): Uint8Array | undefined; hasBlob(hash: string): boolean; close(): void; /** Force a write of the in-memory DB image to disk. */ flush(): void; private runAll; private runOne; private tickFlush; } //# sourceMappingURL=sqljs-backend.d.ts.map