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 dbfc103
Browse filesBrowse the repository at this point in the historyBrowse files
Convert to a pnpm monorepo and add an S3 upload strategy
Restructure the repository into a pnpm workspace while keeping the core
sqlite-js-stream package at the root unchanged (same API, name, and source).
Upload strategies now live as addon packages under packages/.
- Add pnpm-workspace.yaml + pnpm-lock.yaml; drop package-lock.json.
- Core package.json gains an 'exports' map ('.' -> ./src/index.ts) so addons can
import the ReplicaClient contract, plus workspace scripts (test:all /
typecheck:all). Export the Logger type so addons implement ReplicaClient.
- Root tsconfig now type-checks src/, test/, and packages/.
- Add packages/backend-s3: a sqlite-js-stream-backend-s3 addon implementing an
S3ReplicaClient (AWS SDK v3). It stores objects as
{prefix}/ltx/{level}/{min}-{max}.ltx, preserves timestamps as ltx-timestamp
metadata, supports range reads, batched deletes, and registers the s3:// URL
scheme. An injectable 'client' (S3ClientLike) makes it testable without AWS;
tests use an in-memory fake plus a full Replica.sync() -> restore() round-trip.
- CI: use pnpm (pnpm/action-setup + setup-node cache:pnpm, frozen lockfile).
- Document the workspace layout and S3 addon in README and ARCHITECTURE.
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,14 @@ prevents the WAL from being checkpointed past our position.
36
36
|**WAL module** (`src/wal/`) | Parse SQLite WAL header/frames; verify salt + checksum; produce `pageMap()` (latest committed page offsets). |
37
37
|**LocalDatabase** (`src/db.ts`, internal) | Reads a database + `-wal` directly from disk, builds LTX files (base snapshot, incremental L0, level-9 snapshot), and tracks the local position. It holds a short-lived **read-only**`node:sqlite` read transaction to **pin the WAL snapshot** (SQLite won't checkpoint/truncate past an active reader), then reads the files via `fs`. It is an internal implementation detail, not part of the public API. |
38
38
|**Replica** (`src/replica.ts`) | Upload level-0/level-9 LTX files to a client; track the replicated position; `restore()`, `ensureExists()`, `syncStatus()`. |
39
-
|**ReplicaClient** (`src/replica-client.ts`) | An interface to a storage backend (`LTXFiles`, `OpenLTXFile`, `WriteLTXFile`, `DeleteLTXFiles`, `DeleteAll`). |
39
+
|**ReplicaClient** (`src/replica-client.ts`) | An interface to a storage backend (`LTXFiles`, `OpenLTXFile`, `WriteLTXFile`, `DeleteLTXFiles`, `DeleteAll`). Addons implement this to add upload strategies. |
40
40
|**File backend** (`src/backends/file/`) | The simplest backend: store LTX files in `<root>/ltx/<level>/<min>-<max>.ltx`, atomic writes. |
|**Addons** (`packages/`) | Upload strategies live as separate workspace packages. Each addon depends on the core `sqlite-js-stream` and registers a URL scheme (e.g. `packages/backend-s3` registers `s3://`). |
43
+
44
+
> The repository is a **pnpm workspace**: the core package is at the root and
45
+
> upload-strategy addons live under `packages/*`. Addons import the `ReplicaClient`
46
+
> contract (and `registerReplicaClientFactory`) from the core.
0 commit comments