You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 522c2eb
Browse filesBrowse the repository at this point in the historyBrowse files
docs: reconcile PLAN.md with the implemented, driver-agnostic project
Update PLAN.md so it accurately describes the codebase:
- §5 Public API: replace the stale DB/Litestream/Config-centric MVP sketch with
the real driver-agnostic API (Replica(path, client), Store, FileReplicaClient,
newReplicaClientFromURL, registerReplicaClientFactory, restoreV3, S3 addon).
- §4 Project layout: reflect actual files (replica-url, leaser, restore-v3,
compaction-level, stream, streaming-compactor, monorepo packages/backend-s3;
drop config.ts/types.ts/s3-dir and the old util file names).
- §0 Status + §7 Milestone 6+: track S3 addon, distributed leasing, streaming,
and legacy v0.3.x restore-read as implemented; list remaining cloud backends.
- §9 Out of scope: S3 and leasing are done; CLI/config/GCS/Azure/SFTP/NATS deferred.
- §10 + §1 table: leaser is implemented (not '(later)').
- §3/§3 step 6 LZ4 note + §8: lz4js (block + frame) is the codec; mark previously
open risks resolved; keep Go byte-parity encoding as the remaining interop gap.
- §11 Definition of done: check off all boxes (128 tests: 110 core + 18 S3).
| LZ4 codec |**`lz4js` (pure JS)** for LTX **block** format; plus a **frame** codec (`compressFrameLz4`/`decompressFrameLz4`, pureJS) for legacy v0.3.x restore-reads | LTX uses block format. `lz4js`**decompression** is Go-interoperable, but our compressed bytes are valid-yet-not-byte-identical to Go's `pierrec/lz4/v4`, so file checksums differ. The frame codec interoperates with Go `pierrec/lz4` frames. |
195
201
| CRC-64 ISO |**Implement in TS** (`src/ltx/crc64.ts`) | No good npm pkg; table-based, test against Go vectors (`"123456789"` ⇒ `b90956c775a41001`). |
196
202
| Binary buffer accumulation |`@platformatic/dynamic-buffer`*(optional)*| Nice for streaming WAL/page/index; not required for MVP (plain `Buffer` is fine). |
197
203
| Test runner |**`node:test`** + `node:assert/strict` in `.test.ts`| Built-in, runs `.ts` directly via type stripping. |
@@ -253,43 +259,54 @@ sqlite-js-stream/
253
259
PLAN.md
254
260
README.md
255
261
src/
256
-
index.ts # public entry: Litestream, DB, Replica, ReplicaClient, helpers
1.**`node:sqlite` concurrency semantics.** Whether a long-running read txn on one
561
+
1.**`node:sqlite` concurrency semantics.**✅ **resolved** (verified in `test/integration/checkpoint-concurrency.test.ts`). Whether a long-running read txn on one
519
562
`DatabaseSync` genuinely blocks WAL truncation while a **separate** connection runs
520
563
`wal_checkpoint`, and whether `PRAGMA wal_autocheckpoint` must be raised (litestream disables
521
564
SQLite's auto-checkpoint so it can control checkpoints). Must be verified in Milestone 4 with
@@ -526,16 +569,18 @@ snapshot + WAL produce the live database.
526
569
2.**Golden interoperability.** Go is not installed in the dev environment. We hand-derive fixtures
527
570
and add a Go golden generator for CI. Until goldens are committed, interop is validated by
528
571
round-trip + spec conformance only.
529
-
3.**LZ4 block vs frame.** LTX requires **block** format; `@platformatic/wasm-utils` is frame-only.
530
-
`lz4-napi` (block) and `lz4js` (block) both verified. Prefer `lz4-napi` for perf with `lz4js`
531
-
fallback, but ensure the fallback path is tested for identical decode results.
532
-
4.**CRC-64 ISO vs ECMA.****ISO must be used** (mismatch = broken interop). Provide a direct vector
572
+
3.**LZ4 block vs frame.** ✅ **both supported.** LTX uses **block** format; a pure-JS **frame**
573
+
codec (`compressFrameLz4`/`decompressFrameLz4`) was added for legacy v0.3.x restore-reads.
574
+
We use pure-JS `lz4js` for both block and frame. `lz4js`**decodes** Go-produced bytes
575
+
correctly, so decompression interop is guaranteed; only byte-identical *encoding* would require
576
+
a liblz4-compatible codec (`lz4-napi`/WASM), which is an optional future upgrade.
577
+
4.**CRC-64 ISO vs ECMA.** ✅ **resolved** – **ISO is used** (mismatch = broken interop). Provide a direct vector
533
578
test to lock this in.
534
-
5.**TXID/position persistence.**Position is derived from local L0 LTX headers (no separate pos
579
+
5.**TXID/position persistence.**✅ **resolved** – position is derived from local L0 LTX headers (no separate pos
535
580
file). Ensure we reconstruct `WALOffset`/salts on restart exactly.
536
581
6.**Type stripping limits.** No `enum`/decorators/parameter properties; use `import type`; explicit
537
582
`.ts` extensions. Add a lint guard (eslint rule or tsconfig) to prevent violations.
538
-
7.**Memory/perf on large DBs.** ✅ **Streaming implemented (post-MVP).**`restore()` streams each
583
+
7.**Memory/perf on large DBs.** ✅ **resolved** – **streaming implemented (post-MVP).**`restore()` streams each
539
584
LTX file page-by-page into the output DB (snapshot base + incremental overlay) and
540
585
`sync()`/`snapshot()` read pages from a file handle and stream the encoded LTX straight to disk
541
586
(`FileSink`); the S3 addon uses multipart upload for objects > 5 MiB. Peak memory is bounded by
@@ -551,11 +596,11 @@ snapshot + WAL produce the live database.
0 commit comments