Skip to content

feat: WAL tailing and delta encoding — v0.4.0#6

Merged
mbocevski merged 1 commit into
mainfrom
feat/wal-tailing-delta-encoding
Apr 9, 2026
Merged

feat: WAL tailing and delta encoding — v0.4.0#6
mbocevski merged 1 commit into
mainfrom
feat/wal-tailing-delta-encoding

Conversation

@mbocevski

Copy link
Copy Markdown
Contributor

Summary

  • WAL tailingstore.tail() reads new operations from the WAL since the last known position. store.watch(callback, interval) polls and notifies. unwatch() and close() stop polling. Works in readOnly, single-writer, and multi-writer modes. Enables cross-process live updates.
  • Delta encoding — update operations automatically use delta encoding when the patch is smaller than the full prev record. Stores {$set, $unset} instead of full previous record. encoding: "delta" field. Undo correctly applies reverse patches.

Both features go through the StorageBackend interface — custom backends (S3, etc.) get them for free.

Test plan

166 tests (was 142). 24 new tests:

  • 7 WAL tailing tests: tail empty, tail picks up new ops, incremental tail, watch callback, unwatch, close auto-unwatches
  • 17 delta encoding tests: createDelta, applyDelta, isDeltaSmaller, Store integration (auto delta, undo with delta, reopen with delta)
  • Existing test updated for delta-aware history check
  • Build + lint clean

WAL tailing:
- store.tail() reads new ops since last known position, replays them
- store.watch(callback, interval) polls and notifies on new ops
- store.unwatch() and close() stop polling
- Works in readOnly, single-writer, and multi-writer modes
- Enables cross-process live updates via StorageBackend

Delta encoding:
- Automatic: updates use delta when patch is smaller than full prev
- Stores {, } instead of full previous record
- encoding: 'delta' field on operations
- Undo correctly applies reverse patches (applyDelta)
- Exported: createDelta, applyDelta, isDeltaSmaller, DeltaPatch

166 tests (was 142). All go through StorageBackend interface.
@mbocevski mbocevski merged commit f3282bb into main Apr 9, 2026
2 checks passed
@mbocevski mbocevski deleted the feat/wal-tailing-delta-encoding branch April 9, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant