API / @aionbuilders/nabu

CompactResult

Type Stability: stable

Related guide: Persistence and sync →

Definition

TypeScript
import type { CompactResult } from '@aionbuilders/nabu';
TypeScript
interface CompactResult {
  bytesAfter?: number;
  bytesBefore?: number;
  compacted: boolean;
  deleted?: string[];
  error?: unknown;
  reason?: CompactRefusal;
  released?: string[];
  skipped?: string[];
  snapshot?: Uint8Array<ArrayBufferLike>;
}

Properties

Properties of CompactResult
PropertyTypeDescription
bytesAfteroptionalnumber

size of the compacted snapshot that was saved

bytesBeforeoptionalnumber

size of the complete snapshot (what onBeforeCompact received)

compactedbooleann/a
deletedoptionalstring[]

the released files whose bytes were deleted from the store (no other document used them)

erroroptionalunknown

the error behind archive-failed / save-failed / failed

reasonoptionalCompactRefusal

why nothing was compacted

releasedoptionalstring[]

files (sha256-…) no kept version references any more (removed from this document's index)

skippedoptionalstring[]

released files nobody references but whose bytes were kept for now (files.releaseGraceMs): they stay in this document's docRefs and are reconsidered by its next compaction / clearPersistence()

snapshotoptionalUint8Array<ArrayBufferLike>

the compacted (shallow) snapshot that was saved

Source: src/lib/persistence/compact.js:15