Crate map
The crates of the Raft DB workspace, what each one is for, what it depends on, and the numeric targets kept in raftdb-core.
| Crate | Purpose | Page |
|---|---|---|
raftdb-core | Numeric targets shared by the benchmarks and the engine | below |
raftdb-doc | Binary document format, read in place | raftdb-doc |
raftdb-table | Hash index: 64-bit hash to 32-bit slot | raftdb-table |
raftdb-store | In-memory key-to-document collection | raftdb-store |
raftdb-bloom | Cache-local bloom filter | raftdb-bloom |
raftdb-spsc | Lock-free one-producer one-consumer ring | raftdb-spsc |
raftdb-schema | Document schema and type checking | raftdb-schema |
raftdb-exec | Filter plans, batched executor, SQL subset | raftdb-exec |
raftdb-index | Secondary index (candidate generator) | Secondary indexes |
raftdb-wal | Write-ahead log with group commit | raftdb-wal |
raftdb-db | Durable table: schema, store, log, checkpoint | raftdb-db |
raftdb-lsm | Disk-resident engine (log-structured merge tree) | The LSM engine |
raftdb-mvcc | Row-version header and snapshot visibility | MVCC |
raftdb-proto | Wire protocol codec | raftdb-proto |
raftdb-client | Blocking Rust client | raftdb-client |
raftdb-server | The server program | raftdb-server |
raftdb-raft | Raft consensus core (pure state machine) | Raft |
raftdb-watch | The watcher program | Watcher |
raftdb-report | Fatal-error reports | Watcher |
raftdb-sim | Deterministic simulation | Simulation tests |
raftdb-bench | Benchmark harness | below |
raftdb-mysql | MySQL/MariaDB front-end program | Front-end |
raftdb-core: targets#
raftdb-core has no dependencies and #![forbid(unsafe_code)]. It holds the numeric targets of the requirements document as constants (targets), so the benchmark harness and the engine cannot drift apart. Changing a value is a requirements change; compile-time asserts reject nonsense and a test checks that all are positive.
| Constant | Value |
|---|---|
DOC_OVERHEAD_MAX_BYTES | 16 |
INDEX_ENTRY_MAX_BYTES | 24 |
IDLE_CONNECTION_MAX_BYTES | 2048 |
DOC_BYTES_VS_JSON_MAX_RATIO | 0.5 |
DOC_BYTES_VS_BSON_MAX_RATIO | 0.8 |
S1_FIELD_GETS_PER_SEC_1CORE | 20 M |
S1_POINT_READS_PER_SEC_1CORE | 5 M |
S3_SCAN_DOCS_PER_SEC | 50 M |
S3_PLAN_CACHE_HIT_MICROS | 5 |
S4_DURABLE_INSERTS_PER_SEC | 300 k |
S9_FAILOVER_SECONDS | 5 |
These are targets, not results. Where a target was missed the crate page says so (for example the acknowledgement latency in raftdb-db).
raftdb-bench: the harness#
raftdb-bench <suite> [--n N] [--out DIR] [--enforce] is a library and a binary. It is the one crate allowed to have dependencies (hdrhistogram, serde, serde_json, hashbrown) because it is not part of the engine. Suites: memory-baseline, doc-format, exec-filter, wal, shard, bloom, mvcc, server, index, proto, db, schema, store, sim, portable. Each writes a JSON report with the host, the rustc version and the git commit, and compares metrics with targets taken from raftdb-core::targets.
Dependency rules#
The engine crates (raftdb-doc, raftdb-table, raftdb-store, raftdb-wal, raftdb-db and so on) use only the Rust standard library and each other. The MySQL front-end depends only on workspace crates (raftdb-proto for SHA-256, raftdb-exec for the JSON reader and writer, and the server crate when it runs in one process), and no engine crate depends on it (D52).