ProllyTree
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.
Features
- 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
Quick Start
Add to your Cargo.toml:
[]
= "0.3.3"
# Optional features
= { = "0.3.3", = ["git", "sql"] }
Examples
Verifiable key-value store
A ProllyTree is a Merkle tree, so any key-value pair comes with a cryptographic inclusion proof.
use ;
use InMemoryNodeStorage;
let mut tree = new;
tree.insert;
let proof = tree.generate_proof;
assert!;
Git-backed versioning
The git feature stores tree nodes as Git objects, so commits, branches, and merges
work natively on key-value state.
use StoreFactory;
let mut store = ?;
store.insert?;
store.commit?;
store.create_branch?;
store.insert?;
store.commit?;
// → diff, merge, history available; see the user guide
See examples/ for SQL queries, additional storage backends, and agent
memory patterns.
Feature Flags
| 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 |
[]
= "0.3.3"
= ["git", "sql", "rocksdb_storage"]
Performance
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
Testing
# Rust tests
# Python tests (build bindings first)
Documentation & Examples
- 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
CLI Tool
See the user guide for a full CLI walkthrough.
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
License
Licensed under the Apache License 2.0. See LICENSE.