SandDB is an on-disk persistent key-value store that uses Log-Structured Merge Trees (LSM-trees). The goal is to be optimized for write-heavy workloads, while still providing good read performance.
A lot of inspiration comes from RocksDB and Git's reftable.
- Read/write operations
- SSTable compaction
- Bloom filters
- Durability with WAL
- Atomicity via MVCC snapshots
- C API
- TCP server interface
SandDB organizes data across multiple levels:
- Memtable: In-memory data structure that is flushed to disk when it reaches a threshold.
- Level 0: Stored on disk as SSTables, contains the most recently flushed memtables.
- Levels 1-N: Contains tables that are merged from the previous level.
See SSTable File Specification for detailed format documentation.
The manifest file tracks available SSTables and their metadata such as level and key range.
See Manifest File Specification for detailed format documentation.
cargo build --releaseA simple CLI is provided for testing the database. This is by no means a production-ready interface.
Running:
cargo run --bin cli <database-directory>Available commands:
set <key> <value>- Store a key-value pairget <key>- Retrieve a value by keyexit- Exit the CLI
Example session:
> set user:1 "John Doe"
Key set
> get user:1
John Doe
> exit