/** * The OPFS backend — the real one. * * Layout, under `//`: * * ``` * snapshot.loro the whole document, rewritten when the log is folded * pending.log framed update + ack records appended since that snapshot * meta.json { last_access, byte_size, has_unacked } for the quota sweeper * ``` * * ## Why this must run in a worker * * `transact()` promises that the update blob reaches the filesystem before * control returns to the event loop, so a hard crash cannot lose an edit. The * only OPFS API that can honour that is `createSyncAccessHandle()`, whose * `write()` is genuinely synchronous — and it exists **only in a worker**. The * architecture already puts this layer in a SharedWorker; this class is where * that stops being a preference and becomes a correctness requirement. * * On the main thread the class still works, via `createWritable()`, but the * write is only *queued* synchronously and lands a microtask later. That is a * real weakening of the guarantee, so it is reported on the instance as * {@link OpfsCrdtStorage.durable} — check it and warn rather than assuming. */ import { type CrdtDocStore, type CrdtStorage, type StoredDocMeta } from './storage.js'; /** Persistence in the Origin Private File System. */ export declare class OpfsCrdtStorage implements CrdtStorage { #private; readonly available: boolean; /** * True when appends are genuinely synchronous — i.e. this is running in a * worker with `createSyncAccessHandle()`. False on the main thread, where a * crash in the same tick as an edit can still lose it. */ readonly durable: boolean; constructor(root_name?: string); open(node_id: string): Promise; list(): Promise; remove(node_id: string): Promise; usage(): Promise; } //# sourceMappingURL=opfs.storage.d.ts.map