Skip to main content

crypto_database/
lib.rs

1//! crypto-database
2//!
3//! The verifiable v2/v3 distribution of NEDB: content-addressed Merkle DAG, AS OF time-travel, causal provenance, BLAKE2b tamper-evidence.
4//!
5//! Re-exports the full `nedb-engine` API unchanged. crypto-database's
6//! distribution defaults — the verifiable v3 segment store (content-addressed,
7//! self-verifying; AS OF / TRACE time-travel) — are applied by setting the
8//! engine's existing env knobs before a `Db` is opened: programmatically via
9//! [`apply_distro_defaults`], and automatically by the npm `main` shim and the
10//! `nedbd-v2` daemon shim. No engine fork, no flags.
11pub use nedb_engine::*;
12
13/// Apply crypto-database's default engine modes — the verifiable v3 segment
14/// store — unless the caller has already chosen. Call once before opening a
15/// [`Db`]. Set-if-unset: an explicit `NEDB_DAG_V3` (including `0`) always wins.
16pub fn apply_distro_defaults() {
17    if std::env::var_os("NEDB_DAG_V3").is_none() {
18        std::env::set_var("NEDB_DAG_V3", "1");
19    }
20}