1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
//! # 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 is a policy orthogonal to storage ([`Durability`]):
//! [`Durability::Wal`] makes holt's own WAL the durable record
//! (single node), while [`Durability::StateMachine`] cedes
//! durability to an external log (e.g. Raft) and attaches no WAL —
//! [`DB::commit_durable`] then pins a crash-consistent on-disk
//! checkpoint and reopen replays only the log tail past
//! [`DB::durable_applied_index`]. See `ROADMAP.md` for direction.
//!
//! ## Quick taste
//!
//! ```ignore
//! 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:?}");
//! }
//! }
//! # Ok::<(), holt::Error>(())
//! ```
//!
//! ## Module map
//!
//! The supported import surface is the flat crate root:
//! [`Tree`], [`DB`], [`TreeBuilder`], [`AtomicBatch`], [`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 via
//! `const _: () = 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` — `HybridLatch` 3-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`.
// `clippy::pedantic` opt-in is on purpose — we want the high
// signal-to-noise lints firing. The blanket allows below are
// the categories we've reviewed and judged to be either
// intentional design choices in this crate or stylistic
// preferences that don't carry their weight here.
// Hard scope gate — see the "Platform support" section in the
// module docs. Building holt for Windows is intentionally
// unsupported; the file store's `O_DIRECT` / `F_NOCACHE`
// path has no Windows analog worth maintaining for this project.
compile_error!;
pub
pub
pub
pub
pub
pub
/// Prometheus text-format renderer for [`TreeStats`]. Enabled via
/// the `metrics` feature flag.
// -- Top-level re-exports -----------------------------------------
//
// The flat `holt::*` surface — every supported public name a user
// reaches for via `use holt::X` lives here.
// Core handle + configuration.
pub use TreeBuilder;
pub use CheckpointImage;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Snapshot;
pub use ;
pub use ;
// Range-scan iterator surface.
pub use ;
// Stats snapshots returned by `Tree::stats` and `DB::stats`.
pub use ;
// Single-record atomic batches.
pub use ;
// Background checkpointer policy. The `Checkpointer` handle itself
// is crate-internal; users tune or disable it via this config.
pub use CheckpointConfig;
// BlobStore trait + bundled stores + zero-copy blob buffer.
// Users implementing a custom `BlobStore` need `BlobGuid` to name
// the blob they're storing.
pub use BlobGuid;
pub use ;