Adds the byte-addressed File API and a multi-file FS over the block
VFS — the layer SQLite (and any other POSIX consumer) needs. FUSE
mount lands in 0.3.0; until then the API is in-process Go.
What's new
----------
- pkg/vfs/fs.go — FS with inode tree, directory ops (Mkdir, Create,
Lookup, ReadDir, Remove). Tree persisted as one encrypted JSON blob
at metadata/root.zap.age (sharded post-1.0 if/when needed).
- pkg/vfs/file.go — File handle implementing io.ReaderAt + io.WriterAt
with read-modify-write for partial-block writes, dirty buffer per
handle, Truncate (shrink and grow with zero-padding), Sync to flush
+ persist metadata, Close auto-syncs.
Testing
-------
- fs_test.go (5 tests): create/stat, dir ops, persist-across-remount,
multi-block (16 KiB / 4 blocks), partial-block read-modify-write
semantics.
- sqlite_test.go (1 test): proves a real SQLite database written
through encrypt → backend → decrypt is byte-identical and passes
`PRAGMA integrity_check ok`. Reference DB: 200 INSERTs across
4-row schema → 20480 bytes / 5 blocks. modernc.org/sqlite (pure
Go) eliminates the need for cgo in CI.
What this proves
----------------
- 4 KiB block alignment matches SQLite's default page size — zero
amplification for full-page writes.
- Partial-page writes (SQLite header updates, WAL frame headers)
hit the read-modify-write path correctly.
- File size tracking is exact bytes (not block-rounded), so SQLite
Stat() returns the right size for its `pragma page_size` math.
- Cross-mount durability: write file, close FS, re-open — bytes
survive the metadata-blob serialization round-trip.
What's next
-----------
- 0.3.0: bazil.org/fuse mount. Kernel POSIX VFS calls land at
File.{ReadAt,WriteAt,Sync,Truncate}; SQLite opens DB directly on
the mountpoint with no copy step. Linux + macOS.
- 0.4.0: NVMe disk write-back cache (configurable, survives restart).
- 0.5.0: gcs + azureblob backends.
- 0.6.0: K8s sidecar mode + Helm chart.
- 1.0.0: chunked uploads, multipart resume, GC for orphan blocks
via a refcount map at metadata/refs.zap.age, Prom/OTel metrics.
12 lines
83 B
Plaintext
12 lines
83 B
Plaintext
bin/
|
|
/vfs
|
|
*.test
|
|
*.out
|
|
.DS_Store
|
|
.idea/
|
|
.vscode/
|
|
dist/
|
|
.cache/
|
|
CLAUDE.md
|
|
AGENTS.md
|