Function createDeltaChangeset

Compute a checkpoint-relative binary diff changeset using bsdiff.

baseState is the checkpoint's full data blob (the snapshot at the base checkpoint version). currentState is the full document state at the new version being saved as a delta.

Returns an encoded changeset (Uint8Array) suitable for use as Delta.payload. bsdiff finds matching blocks even when they shift offsets, which is critical for SQLite databases where internal page reordering makes simple byte-level diffs ineffective.

Use this when constructing Delta objects for the VersionGraph before calling writeDocumentState() and streaming the resulting payload chunks.

  • Parameters

    • baseState: Uint8Array
    • currentState: Uint8Array

    Returns Promise<Uint8Array<ArrayBufferLike>>