kmb-store: Page-based B+tree projection store with MVCC
This crate provides a persistent key-value store optimized for projection state
in Kimberlite. Key features:
- B+tree indexing: Efficient point lookups and range scans
- MVCC: Multi-Version Concurrency Control for point-in-time queries
- Page-based storage: 4KB pages with CRC32 integrity checks
- Crash recovery: Superblock with applied position tracking
Architecture
┌─────────────────────────────────────────────────────┐
│ ProjectionStore (public API) │
├─────────────────────────────────────────────────────┤
│ BTree (search, insert, delete, scan with MVCC) │
├─────────────────────────────────────────────────────┤
│ PageCache (LRU cache with page-aligned I/O) │
├─────────────────────────────────────────────────────┤
│ Page Layer (4KB pages, CRC32, slot directory) │
└─────────────────────────────────────────────────────┘
Usage
use kimberlite_store::{ProjectionStore, BTreeStore, WriteBatch, WriteOp};
use kimberlite_types::Offset;
// Open or create a store
let mut store = BTreeStore::open("data/projections")?;
// Apply a batch of changes
let batch = WriteBatch::new(Offset::new(1))
.put(table_id, key, value)
.delete(table_id, other_key);
store.apply(batch)?;
// Point-in-time query
let value = store.get_at(table_id, &key, Offset::new(1))?;