HeadlinesBriefing favicon HeadlinesBriefing.com

TurboKV: Fast Embedded Key-Value Store for Rust

Hacker News •
×

TurboKV is an async embedded key-value database for Rust featuring atomic batches, ordered range scans, configurable durability, compression, and background compaction. Install via `cargo add turbokv` with Tokio's full features. The persisted Bloom-filter format uses hardware AES; build x86/x86_64 targets with `RUSTFLAGS="-C target-feature=+aes,+sse2"` and ARM/AArch64 with `RUSTFLAGS="-C target-feature=+aes,+neon"`.

Quick start demonstrates opening a database with `Db::open_with_options("./my-database", DbOptions::durable())`, inserting keys, using `WriteBatch` for atomic puts and deletes, and scanning with `scan_prefix`. Runnable examples cover basic operations, batch writes, range queries, concurrent access, persistence, and configuration.

Three durability presets: fast() (in-memory, no WAL), durable() (WAL appended without per-write sync, recommended default), and paranoid() (WAL group synced before return). One open `Db` exclusively owns its data directory; use `close()` for clean shutdown. Keys and values are arbitrary byte sequences; mutation APIs copy inputs. All presets start with 64 MiB memtable, 64 MiB block cache, and LZ4 compression. Configuration fields include `wal_enabled`, `sync_writes`, `memtable_size`, `block_cache_size`, and `compression` (Lz4, Snappy, Zstd, or None).