Skip to content

Carve the engine into zigstore v1.0.0; consume it as a dependency#6

Merged
poly-glot merged 15 commits into
mainfrom
feat/zigstore-extraction
Jun 7, 2026
Merged

Carve the engine into zigstore v1.0.0; consume it as a dependency#6
poly-glot merged 15 commits into
mainfrom
feat/zigstore-extraction

Conversation

@poly-glot

Copy link
Copy Markdown
Owner

Extracts dmozdb's generic DB/server engine into the standalone zigstore library (pinned at the v1.0.0 tarball + content hash) and rewires dmozdb to consume it. Big-bang, landed as one validated PR per docs/superpowers/specs/2026-06-06-zigstore-library-extraction-design.md and its implementation plan.

What changed

  • database.zig → app Directory composing zigstore.Engine(schema)'s *Store; the 11 indexes / 6 memtables / 3 counters are now a comptime schema.
  • types.zig split into zigstore.codec + app schema.zig; changeset codec → zigstore.wire_codec; binary-protocol framing → zigstore.protocol; epoll/bootstrap → zigstore.run; gen_client_ts → a zigstore.tsgen driver.
  • 18 moved engine files deleted; dmozdb now reaches the engine only via @import("zigstore") (one-way boundary, verified).
  • Engine→app couplings inverted into runtime seams: recover hooks, spawnWorker ticks, the commit ctx callback, processFrames dispatch, SnapshotHost.

Behavior preserved

  • 193/193 tests green; the binary-protocol wire format and the generated TS client (web/lib/dmoz-protocol.gen.ts) are byte-identical; the server boots end to end (bootstrap Top=1, 5 epoll reactors).
  • The pipeline RESPONSE_RESERVE is now an app-supplied worst-case bound (restored from the regressed 64 KiB hardcode), with a regression test.

⚠️ Before deploy

  • The on-disk format changed (store.dat, schema-generated header) — production needs a data re-seed via the importer.
  • Run the Fresh + Playwright + visual check in the devcontainer (per the project contract).

Follow-ups (non-blocking)

  • Internal cleanups: add an engine Store.drainMemtable(name) seam so the app stops duplicating drainOneInner; move WAL truncate-after-checkpoint into Store.deinit to drop the shutdown double drain/flush.

@poly-glot
poly-glot merged commit 77e82e4 into main Jun 7, 2026
2 checks passed
poly-glot added a commit that referenced this pull request Jun 7, 2026
Carve the engine into zigstore v1.0.0; consume it as a dependency
@poly-glot
poly-glot deleted the feat/zigstore-extraction branch June 7, 2026 10:06
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