vsdb/lib.rs
1//! # vsdb
2//!
3//! `vsdb` is a high-performance, embedded database designed to feel like using
4//! Rust's standard collections. It provides persistent, disk-backed data
5//! structures — [`Mapx`] (a `HashMap`-like map), [`MapxOrd`] (a `BTreeMap`-like
6//! ordered map), [`VerMap`](versioned::map::VerMap)
7//! (Git-model versioned storage with branching, commits, and merge),
8//! [`MptCalc`] / [`SmtCalc`] (stateless Merkle trie implementations),
9//! [`VerMapWithProof`] (versioned storage with Merkle root computation),
10//! and [`SlotDex`] (skip-list-like index for paged queries).
11//!
12//! This crate is the primary entry point for most users.
13
14#![deny(warnings)]
15#![cfg_attr(test, allow(warnings))]
16#![recursion_limit = "512"]
17
18#[macro_use]
19pub mod common;
20
21/// User-facing, typed data structures (e.g., `Mapx`, `MapxOrd`).
22pub mod basic;
23/// Data structures for representing directed acyclic graphs (DAGs).
24pub mod dagmap;
25/// Git-model versioned storage: branches, commits, merge, and history.
26pub mod versioned;
27
28/// Skip-list-like index for efficient, timestamp-based paged queries.
29pub mod slotdex;
30
31/// Lightweight, stateless Merkle trie implementations (MPT + SMT).
32pub mod trie;
33
34// --- Re-exports ---
35
36// Basic data structures
37pub use basic::{
38 mapx::Mapx, mapx_ord::MapxOrd, mapx_ord_rawkey::MapxOrdRawKey, orphan::Orphan,
39};
40
41// Common traits and types
42pub use common::{
43 NULL,
44 ende::{KeyDe, KeyEn, KeyEnDe, KeyEnDeOrdered, ValueDe, ValueEn, ValueEnDe},
45};
46
47// DAG-related structures
48pub use dagmap::{DagMapId, raw::DagMapRaw, rawkey::DagMapRawKey};
49
50// Trie
51pub use trie::{MptCalc, MptProof, SmtCalc, SmtProof, TrieCalc, VerMapWithProof};
52
53// Slotdex — re-export SlotDex64 as SlotDex for backward compatibility;
54// the generic struct is still accessible as `vsdb::slotdex::SlotDex<S, K>`.
55pub use slotdex::{SlotDex32, SlotDex64 as SlotDex, SlotDex64, SlotDex128, SlotType};
56
57// Re-export vsdb_core crate for advanced users, plus the user-facing
58// environment management functions.
59pub use vsdb_core;
60pub use vsdb_core::{vsdb_flush, vsdb_get_base_dir, vsdb_set_base_dir};
61
62// Persistent B+ tree (moved from vsdb_core).
63pub use basic::persistent_btree::PersistentBTree;