Skip to main content

Crate prollytree

Crate prollytree 

Source
Expand description

§Prolly

A Prolly Tree is a hybrid data structure that combines the features of B-trees and Merkle trees to provide both efficient data access and verifiable integrity. It is specifically designed to handle the requirements of distributed systems and large-scale databases, making indexes syncable and distributable over peer-to-peer (P2P) networks.

§Features

  • Verifiability: The cryptographic hashing in Prolly Trees ensures data integrity and allows for verifiable proofs of inclusion/exclusion.
  • Performance: The balanced tree structure provides efficient data access patterns similar to B-trees, ensuring high performance for both random and sequential access.
  • Scalability: Prolly Trees are suitable for large-scale applications, providing efficient index maintenance and data distribution capabilities.
  • Flexibility: The probabilistic balancing allows for handling various mutation patterns without degrading performance or structure.

§Usage

To use prolly, add the following to your Cargo.toml:

[dependencies]
prollytree = "0.3.2"

Follow examples in the github repository to get started.

§Async/Sync Boundaries

The crate’s core storage layer (git::versioned_store) is synchronous — all operations perform blocking file I/O through the Git object database. Higher-level layers bridge this to async consumers:

LayerAPIHow it calls the sync store
git::versioned_storeSyncDirect (this is the sync core)
sql (GlueSQL)Async (#[async_trait])tokio::task::spawn_blocking
[python] (PyO3)Sync (Python FFI)py.allow_threads + Runtime::block_on
git-prolly CLISync main()Direct; Runtime::block_on for SQL only

When writing new async code that calls into the store, use tokio::task::spawn_blocking with a cloned ThreadSafeVersionedKvStore handle. See git::versioned_store module docs for examples.

Modules§

config
diff
digest
errors
git
node
proof
sql
GlueSQL custom storage implementation using ProllyTree.
storage
tree
validation
Input validation for keys and values.