How kosumic/b-epsilon-tree works
This Rust library implements a persistent Bε-tree key/value store. A caller inserts or retrieves byte-string keys and values through the tree API: inserts become messages routed through internal nodes to leaves, while reads traverse the tree. The tree coordinates copy-on-write pages and metadata with a node cache; the cache uses a page pager for disk I/O. Serialization defines the on-disk representation. The WAL is present in metadata but appears skeletal in the sampled code. Relationships below are limited to the README and shown source; other tree operations were not fully sampled.
Main entry points: betree.rs Bε-tree API · pool.rs Node cache · superblock.rs Tree metadata · node.rs Internal nodes
Components 13
Tree engine
- Bε-tree API
src/betree.rs - Internal nodes
src/node.rs - Leaf nodes
src/node.rs - Configuration arguments
src/args.rs
Page storage
- Node cache
src/pool.rs - Page pager
src/pager.rs - Tree metadata
src/superblock.rs - Page allocator
src/allocator.rs - WAL metadata
src/wal.rs
On-disk format
- Fixed-size pages
src/page.rs - Serialization types
src/types.rs
Other components
- Library caller
- Storage file
Connections 17
- Library caller → Bε-tree API: calls API
README.md - Bε-tree API → Internal nodes: routes messages
src/betree.rs - Bε-tree API → Leaf nodes: applies messages
src/betree.rs - Bε-tree API → Node cache: loads nodes
src/betree.rs - Bε-tree API → Tree metadata: allocates pages
src/betree.rs - Bε-tree API → Page allocator: imports allocator
src/betree.rs - Internal nodes → Serialization types: serializes nodes
src/node.rs - Internal nodes → Fixed-size pages: converts pages
src/node.rs - Node cache → Page pager: reads and writes
src/pool.rs - Node cache → Fixed-size pages: converts cached nodes
src/pool.rs - Node cache → Internal nodes: caches nodes
src/pool.rs - Page pager → Storage file: reads and writes
src/pager.rs - Page pager → Fixed-size pages: transfers pages
src/pager.rs - Tree metadata → Page allocator: owns allocator
src/superblock.rs - Tree metadata → WAL metadata: stores WAL state
src/superblock.rs - Tree metadata → Fixed-size pages: serializes metadata page
src/superblock.rs - Page allocator → Serialization types: serializes counter
src/allocator.rs