import { type DocumentId } from '@automerge/automerge-repo'; /** * Why a document is quarantined: its bytes could not be loaded, or a space directory retired it. */ export type QuarantineReason = 'load-failed' | 'retired'; export type QuarantineRecord = { documentId: DocumentId; reason: QuarantineReason; /** The load error, for a document quarantined because it could not be loaded. */ error?: string; quarantinedAt: number; }; /** * Whether a load failed because the document cannot fit in Automerge's WASM heap — `error inflating document chunk * ops: out of memory` from `loadIncremental`, or the heap refusing to grow. Every load of such a document fails the * same way, while any other error (a storage read, malformed bytes) may not repeat. */ export declare const isOutOfMemoryError: (error: unknown) => boolean; /** Changes (commits) past which a document is reported as oversized. */ export declare const OVERSIZED_DOCUMENT_CHANGES = 1000000; /** * Ops past which a document is reported as oversized. Checked alongside changes because a few huge changes * bloat a document as surely as many small ones: the 45.7M-op cursor that ran out of memory had 156 changes. */ export declare const OVERSIZED_DOCUMENT_OPS = 1000000; export type DocumentSize = { changes: number; ops: number; }; /** * How many times over the limits a document is, as a doubling level: 0 at the limit, 1 at twice it, and so on; * -1 while it is within both limits. Reporting only when the level rises keeps the warning to one per doubling. */ export declare const oversizeLevel: ({ changes, ops }: DocumentSize) => number; /** * Ops a document whose load ran out of memory must hold to be quarantined. Once the heap is full every load fails, * so a smaller document is a bystander rather than the cause. */ export declare const QUARANTINE_MIN_OPS = 100000; /** * A lower bound on the ops in a document's stored Automerge chunks, read without loading the document, since loading * is what runs out of memory. Distinct changes never overlap, but a snapshot or bundle may repeat them, so the bound * is the larger of the changes' sum and the biggest snapshot or bundle. Bytes it cannot read count as no ops. */ export declare const countStoredOps: (records: Iterable) => Promise; //# sourceMappingURL=quarantine.d.ts.map