Expand description
Embedded key-value storage engine optimized for NVMe.
Single process, multi-threaded. Sync read/write API. Each tree/map owns its storage — one tree = one database directory.
§Durability backends
Collections are generic over D: Durability (default: Bitcask):
- Bitcask — append-only log + compaction. Good for general workloads.
- FixedStore (
Fixed) — fixed-slot pwrite, no compaction. Optimized for frequent updates of fixed-size values (counters, metrics, sessions).
FixedTree and FixedMap are type aliases for ConstTree<K, V, Fixed> and
ConstMap<K, V, Fixed>. ZeroTree and ZeroMap also accept Fixed as backend.
§Collection types
| Type | Index | Values | Ordered | FixedStore | Feature |
|---|---|---|---|---|---|
ConstTree | SkipList | inline [u8; V] | yes | yes | (default) |
ConstMap | HashMap | inline [u8; V] | no | yes | (default) |
TypedTree | SkipList | typed T (in-memory, TypedRef) | yes | no | typed-tree |
TypedMap | HashMap | typed T (in-memory, TypedRef) | no | no | typed-tree |
ZeroTree | SkipList | zerocopy T (in-memory) | yes | yes | typed-tree |
ZeroMap | HashMap | zerocopy T (in-memory) | no | yes | typed-tree |
VarTree | SkipList | ByteView (disk + cache) | yes | no | var-collections |
VarMap | HashMap | ByteView (disk + cache) | no | no | var-collections |
VarTypedTree | SkipList | typed T (disk + cache) | yes | no | typed-tree + var-collections |
VarTypedMap | HashMap | typed T (disk + cache) | no | no | typed-tree + var-collections |
§Usage
// Bitcask backend (default)
let tree = ConstTree::<[u8; 16], 64>::open("data/users", Config::balanced().build())?;
// FixedStore backend
let tree = FixedTree::<[u8; 16], 64>::open("data/counters", FixedConfig::balanced().build())?;
tree.put(&key, &value)?;
let val = tree.get(&key);
tree.close()?;§Durability
§Bitcask
Writes are buffered in memory (write_buffer_size per shard, default 1 MB).
put() returns as soon as the entry is copied into the buffer and the
in-memory index is updated — no disk I/O on the write path.
This means unflushed data is lost on crash. To control durability:
flush_buffers()— flush write buffers to disk (no fsync)close()— flush + fsync + write hint files
§FixedStore
Each put() does a pwrite through the page cache (~200ns).
fdatasync is called in batches (configurable interval/count), after
releasing the shard lock. With enable_fsync = true, an additional
per-write fdatasync runs inside the shard lock for immediate durability.
No compaction, no write amplification, 1x space usage.
§Thread safety
All tree/map types are Send + Sync. Share via Arc for concurrent access:
let tree = Arc::new(ConstTree::<[u8; 8], 8>::open("data/mydb", Config::balanced().build())?);
let t = tree.clone();
std::thread::spawn(move || { t.put(&key, &value).unwrap(); });Reads:
ConstTree/ZeroTree/TypedTree— lock-free: the index is a lock-free SkipList (TypedTreeresolves the value through aseizeRCU guard, no mutex).VarTree— lock-free SkipList lookup; on a block-cache miss a brief shard lock fetches the file handles, then thepreadruns outside the lock.ConstMap/ZeroMap/TypedMap— a brief per-shard mutex guards the HashMap index. Values are inline forConst/Zero;TypedMapreads a pointer under the lock, then accesses the value lock-free via aseizeguard.VarMap/VarTypedMap— brief per-shard mutex on the index; apreadon a cache miss runs outside the lock.
Writes acquire the target key’s per-shard mutex (write buffer + index update), so writes to different shards never contend on the buffer or durability I/O. Tree writes additionally link the new node into the shared SkipList under its internal linking lock — briefly contended across shards, but the critical section is O(node height), not the full O(log n) search.
§Encryption at rest (feature encryption)
Page-level AES-256-GCM encryption. Key from env or direct config:
let key = PageCipher::key_from_env("ARMDB_KEY")?;
let config = Config::balanced().encryption_key(Some(key)).build();
let tree = ConstTree::<[u8; 16], 64>::open("data/encrypted", config)?;
// all data is transparently encrypted on disk§Write hooks (secondary indexes)
Generic WriteHook<K> / TypedWriteHook<K, T> parameter for synchronous
write and init notifications. Zero overhead when unused (NoHook default).
on_write— fires on everyput/insert/delete/cas/compare_delete/update/fetch_update, including mutations insideatomic()(buffered under the shard lock and replayed once it is released, in application order). If the closure returnsErr, hooks still fire for operations that were applied. OnConst*/Zero*collections replay happens after thesync()?seam; Var/Typed collections have no per-write sync.on_init— fires once per live entry during collection open (after recovery). Enable viaNEEDS_INIT = true. See [armdb/docs/hooks.md] for details.NEEDS_OLD_VALUE— only affects VarTree/VarMap (skips disk I/O for old value whenfalse). In-memory collections (Const/Typed/Zero) always provide the old value at zero cost.
impl WriteHook<[u8; 16]> for MyIndex {
const NEEDS_OLD_VALUE: bool = true;
const NEEDS_INIT: bool = true;
fn on_write(&self, key: &[u8; 16], old: Option<&[u8]>, new: Option<&[u8]>) {
// update secondary index incrementally
}
fn on_init(&self, key: &[u8; 16], value: &[u8]) {
// populate secondary index at startup
}
}
let tree = ConstTree::<[u8; 16], 64, MyIndex>::open_hooked("data/indexed", config, my_index)?;
tree.migrate(|_, _| MigrateAction::Keep)?; // triggers on_init for all entries§Compaction
Compaction is not automatic. Dead bytes accumulate as entries are
overwritten or deleted. Use Compactor to run it in the background:
use std::sync::Arc;
use std::time::Duration;
let tree = Arc::new(ConstTree::<[u8; 16], 64>::open("data/mydb", Config::balanced().build())?);
let t = tree.clone();
let _compactor = Compactor::start(move || t.compact(), Duration::from_secs(60));Or call tree.compact() manually when needed.
§Iteration
All Tree types provide iter(), range(), and prefix_iter() methods.
Map types (HashMap index) do not support iteration.
Each method returns a dedicated iterator implementing Iterator + DoubleEndedIterator:
| Tree | Iterator | Item |
|---|---|---|
ConstTree | ConstIter | (K, [u8; V]) — copy |
VarTree | VarIter | (K, ByteView) — RC, possible disk I/O |
TypedTree | TypedIter | (K, TypedRef<T>) — guard-protected reference, zero I/O |
ZeroTree | ZeroIter | (K, T) — copy, zero I/O |
| Method | Description |
|---|---|
iter() | All entries in index order |
range(start, end) | Entries in [start, end) — start inclusive, end exclusive |
range_bounds(start, end) | Entries with custom Bound — Included, Excluded, or Unbounded |
prefix_iter(prefix) | Entries whose key starts with prefix |
for (key, value) in tree.iter() { /* ... */ }
let latest = tree.prefix_iter(&user_id).take(20).collect::<Vec<_>>();
for (key, value) in tree.range(&start_key, &end_key) { /* ... */ }
// Custom bounds: (5, 10] — exclude 5, include 10
use std::ops::Bound;
let entries: Vec<_> = tree.range_bounds(
Bound::Excluded(&5u64.to_be_bytes()),
Bound::Included(&10u64.to_be_bytes()),
).collect();
// DoubleEndedIterator — .rev() or .next_back()
let oldest = tree.prefix_iter(&user_id).rev().take(10);
// TypedTree only: cheap scan — `&T` borrowed for the call, no per-row guard.
// `ControlFlow::Break` stops early.
tree.range(&start_key, &end_key).for_each_ref(|key, value| {
std::ops::ControlFlow::Continue(())
});§Complexity
| Operation | Complexity | Notes |
|---|---|---|
next() | O(1) | follows SkipList level-0 forward pointer |
next_back() | first step: expected O(log n); an m-row reverse walk: expected/amortized O(log n + m) | resumes a read-only SkipList predecessor staircase; a fresh iterator still seeks from the top |
iter() / range() / prefix_iter() setup | O(log n) | initial SkipList search |
The reverse bound follows the geometric p = 0.25 tower distribution; an
all-height-1 topology can fall back to the old search cost.
VarIter: both next() and next_back() may additionally perform a
pread on block-cache miss. Use warmup() to pre-populate the cache.
§Weakly-consistent semantics
Iterators do not create a snapshot. They are weakly-consistent:
- Concurrent inserts/updates may be visible during iteration
- Deleted entries (marked nodes) are automatically skipped
- The
seizeguard prevents memory reclamation for the lifetime of the iterator — no use-after-free, but the index is not frozen
§Ordering: Config::reversed
Config::reversed controls the SkipList comparator direction.
reversed | iter() / prefix_iter() | .rev() / next_back() |
|---|---|---|
true (default) | DESC (newest first) | ASC (oldest first) |
false | ASC (oldest first) | DESC (newest first) |
// reversed=true (default) — DESC: идеально для "newest first" пагинации
let tree = ConstTree::<[u8; 16], 64>::open("data/posts", Config::balanced().build())?;
let latest = tree.prefix_iter(&user_id).take(20); // newest 20
let oldest = tree.prefix_iter(&user_id).rev().take(5); // oldest 5
// reversed=false — ASC: естественный порядок ключей
let config = Config::balanced().reversed(false).build();
let tree = ConstTree::<[u8; 16], 64>::open("data/logs", config)?;
for (key, value) in tree.iter() { /* ascending order */ }Keys are stored on disk as-is. reversed can be changed between restarts
without migration — it only affects in-memory index ordering.
FixedStore collections take the same knob via FixedConfig::reversed
(default true → DESC); it behaves identically and is likewise in-memory
only.
§Prefix sharding
let config = Config::balanced().shard_prefix_bits(32).build();
let tree = ConstTree::<[u8; 16], 64>::open("data/users", config)?;§Caveats
- Iterators are weakly-consistent, not snapshot. Concurrent inserts and
updates may be visible during iteration. Deleted entries are skipped.
The
seizeguard prevents use-after-free but does not freeze the index. - CAS/update holds shard lock during possible disk I/O.
VarTree::cas,VarTree::update,VarMap::cas, andVarMap::updateread the current value under the shard mutex. On a block-cache miss this issues apread— blocking all writes to that shard until the read completes. Pre-warm the cache or size it to cover the working set. migrate()on HashMap trees allocatesO(keys/shards)memory.ConstMap::migrateandVarMap::migratecollect all shard keys into aVecbefore iterating. For very large shards this causes a transient memory spike. SkipList trees (ConstTree,VarTree) are not affected.
§Shutdown
// 1. Stop background tasks first
compactor.stop();
// 2. Close the tree (writes hint files, flushes, fsyncs)
Arc::try_unwrap(tree).expect("no other references").close()?;If close() is not called (e.g. the tree is dropped via Arc::drop),
Shard::Drop still flushes write buffers, fsyncs, and writes hint files
automatically — no data loss and no slow recovery on next startup.
§Layers above the core
The items above are the storage core. Everything built on top has its own entry point and its own document:
| Layer | Entry point | Document |
|---|---|---|
| Named collections, migrations, background workers, RPC | armour::Db | docs/armour.md |
| Ranges, pages, bulk range operations | collection.scope::<N>() | docs/iterators.md |
| Decoded-value cache | get_shared on Var typed families | docs/tuning.md |
| Cross-collection transactions | db.tx() | docs/transactions.md |
| TTL | TtlPolicy / TtlHook | docs/hooks.md |
| Secondary indexes, counters, unique namespaces, change streams | schema::SchemaRegistry | docs/schema-metadata.md |
| Durable queues | db.open_queue::<N>() | docs/queues.md |
| Realtime watches | WatchHook + watch() | docs/watch.md |
§Features
typed-tree— enablesTypedTree,TypedMap,ZeroTree,ZeroMap,Codecand codec implementationsvar-collections— enablesVarTree,VarMap(variable-length values with LRU cache)rapira-codec—RapiraCodecfor rapira serialization (impliestyped-tree)bytemuck-codec—BytemuckCodec/BytemuckSliceCodec(impliestyped-tree)bitcode-codec— [BitcodeCodec] (impliestyped-tree)postcard-codec—PostcardCodecfor postcard/serde serialization (impliestyped-tree)encryption— AES-256-GCM page-level encryption at restreplication— two independent replication stacks behind one flag: leader/follower log-shipping for Bitcask collections (replication/) and event-based slot replication for FixedStore ones (fixed_replication/; catch-up is a full slot scan on reconnect, its cursor is diagnostics-only)armour— integration with armour ecosystem:Db, schema-versioned migrations, binary RPC server (TCP/UDS). Seearmourmodule docs.rpc— TCP/UDS RPC server (impliesarmour)schema— relation metadata over collections: engine-maintained secondary indexes, counters, unique namespaces and change streams, plus the CI validator and Mermaid ER export (impliesarmour)fjall—LsmTree, an fjall-backed collection for datasets larger than RAM (impliesarmour)io-uring— io_uring flush-path backend (Linux only). Off by default: the defaultIoBackendisPwritesolana— Solana pubkey/signature key types (impliesarmour)uuid—Uuidkey typeid-cipher— enablesarmour-core/cipher(wire-level id encryption)hot-path-tracing— per-operationtracing::trace!calls
recommended is a convenience bundle for applications that embed the engine
and do not serve it over the network: it takes the default set minus rpc
(and the armour-rpc/ctrlc dependencies behind it) and minus
replication, and adds encryption. Use it with default-features = false.
Internal/test-only: parking_lot (default; without it a panic under a shard
lock poisons that mutex — see libfunc/armour#154), loom, proptest,
ctx-gates, test-faults, queue-test-support, bench-internals.
Re-exports§
pub use codec::Codec;pub use codec::InspectionEncoding;pub use codec::RapiraCodec;pub use codec::ZerocopyCodec;pub use codec::BytemuckCodec;pub use codec::BytemuckSliceCodec;pub use codec::BytemuckVec;pub use compaction::Compactor;pub use fixed::FixedConfig;pub use fixed::FixedMap;pub use fixed::FixedTree;pub use fixed::FixedWorkload;pub use armour_core;pub use zerocopy;
Modules§
- armour
- Integration with the armour ecosystem (feature
armour). - codec
- compaction
- docs
- In-depth documentation for armdb.
- durability
- Durability trait — abstracts Bitcask (append-only log) and FixedStore (fixed-slot pwrite) backends behind a common interface.
- fixed
- fixed_
replication - Replication for the FixedStore backend.
- replication
- schema
- Schema metadata, relation registry, CI validator and ER export. Spec: docs/superpowers/specs/26-06-11-armdb-schema-metadata.md
Macros§
- const_
map - Expands to
ConstMap<<V as CollectionMeta>::SelfId, { size_of::<V>() } [, H, D]>. - const_
tree - Expands to
ConstTree<<V as CollectionMeta>::SelfId, { size_of::<V>() } [, H, D]>. - format_
step - Declare a typed value-format migration step.
- impl_
key_ bytemuck - Implement
Keyfor a type that derivesbytemuck::{Pod, Zeroable}. - impl_
key_ zerocopy - Implement
Keyfor a type that deriveszerocopy::{FromBytes, IntoBytes, Immutable}. - queue
- Declare a durable queue marker type.
- typed_
map - Expands to
TypedMap<<V as CollectionMeta>::SelfId, V, C [, H]>. - typed_
tree - Expands to
TypedTree<<V as CollectionMeta>::SelfId, V, C [, H]>. - unique_
index - Declare a unique namespace type: a
#[repr(transparent)]newtype overUniqueRowcarrying aCollectionMetaimpl (TTL wired to the row’s ownexpires_atviaUniqueRow::deadline) andUniqueNamespace. - var_map
- Expands to
VarMap<<V as CollectionMeta>::SelfId [, H]>. - var_
tree - Expands to
VarTree<<V as CollectionMeta>::SelfId [, H]>. - var_
typed_ map - Expands to
VarTypedMap<<V as CollectionMeta>::SelfId, V, C [, H]>. - var_
typed_ tree - Expands to
VarTypedTree<<V as CollectionMeta>::SelfId, V, C [, H]>. - zero_
map - Expands to
ZeroMap<<V as CollectionMeta>::SelfId, { size_of::<V>() }, V [, H, D]>. - zero_
tree - Expands to
ZeroTree<<V as CollectionMeta>::SelfId, { size_of::<V>() }, V [, H, D]>.
Structs§
- Byte
View - Immutable byte slice: inline up to 20 bytes, heap-allocated with reference counting for larger. Total size: 24 bytes on 64-bit systems, alignment: 8.
- Cache
Config - Configuration for the value cache used by
VarTree. - Chunked
Page - A page of projected items and the cursor for its continuation.
- Claim
Sink - Buffer + budgets + declared target table for one claim-projection
evaluation. Mirrors
crate::ProjectionSinkin shape and in how it accounts its budget: one row,key.len() + size_of::<UniqueRow>()bytes per claim, against the sameDbError::ProjectionBudgetExceeded. - Coalesced
Merge - Iterator returned by
MergeSorted::coalesce_equal. - Config
- Database configuration.
- Const
Iter - Iterator over entries in a
ConstTree. Returned byiter(),range(), andprefix_iter(). - Const
Map - A map with fixed-size keys and values. All values are stored inline in a per-shard HashMap.
Reads never touch disk — zero I/O reads. O(1) lookup instead of O(log n) SkipList.
Ordered iteration is available when opened with
Config::iterable(true)viaiter_view; otherwise useConstTreefor prefix/range scans. - Const
MapIter View - View over an iterable
ConstMap; exposes ordered iteration over(K, [u8; V])entries and cheap keys-only iteration. Obtained viaConstMap::iter_view. - Const
MapKey Iter - Key-only iterator over an iterable
ConstMapscan. - Const
MapRow Iter - Row iterator over an iterable
ConstMapscan. - Const
MapShard - Handle for atomic multi-key operations within a single shard.
Obtained via
ConstMap::atomic. The shard + index locks are held for the lifetime of this struct — keep the closure short. - Const
Shard - Handle for atomic multi-key operations within a single shard.
Obtained via
ConstTree::atomic. The shard lock is held for the lifetime of this struct — keep the closure short. - Const
Tree - A tree with fixed-size keys and values. All values are stored inline in SkipList nodes. Reads never touch disk — zero I/O reads.
- Const
Tree KeyIter - Key-only iterator over a
ConstTreescan. - Const
Tree RowIter - Row iterator over a
ConstTreescan. - Counter
Sink - Buffer + budgets + declared target table for one source’s projection
evaluation (mirrors
crate::projection::ProjectionSink). - Counter
Targets - A declared set of counter targets, built with
CounterTargets::with_counterandCounterTargets::one_of. - Emit
Sink - Admission and buffering sink for one source transition.
- Fenced
Shard - A shard that owes an unapplied committed write.
- Fixed
Queue Mode - Marker selected by the default
queue!declaration. - Flusher
- Background periodic-flush handle. Stops and joins its thread on
stop()orDrop. - Format
Migration - One declared value-format transition.
- Format
Migration Report - Summary returned by an explicit format migration run.
- Index
Targets - Static participant set for one source declaration.
- KeyPage
- Keys-only pagination result, returned by
keys_paginate. Carries no values, so it is cheap to produce even forVarMap/VarTypedMap(no off-disk read). - Lease
Token - Capability authorizing an acknowledgement or retry of one leased row.
- Leased
Entry - A payload claimed by a successful lease operation.
- MapKey
Iter - Key-only iterator over an iterable
TypedMapscan. - MapRow
Iter - Row iterator over an iterable
TypedMapscan. - MapScan
- Opaque Map scan view. No public constructor.
Vis typically&'a S: ShardSource. - Mapped
Page - One page of mapped rows returned by
Scope::page_by. - Merge
Sorted - Lazily merges homogeneous sources that are already ordered for
dir. - NoHook
- Default no-op hook. All branches are eliminated at compile time.
- OneOf
Builder - Builder for a
one_ofgroup — started byCounterTargets::one_of. - Page
- One page of key/value entries returned by
paginate. - Page
Spec - Configuration for bounded pagination over prepared row chunks.
- Pending
Projection - Encoded index rows and counter deltas computed before apply. Index rows are
safe to retry idempotently; counter deltas are not — re-applying a
delta that already landed double-counts.
apply_or_incomplete’s returned remainder always excludes whatever already applied, for both halves. - Progress
- The result of one
Scope::delete_up_tocall. - Projected
- Write-hook carrier for a projecting source: maintains secondary indexes (Task 8), engine-maintained counters (T9), and, since T10 Task 3, unique-namespace claims — a source may legitimately need any combination of the three, so this holds one target set + one projection closure per kind rather than requiring nested hooks.
- Projection
Sink - Buffer + budgets + declared target table for one
projectevaluation. - Queue
- Opaque handle to an engine-owned durable queue.
- Queue
Config - Runtime policy for a durable queue.
- Queue
Due - Runtime-agnostic future that resolves once queue work can be leased.
- Queue
Key - Physical key for a queue header row, ordered by class, visibility, then id.
- Queue
Stats - Read-only operational counters for one queue process lifetime.
- Queue
Targets - Declared destination queues for one source’s change stream.
- Recv
Future - Future returned by
WatchReceiver::recv. - Scope
- Field-granular prefix / range / page builder. Opaque.
- Selection
- Result of selecting source operations for a transactional range deletion.
- Shutdown
Signal - Shared shutdown signal for coordinating graceful termination of background workers (compactor, replication, RPC).
- Sweep
Outcome - Result of one TTL sweep pass on a collection.
- Sweep
Pass Result - Aggregated result of one worker tick across all collections.
- Sweeper
- Background periodic TTL sweep handle. Stops and joins its thread on
stop()orDrop. - Tree
KeyIter - Key-only iterator over a skiplist
TypedTreescan. - Tree
Meta - Metadata about a named tree/map collection.
- Tree
RowIter - Row iterator over a skiplist
TypedTreescan. - Tree
Scan - Opaque Tree/LSM scan view. No public constructor.
- TtlHook
- Outermost hook installed by managed
Dbopeners. - TtlPolicy
- Compile-time TTL policy for a
CollectionMetatype. - Tx
- TxConfig
- Configuration for crash-atomic multi-collection transactions.
- TxScope
- Arc-owned typed prefix/range builder for transactional deletion.
- Typed
Counter Target - One declared counter: the target collection plus the application’s
read(stored value -> counter) andapply(new count -> write decision) closures. - Typed
Iter - Iterator over entries in a
TypedTree. Returned byiter(),range(), andprefix_iter(). - Typed
Map - A map with fixed-size keys and typed values
T. Values are encoded via aCodecfor disk persistence but stored asTin memory — reads never touch disk and returnTypedRef<T>(guard-protected reference). - Typed
MapIter View - View over an iterable
TypedMap; exposes ordered iteration yielding guard-protectedTypedRefvalues. - Typed
MapShard - Handle for atomic multi-key operations within a single shard.
Obtained via
TypedMap::atomic. The shard + index locks are held for the lifetime of this struct — keep the closure short. - Typed
Ref - Guard-protected reference to a typed value inside a
TypedTree. - Typed
Shard - Handle for atomic multi-key operations within a single shard.
Obtained via
TypedTree::atomic. The shard lock is held for the lifetime of this struct — keep the closure short. - Typed
Tree - A tree with fixed-size keys and typed values
T. Values are encoded via aCodecfor disk persistence but stored asTin memory — reads never touch disk and returnTypedRef<T>(guard-protected reference). - Unique
Index - A unique namespace:
key -> owner, engine-owned rows, no public write API. See the module docs for why this is not acrate::ProjectableIndex. - Unique
Owner - Who holds a key: a source collection and its row key, plus the deadline when the hold is a reservation.
- Unique
Row - The engine-owned value of every unique namespace row.
- Unique
Targets - The set of unique namespaces one source may claim into, declared on a
crate::schema-style registry before the source is opened. Mirrorscrate::IndexTargetsin shape: a smallVecof erased handles, looked up byUniqueIndex::name. - VarIter
- Iterator over entries in a
VarTree. Returned byiter(),range(), andprefix_iter(). - VarMap
- VarMap
KeyIter - Key-only iterator over an iterable
VarMapscan. - VarMap
RowIter - Row iterator over an iterable
VarMapscan. - VarMap
Shard - Handle for atomic multi-key operations within a single shard.
Obtained via
VarMap::atomic. The shard + index locks are held for the lifetime of this struct — keep the closure short. - VarQueue
Mode - Marker selected by the
varqueue!declaration. - VarShard
- Handle for atomic multi-key operations within a single shard.
Obtained via
VarTree::atomic. The shard lock is held for the lifetime of this struct — keep the closure short. - VarTree
- A tree with fixed-size keys and variable-length values.
Values are stored as
ByteView(inline ≤20 bytes, heap with ref counting for larger). Disk reads are cached at 4096-byte block granularity viaBlockCache. - VarTree
KeyIter - Key-only iterator over a
VarTreescan. - VarTree
RowIter - Row iterator over a
VarTreescan. - VarTyped
Hook Adapter - Adapter: wraps a
TypedWriteHook<K, T>and implementsWriteHook<K>by decoding raw bytes toTvia aCodec. Used byVarTypedTree/VarTypedMapso their users get typed hook callbacks. - VarTyped
Iter - Iterator over entries in a
VarTypedTree. Returned byiter(),range(),range_bounds(), andprefix_iter(). WrapsVarIterand decodes each value via the codec. Entries with decode errors are skipped (seetracing::debug!). - VarTyped
Map - A map with fixed-size keys and typed values
T. Values are encoded via aCodecand stored on disk (variable length), with a block cache (≤ 8 KB values) and a value cache (> 8 KB values) for reads. Uses per-shard HashMap for O(1) lookup. Ordered scans are available when opened withiterable(true)viaiter_view. UseVarTypedTreefor prefix/range scans without the iterable flag. - VarTyped
MapIter View - View over an iterable
VarTypedMap; exposes ordered iteration yielding freshly decodedTvalues. - VarTyped
MapKey Iter - Key-only iterator over an iterable
VarTypedMapscan. - VarTyped
MapRow Iter - Row iterator over an iterable
VarTypedMapscan. - VarTyped
MapShard - Handle for atomic multi-key operations on a single shard of a
VarTypedMap. Obtained viaVarTypedMap::atomic. The shard + index locks are held for the lifetime of this struct — keep the closure short. - VarTyped
Shard - Handle for atomic multi-key operations within a single shard.
Obtained via
VarTypedTree::atomic. The shard lock is held for the lifetime of this struct — keep the closure short. - VarTyped
Tree - A tree with fixed-size keys and typed values
T. Values are encoded via aCodecand stored on disk (variable length), with a block cache (≤ 8 KB values) and a value cache (> 8 KB values) for reads — unlikeTypedTreewhich keeps values in memory. - VarTyped
Tree KeyIter - Key-only iterator over a
VarTypedTreescan. - VarTyped
Tree RowIter - Row iterator over a
VarTypedTreescan. - Watch
Event - A decoded view of one shared raw watch event.
- Watch
Hook - Runtime carrier that adds subscriptions around an existing collection hook.
- Watch
Options - Per-subscription bounded-ring configuration.
- Watch
Receiver - A single-consumer subscription receiver.
- Zero
Hook Adapter - Adapter: wraps a
TypedWriteHook<K, T>and implementsWriteHook<K>by converting raw bytes to&Tvia zerocopy. Used by ZeroTree/ZeroMap so their users get typed hook callbacks. - Zero
Iter - Iterator over entries in a
ZeroTree. WrapsConstIterand converts[u8; V]values toTvia zerocopy. - ZeroMap
- A map with fixed-size keys and zerocopy-compatible typed values.
- Zero
MapIter View - View over an iterable
ZeroMap; exposes ordered iteration over(K, T)entries and cheap keys-only iteration. Obtained viaZeroMap::iter_view. - Zero
MapKey Iter - Key-only iterator over an iterable
ZeroMapscan. - Zero
MapRow Iter - Row iterator over an iterable
ZeroMapscan. - Zero
MapShard - Handle for atomic multi-key operations within a single shard.
Obtained via
ZeroMap::atomic. - Zero
Shard - Handle for atomic multi-key operations within a single shard.
Obtained via
ZeroTree::atomic. - Zero
Tree - A tree with fixed-size keys and zerocopy-compatible values.
- Zero
Tree KeyIter - Key-only iterator over a
ZeroTreescan. - Zero
Tree RowIter - Row iterator over a
ZeroTreescan.
Enums§
- Applied
- What actually happened to one key — a self-sufficient application event
channel (
old+neware present here, so duplicating anon_writehook is optional). - DbError
- P2-4:
#[non_exhaustive]so future variants are additive — downstream crates must include a wildcard arm, and adding a variant (likeDuplicateCollection) is no longer a source-breaking change to their exhaustive matches. - Dir
- Iteration direction for ordered scans.
- Format
Action - Decision returned by one value-format migration step.
- Format
Migration Policy - Policy controlling whether an opener runs a pending value-format migration.
- IoBackend
- Bitcask flush-path I/O strategy. Tunable; in-memory effect only — the
on-disk format is identical regardless. Default:
Pwrite. - Migrate
Action - Action returned by the
migrate()callback for each entry. - OnMissing
Target - What to do when the target row a contribution names does not exist.
- Schema
Mismatch Kind - Specific kind of schema mismatch (see
DbError::SchemaMismatch). - Stop
Reason - Why a chunked page stopped reading rows.
- TxFail
Stage - Which step after the transaction log append failed.
- Upsert
- A write decision for one key.
- Watch
Error - Receiver outcomes that are not decoded-value errors.
- Watch
Kind - Delivery detail available from a raw mutation.
- Workload
- Bitcask deployment-intent presets for
Config. Pick one as the builder start point:Config::for_workload(Workload::…)or a sugar method.
Constants§
- DEAD_
CLASS - DEFAULT_
MAX_ PROJECTED_ BYTES - DEFAULT_
MAX_ PROJECTED_ ROWS - Defaults: 4096 rows / 1 MiB encoded payload per
projectcall. - ID_
BLOCK - LIVE_
CLASS - UNIQUE_
OWNER_ KEY_ CAP - Owner-key capacity. A format constant: the widest key in the measured consumer is 48 bytes, this leaves one 8-byte component of headroom.
Traits§
- Bulk
Scan - Sealed strict scan and mutation seam used by bulk
Scopeoperations. Implemented only for the opaque tree and map scan wrappers. - Collection
Meta - Trait for types that carry enough metadata to describe an armdb collection.
- Counter
Collection - A collection that can hold a counter field. Implemented for the typed
managed families in Task 3; sealed through
IndexKeyed’s own seal. - Index
Keyed - Associated key/value types for typed
row/keyhelpers. - Into
Upsert - Converts a closure result into an
Upsertdecision plus an optional caller-facing value. - Key
- Key metadata trait — describes key encoding for armdb collections.
- Location
- Marker trait for disk location types stored in SkipList nodes. DiskLoc (12 bytes) for Bitcask, u32 (4 bytes) for FixedStore slot_id.
- Ordered
Scan - Ordered, direction-aware scan seam. Implemented only on
TreeScan/MapScan— never on collection types directly — so a non-iterable Map cannot obtain a value of this trait. - Owned
Rows - Projectable
Index - Crate-public seam every index family implements (Bitcask + Fixed Zero*, Typed*, VarTyped*).
Lives in core so
Projecteddoes not depend onfeature = "schema". - Queue
Mode - Selects the storage representation for a
QueueSpec. - Queue
Spec - Compile-time declaration of a durable queue.
- Strict
Rows - Sealed strict row seam used by bulk retention operations.
- Typed
Write Hook - Typed write hook for
TypedTree. - Unique
Namespace - Implemented only by
unique_index!. The bound that keepscrate::armour::Db::open_unique_indexfrom being aimed at an ordinary collection. - Watch
Decoder - Decode a raw watch payload on the receiving side.
- Watch
Spec - The collection identity and decoder used by a watch receiver.
- Write
Hook - Trait for receiving write notifications from tree/map operations.
Functions§
- boxed
- Erase an iterator type for use as a
BoxedRows. - collection_
tag - FNV-1a over the collection name.
constso a declaration can compute the tag ofT::NAMEat compile time. - merge_
sorted - Lazily merge sources that are already ordered for
dir. - page_
chunks - Collect a bounded page while preparing rows in chunks before projection.
Type Aliases§
- Batch
Write Deprecated - Renamed to
Upsertin 0.8.0, so one decision type covers bothupsertandupdate_many. - Boxed
Rows - Iterator-erased rows for callers with heterogeneous source types.
- DbResult
- Format
Step Fn - Byte-to-byte callback used by a format migration step.
- Indexed
Deprecated - Deprecated alias — kept one release for downstream. Internal crate code
uses
Projecteddirectly (seeprojection::Indexed). Renamed fromIndexed(T9): the carrier now holds a counter projection alongside the index one. Kept one release for downstream — internal code must useProjecteddirectly, since a hit here fails the crate’s-D warningsclippy gate.