Skip to content

Commit 9f5f7b3

Browse files
committed
feat: sqlite v2
1 parent 83bef30 commit 9f5f7b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+14469
-441
lines changed

.agent/research/sqlite/sqlite-vfs-ltx-redesign.md

Lines changed: 530 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"capturedAt": "2026-04-16T03:05:23.184Z",
3+
"vfsVersion": "v1",
4+
"source": "examples/sqlite-raw/scripts/benchmark.ts",
5+
"pageSizeBytes": 4096,
6+
"environment": {
7+
"benchmarkHarness": "examples/sqlite-raw wrapper over rivetkit-sqlite-native/examples/v1_baseline_bench.rs",
8+
"rttMs": 0,
9+
"storage": "in-memory SqliteKv benchmark driver exercising the v1 native VFS",
10+
"platform": "linux",
11+
"release": "6.1.0-41-amd64",
12+
"arch": "x64",
13+
"cpuModel": "12th Gen Intel(R) Core(TM) i7-12700KF",
14+
"cpuCount": 20,
15+
"totalMemoryGiB": 62.56
16+
},
17+
"workloads": [
18+
{
19+
"name": "1 MiB insert",
20+
"latencyMs": 3.614,
21+
"roundTrips": 298
22+
},
23+
{
24+
"name": "10 MiB insert",
25+
"latencyMs": 25.892,
26+
"roundTrips": 2606
27+
},
28+
{
29+
"name": "hot-row update",
30+
"latencyMs": 1.036,
31+
"roundTrips": 109
32+
},
33+
{
34+
"name": "cold read",
35+
"latencyMs": 1.729,
36+
"roundTrips": 228
37+
},
38+
{
39+
"name": "mixed read/write",
40+
"latencyMs": 0.824,
41+
"roundTrips": 62
42+
}
43+
]
44+
}

.claude/scheduled_tasks.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"sessionId":"cb4dbb44-01ef-4eef-91a8-ff5ad2f3e6fe","pid":1948414,"acquiredAt":1776308226245}

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,16 @@ When the user asks to track something in a note, store it in `.agent/notes/` by
202202

203203
## Architecture
204204

205+
### Deprecated Packages
206+
- `engine/packages/pegboard-runner/` and associated TypeScript "runner" packages (`engine/sdks/typescript/runner`, `rivetkit-typescript/packages/engine-runner/`) and runner workflows are deprecated. All new actor hosting work targets `engine/packages/pegboard-envoy/` exclusively. Do not add features to or fix bugs in the deprecated runner path.
207+
205208
### Monorepo Structure
206209
- This is a Rust workspace-based monorepo for Rivet with the following key packages and components:
207210

208211
- **Core Engine** (`packages/core/engine/`) - Main orchestration service that coordinates all operations
209212
- **Workflow Engine** (`packages/common/gasoline/`) - Handles complex multi-step operations with reliability and observability
210213
- **Pegboard** (`packages/core/pegboard/`) - Actor/server lifecycle management system
214+
- **Pegboard Envoy** (`engine/packages/pegboard-envoy/`) - The active actor-to-engine bridge. All new actor hosting work goes here.
211215
- **Common Packages** (`/packages/common/`) - Foundation utilities, database connections, caching, metrics, logging, health checks, workflow engine core
212216
- **Core Packages** (`/packages/core/`) - Main engine executable, Pegboard actor orchestration, workflow workers
213217
- **Shared Libraries** (`shared/{language}/{package}/`) - Libraries shared between the engine and rivetkit (e.g., `shared/typescript/virtual-websocket/`)
@@ -279,6 +283,11 @@ let error_with_meta = ApiRateLimited { limit: 100, reset_at: 1234567890 }.build(
279283
**Native SQLite & KV Channel**
280284
- RivetKit SQLite is served by `@rivetkit/rivetkit-native`. Do not reintroduce SQLite-over-KV or WebAssembly SQLite paths in the TypeScript runtime.
281285
- The Rust KV-backed SQLite implementation still lives in `rivetkit-typescript/packages/sqlite-native/src/`. When changing its on-disk or KV layout, update the internal data-channel spec in the same change.
286+
- The native VFS uses the same 4 KiB chunk layout and KV key encoding as the WASM VFS. Data is compatible between backends.
287+
- **The native Rust VFS and the WASM TypeScript VFS must match 1:1.** This includes: KV key layout and encoding, chunk size, PRAGMA settings, VFS callback-to-KV-operation mapping, delete/truncate strategy (both must use `deleteRange`), and journal mode. When changing any VFS behavior in one implementation, update the other. The relevant files are:
288+
- Native: `rivetkit-typescript/packages/sqlite-native/src/vfs.rs`, `kv.rs`
289+
- WASM: `rivetkit-typescript/packages/sqlite-wasm/src/vfs.ts`, `kv.ts`
290+
- SQLite VFS v2 storage keys use literal ASCII path segments under the `0x02` subspace prefix with big-endian numeric suffixes so `scan_prefix` and `BTreeMap` ordering stay numerically correct.
282291
- Full spec: `docs-internal/engine/NATIVE_SQLITE_DATA_CHANNEL.md`
283292

284293
**Inspector HTTP API**

Cargo.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ members = [
3737
"engine/packages/runner-protocol",
3838
"engine/packages/runtime",
3939
"engine/packages/service-manager",
40+
"engine/packages/sqlite-storage",
4041
"engine/packages/telemetry",
4142
"engine/packages/test-deps",
4243
"engine/packages/test-deps-docker",
@@ -107,6 +108,7 @@ members = [
107108
once_cell = "1.20.2"
108109
opentelemetry-appender-tracing = "0.28.1"
109110
papaya = "0.2.1"
111+
parking_lot = "0.12"
110112
pest_derive = "2.7"
111113
portpicker = "0.1"
112114
prettyplease = "0.2"

0 commit comments

Comments
 (0)