Architecture¶
The Rust server is a Cargo workspace under crates/, split so the pure
engines never depend on Python or WiredTiger:
Crate |
What it is |
|---|---|
|
The pure-Rust operator engines: query matcher, update engine, aggregation pipeline + expression evaluator, projection, sort keys, geo, collation. No PyO3, no WiredTiger — pure functions over BSON. |
|
The full WiredTiger-backed |
|
The WiredTiger FFI bindings (bindgen over the vendored C library). |
|
The server proper: wire protocol ( |
|
SCRAM-SHA-1/256 mechanics, X509 DN matching, RBAC role resolution. |
|
The standalone binary crate — |
|
Thin PyO3 binding crates: |
The WiredTiger-linked crates are excluded from the clean workspace so
cargo fmt / clippy / test run fast and toolchain-light; the WT crates
build inside the wheel (CMake + scikit-build-core) or the standalone binary
build.
Parity with the Python server¶
Every Rust operator engine is pinned byte-for-byte to its pure-Python
counterpart by parity test suites (curated corpora plus randomized fuzz).
Where an exact reproduction isn’t achievable — Python-re regex semantics,
some Decimal128 edges — the Rust engine defers: it
rejects the construct with a clean error rather than return a subtly
different answer. That discipline is why the conformance numbers of the two
servers track each other so closely.
Collation is the exception. The Rust server compares strings through ICU4X,
the Rust implementation of the algorithm and locale data mongod gets from
ICU, and is checked against mongod directly; the Python server has its own
approximation. The parity suites leave collated cases out.
Storage¶
Same model as the Python server, same on-disk schema: documents stored as
opaque BSON blobs keyed by byte-sortable _id encodings, secondary indexes
over typed sort-key columns, a natural-order (insertion) index, and the
oplog/pre-image tables that back change streams and point-in-time recovery.
A data directory written by one server opens in the other.
Versioning¶
All crates carry one lockstep version (0.MAJOR.PATCH-beta.N, SemVer
pre-release) that advances independently of the PyPI package’s version.
The canonical embedded value is secantus_server::VERSION, surfaced as
buildInfo.secantusVersion over the wire, secantusd-rs --version on the
CLI, and RustServer.version on the embedded handle. See
Releases.