Reading Guide
This page defines how to use the internals docs as a long-term memory aid.
Current Focus Areas
If you return after weeks/months, start from these questions:
- How is data physically laid out on disk?
- How is a B+tree node stored inside a page?
- How does a query become a concrete access path?
- What is the exact
.walformat and recovery state machine? - What does
.locklock, and at what granularity? - Which cryptographic primitives are used, and why these choices?
Target Documentation Shape
The internals section now follows this order:
- Architecture: module map and end-to-end data flow.
- Files, WAL, and Locking: main file /
.wal/.lockcontract. - Storage: file header, generic page layout, and freelist format.
- Catalog Format: system catalog key/value encoding and compatibility.
- B-tree: in-page node format and mutation/scan algorithms.
- Query Planning & Execution: plan selection and execution mapping.
- Cryptography: encryption/KDF details and rationale.
- WAL & Crash Resilience: transaction protocol and recovery validation.
- Durability Matrix: crash-at-each-step outcomes.
Suggested Rebuild Path (for implementers)
If you are implementing an embedded RDBMS with an LLM agent, use this order:
- Implement fixed-size pages and a pager (
storage/page.rs,storage/pager/mod.rs). - Implement B+tree on top of slotted pages (
btree/node.rs,btree/ops/mod.rs). - Add SQL parser/planner/executor (
sql/parser/*,sql/planner.rs,sql/executor/*). - Add WAL append + replay (
wal/writer.rs,wal/reader.rs,wal/recovery.rs). - Add lock manager for thread/process safety (
concurrency/mod.rs). - Add encryption suite and key derivation (
crypto/*).
Each chapter in this internals section maps directly to those steps.