Expand description
Ordered KV substrate shared by every node: buffered transactions over a committed B-tree view, atomic redb publication of expanded op sets, a serialized command log, multi-version snapshot reads, and serializable-optimistic dependency validation.
Re-exports§
pub use planner_stats::PlannerStats;
Modules§
- backend
- Narrow storage-substrate seam (research D6, plan W3).
- cache
- Byte-accounted logical caches.
- history_
v2 - Bounded, append-friendly MVCC history blocks.
- log_
store - Segmented, append-only write-ahead log (log-first).
- owner_
sets - Owner sets of declared-index leaves, cached per snapshot (READ-2).
- planner_
stats - Evictable planner-statistics cache (DC1 “on demand, evict when idle”).
- read_
accounting - Opt-in read accounting for profiling: counts the backend’s point reads,
range opens and seeks per key family (
keys::family_label). Off by default; when off, a read costs one relaxed atomic load.takereturns every thread’s reads (profile one workload at a time);take_localreturns only the calling thread’s, which stays exact while other work runs concurrently (tests). - resources
- Shared managed-byte accounting. Reservations are ownership tokens, not allocations, an RSS limit, or a substitute for charging each consumer.
- tenant_
dir - Tenant directory: scope digest ↔ 4-byte tenant ordinal.
- wal
- Record framing for the log-first storage substrate. This is the
write-ahead log:
crate::log_storeappends these framed records to segment files, and that durable append is the commit’s ack boundary (not the buffered redb materialization). See the manual’sdocs/manual/architecture/storage-engine.md.
Structs§
- Backend
Lock Times - Cumulative backend database-lock timings, summed over every shard.
- Dependency
Set - Serializable-mode read dependencies recorded against a transaction. Zero-width entries are point reads; otherwise half-open [start,end).
- Overlay
View - A pinned base snapshot plus an uncommitted key overlay.
- Prepared
Command - Prepared metadata for one admitted command. The publisher keeps this alongside expanded operations so an admission overlay can validate read/write conflicts without re-expanding the command.
- Read
Cancellation - Shared cancellation flag for one or more protected read views.
- Read
Limits - Per-read byte ceilings enforced when copying values out of the store.
- ReadPin
- One commit index’s retained read lease.
- Read
View - Owns all resources needed to read; it can outlive the Store and be shared with asynchronous providers without self-referential borrowed lifetimes.
- Scan
Batch - One batch of scan rows together with its byte accounting and done flag.
- Scan
Bounds - Byte-ordered scan bounds as an inclusive/exclusive pair.
- Scan
Cursor - Forward cursor tied to one protected view. No full candidate collection.
v2 (B7 follow-up): when the view’s current-value fast path is valid
(see
ReadView::native_range), one real backend cursor serves the whole scan — built lazily on the firstSelf::next_batchcall and held across calls (native/native_checked). Otherwise falls back to v1’s ordered seek-per-row (next_key+read_value_with_limits). Each batch plus at most one bounded lookahead row is allocated. Callers must release consumed batches; shared outstanding-byte admission is P01. - ScanRow
- One materialized scan row.
- Storage
Statistics - Durable byte accounting by key family, for growth diagnosis and operator
metrics. All values are exact sums of stored key+value lengths for the
family, taken from one read view; they exclude redb’s copy-on-write slack
(compare against
Store::storage_file_bytes). - Store
- Ordered key/value store shared by every node: admission, deterministic expansion, group-commit publication, multi-version reads, and retention.
- Temp
Path - A temporary store file or directory; see the module docs.
- TxAccumulator
- Accumulated state of one in-flight cross-service transaction. The buffer is
the transaction’s uncommitted write overlay (read-buffer-first like
Txn);depsrecords the public reads performed inside the transaction;mutations/preconditionsreplay the writes atomically at commit. - Txn
- Buffered view handed to admission/apply: reads see committed data merged with staged writes; writes stay buffered until the closure succeeds.
- Version
Entry - One superseded value of a key, covering the half-open range [from,to).
- Writer
Holds - One holder’s writer holds since the store opened.
Enums§
- Commit
Outcome - Result of a commit attempt: either the durable commit index plus the caller payload, or a conflict reason.
- Commit
Phase - One timed step of the commit pipeline. Committer-side phases are observed once per commit; publisher-side phases once per publish group.
- Compact
Outcome - What
Store::compact_if_neededdid, so a deferral is never silent. - Copy
OnWrite - Copy-on-write state of a store’s data files, reported at boot.
- Op
- Operation emitted into the atomic publish set.
- Outcome
Kind - Terminal status of a commit key, as stored durably.
- Scan
Projection - Which columns a scan should materialize for each row.
- Storage
Error - Errors returned by the storage layer: failed preconditions, corrupt or unsupported durable state, resource exhaustion, and invalid read requests.
- Writer
Holder - What holds a backend’s single writer: one redb write transaction, from
begin_writeto its commit. Every other writer waits meanwhile, so the longest holds are what stall other tenants’ commits.
Constants§
- SERIALIZABLE_
CONFLICT - Reason prefix of a
CommitOutcome::Conflictedcaused by a read dependency that a later commit wrote (first-committer-wins). - WRITER_
HOLD_ BOUNDS - Upper bounds, in seconds, of the writer-hold histogram buckets.
Traits§
- Derive
Read - Read access to the state before a commit, for a
Deriver. - Deriver
- Deterministic derivation of derived rows from a commit’s base ops.
- Replicator
- Replication seam: when installed on a
Store, local commits build the canonicalCommitBatchand route it through the leader. The leader replicates to the quorum and every node (leader included) applies it throughStore::apply_replicated_batch, which returns after the batch is durably applied locally. Serializedpayloadis stored with the outcome so idempotent retries can reproduce the caller’s response.
Functions§
- is_
usage_ bytes_ key - Whether
keyis a tenant’s usage-bytes row. - prefix_
range - Inclusive start / exclusive end range covering all keys under a prefix. An empty end bound means unbounded above.
- remove_
store - Remove the materialization file at
path. The WAL directory and layout manifest are left alone.
Type Aliases§
- Commit
Observer - Callback receiving each timed commit phase, in seconds.
- Expand
Fn - Deterministic state-machine expansion callback: derives every canonical and derived key implied by one committed batch (document 07).