Crate holt
Expand description
§holt — adaptive radix tree metadata storage engine
holt is an embedded Rust library that stores path-shaped
metadata with sub-microsecond lookups, per-blob concurrency,
and crash-safe persistence. It is built around an Adaptive
Radix Tree that spans multiple 512 KB blob frames.
See README.md for the elevator pitch and ARCHITECTURE.md
for the deep dive.
§Current status
All core layers — layout, walker (insert / lookup / erase /
range / spillover / compact / merge), persistent store
(O_DIRECT + optional io_uring), WAL with replay, sharded
buffer manager, background checkpointer, copy-on-write
snapshots — are in place and covered by integration + property
tests.
Durability::Wal controls how Holt acknowledges its local
write-ahead log. File-backed trees replay that WAL on open; manual
and background checkpoints make older log records redundant.
§Quick taste
use holt::{RangeEntry, TreeBuilder};
let tree = TreeBuilder::new("/var/lib/myapp/meta.holt").open()?;
tree.put(b"img/01.jpg", b"rgb_data")?;
let v: Vec<u8> = tree.get(b"img/01.jpg")?.unwrap();
for entry in tree.scan(b"img/").into_iter().take(10) {
if let RangeEntry::Key { key, value, .. } = entry? {
println!("{key:?} -> {value:?}");
}
}§Module map
The supported import surface is the flat crate root:
Tree, DB, TreeBuilder, AtomicBatch, AtomicErrorKind,
Record, RecordVersion, View, Snapshot, KeyPathBuf,
KeyPrefixBuf, range iterator types, stats snapshots, and the optional
metrics renderer.
All implementation modules are crate-private. This keeps the on-disk format, WAL codec, walker, and buffer-manager internals free to change in minor releases without breaking downstream code.
Internal modules (pub(crate), not part of the SemVer surface):
layout— extern struct layouts (BlobHeader, SlotEntry, per-NodeType bodies). Pinned at compile time viaconst _: () = assert!(...)blocks per file.journal— WAL codec + replay scanner + writer.store— buffer manager + blob-frame allocator + store trait machinery. The supported store surface (BlobStore,MemoryBlobStore,FileBlobStore,AlignedBlobBuf) is re-exported at the crate root for users who want to plug in a custom store.engine— recursive walker (insert / lookup / erase / scan / rename / compact). Record and key-only range iterator types and stats snapshots are re-exported at the crate root.concurrency—HybridLatch3-mode lock plus the tree-wide maintenance gate.checkpoint— 3-thread background checkpointer for dirty blob drain, WAL flush/truncate, and cache eviction.
§Platform support
holt is Unix-only by design: Linux (O_DIRECT fast path,
io_uring on the file store) and macOS (F_NOCACHE).
Windows is out of scope and the crate refuses to compile there
— see the platform stance in ROADMAP.md.
Modules§
- metrics
- Prometheus text-format renderer for
TreeStats. Enabled via themetricsfeature flag. Prometheus text-format renderer forTreeStats.
Structs§
- Aligned
Blob Buf - A heap-allocated, 4 KB-aligned,
PAGE_SIZE-byte buffer. - Atomic
Batch - Builder for an atomic batch. See
super::tree::Tree::atomic. - Blob
Stats - Per-blob counters captured by
Tree::stats. - Checkpoint
Config - Background checkpointer policy + cadence.
- Checkpoint
Image - A serialized whole-
DBcheckpoint. See the module docs. - Checkpointer
Stats - Snapshot of the background checkpointer’s accumulated
counters. Returned inside
TreeStats::checkpointerwhen the thread group is enabled. All counters are cumulative since the threads were spawned. - DB
- A storage instance containing multiple named
Treeroots. - DBAtomic
Batch - Builder for
DB::atomic. - DBStats
- DB-wide resource counters from
DB::stats. - DBView
- Immutable read transaction over one or more named tree scopes.
- File
Blob Store - NVMe-backed, O_DIRECT, single-packed-file blob store.
- Journal
Anchor - One position in an application’s hash-chained recovery stream.
- Journal
Envelope - Opaque application recovery bytes anchored before and after one DB batch.
- Journal
Envelope Page - One bounded page of attached recovery envelopes.
- Journal
State - Checkpointed and live positions of one attached recovery stream.
- Journal
Stats - Snapshot of WAL append and sync counters.
- KeyPath
Buf - Owned builder for slash-separated byte keys.
- KeyPrefix
Buf - Owned slash-terminated scan prefix.
- KeyRange
Builder - Builder produced by
crate::Tree::range_keys. - KeyRange
Iter - Active key-only iteration state — see
KeyRangeBuilder::into_iter. - KeyScan
Outcome - Result of a borrowed key-only range visit.
- Memory
Blob Store - Concurrent in-memory blob store.
- Open
Stats - Reopen-time recovery telemetry captured while opening a tree.
- Prefix
Count - Bounded count of live keys under a prefix.
- Prefix
Record - Longest-prefix lookup result.
- Range
Builder - Builder produced by
crate::Tree::range. - Range
Iter - Active iteration state — see
RangeBuilder::into_iter. - Record
- Value plus the live record version observed by one lookup.
- Record
Version - Opaque per-record version returned by
Tree::get_version. - Route
Cache Stats - Prefix-route-cache counters captured by
Tree::stats. - Scan
Stats - Per-scan work accounting for a single range cursor.
- Snapshot
- A stable copy-on-write snapshot of a tree or prefix subtree.
- Store
Stats - Store-level space and slot counters.
- Tree
- An
holttree — your handle to one metadata store. - Tree
Builder - Fluent constructor for
Tree. - Tree
Config - Configuration passed to
crate::Tree::open. - Tree
Stats - Tree-wide aggregate counters from
Tree::stats. - Vacuum
Stats - Physical space reclaimed by an explicit vacuum pass.
- View
- Immutable read transaction over one captured prefix.
- View
KeyRange Builder - Key-only range builder scoped to a
View. - View
Range Builder - Record range builder scoped to a
View.
Enums§
- Access
Mode - Access policy for a file-backed tree.
- Atomic
Error Kind - Whether a failed
crate::DB::atomiccall may have applied its batch. - Durability
- How Holt’s local write-ahead log is acknowledged.
- Error
- Top-level error type covering the union of every failure mode.
- Journal
Envelope Error - Validation failure while constructing an attached journal envelope.
- KeyPath
Error - Error returned when a path-shaped key segment is not valid.
- KeyRange
Entry - An entry yielded by
KeyRangeIter. - KeyRange
Entry Ref - Borrowed key-only range entry passed to
KeyRangeBuilder::visit. - PutOutcome
- Per-key result of
Tree::put_many_if_absent. - Range
Entry - An entry yielded by
RangeIter. - Storage
- Where the tree’s data lives.
Constants§
- JOURNAL_
DIGEST_ BYTES - Byte width of a journal anchor digest.
- MAX_
JOURNAL_ RECORD_ BYTES - Maximum encoded size of one WAL record accepted by Holt.
Traits§
- Blob
Store - A blob-granular storage interface.