A probabilistic B-tree implementation in Rust that combines B-tree efficiency with Merkle tree cryptographic properties. Designed for distributed systems, version control, and verifiable data structures.
- High Performance: O(log n) operations with cache-friendly probabilistic balancing
- Cryptographically Verifiable: Merkle tree properties for data integrity and inclusion proofs
- Multiple Storage Backends: In-memory, File, RocksDB, and Git-backed persistence
- Distributed-Ready: Efficient diff, sync, and three-way merge with pluggable conflict resolvers
- Python Bindings: Full API coverage via PyO3 with async support
- SQL Interface: Query trees with SQL via GlueSQL integration
Add to your Cargo.toml:
[dependencies]
prollytree = "0.3.4-beta"
# Optional features
prollytree = { version = "0.3.4-beta", features = ["git", "sql"] }A ProllyTree is a Merkle tree, so any key-value pair comes with a cryptographic inclusion proof.
use prollytree::tree::{ProllyTree, Tree};
use prollytree::storage::InMemoryNodeStorage;
let mut tree = ProllyTree::new(InMemoryNodeStorage::<32>::new(), Default::default());
tree.insert(b"user:alice".to_vec(), b"Alice".to_vec());
let proof = tree.generate_proof(b"user:alice");
assert!(tree.verify(proof, b"user:alice", Some(b"Alice")));The git feature stores tree nodes as Git objects, so commits, branches, and merges
work natively on key-value state.
use prollytree::git::versioned_store::StoreFactory;
let mut store = StoreFactory::git::<32, _>("data")?;
store.insert(b"config/api_key".to_vec(), b"v1".to_vec())?;
store.commit("Initial config")?;
store.create_branch("experimental")?;
store.insert(b"config/api_key".to_vec(), b"v2".to_vec())?;
store.commit("Try new key")?;
// → diff, merge, history available; see the user guideSee examples/ for SQL queries, additional storage backends, and agent
memory patterns.
| Feature | Description | Default |
|---|---|---|
git |
Git-backed versioned storage with branching, merging, and history | Yes |
sql |
SQL query interface via GlueSQL | Yes |
rocksdb_storage |
RocksDB persistent storage backend | No |
python |
Python bindings via PyO3 | No |
tracing |
Observability via the tracing crate |
No |
digest_base64 |
Base64 encoding for digests | Yes |
[dependencies.prollytree]
version = "0.3.4-beta"
features = ["git", "sql", "rocksdb_storage"]Benchmarks (Apple M3 Pro, 18GB RAM):
- Insert: ~8-21 us (scales O(log n))
- Lookup: ~1-3 us (sub-linear due to caching)
- Memory: ~100 bytes per key-value pair
- Batch operations: ~25% faster than individual ops
Run benchmarks: cargo bench
# Rust tests
cargo test --features "git sql"
# Python tests (build bindings first)
./python/build_python.sh --all-features --install
python -m pytest python/tests/- User Guide & Theory – mkdocs site with the full tour (theory, CLI, Python, examples)
- Rust API Reference – auto-generated from source
- Use Cases & Examples – version control, SQL, proofs, storage backends
- Python Bindings – Python-specific quickstart
cargo install prollytree --features git
git-prolly --helpSee the user guide for a full CLI walkthrough.
We welcome contributions! See CONTRIBUTING.md for guidelines.
Licensed under the Apache License 2.0. See LICENSE.