Project
Rust Key-Value Database
2024
Rust
Cargo
A lightweight, in-memory key-value database built in Rust with no external dependencies.
Supports SET, GET, DELETE, LIST, and SETEX (key expiry) commands via an interactive REPL. All write operations are appended to a write-ahead log before being applied in memory, so the database survives restarts by replaying the log on startup.
Built as a deep-dive into Rust, covering ownership, borrowing, error handling with Result, and standard library I/O. The persistence model is inspired by the Bitcask paper.
Features
- ›In-memory HashMap storage with O(1) lookups
- ›Write-ahead log (WAL) for crash-safe persistence
- ›Key expiry via SETEX with TTL tracked as absolute timestamps
- ›Lazy eviction of expired keys on access
- ›Full unit test suite covering persistence and expiry