Exonum MerkleDB
Exonum MerkleDB is a persistent storage implementation based on RocksDB which provides APIs to work with merkelized data structures.
Available Database Objects
Entry
is a specific index that stores only one value. Useful for global values, such as configuration. Similar to a combination ofBox
andOption
.ListIndex
is a list of items stored in a sequential order. Similar toVec
.SparseListIndex
is a list of items stored in a sequential order. Similar toListIndex
, but may contain indices without elements.MapIndex
is a map of keys and values. Similar toBTreeMap
.ProofListIndex
is a Merkelized version ofListIndex
that supports cryptographic proofs of existence and is implemented as a Merkle tree.ProofMapIndex
is a Merkelized version ofMapIndex
that supports cryptographic proofs of existence and is implemented as a binary Merkle Patricia tree.KeySetIndex
andValueSetIndex
are sets of items, similar toBTreeSet
andHashSet
accordingly.
Usage
Include exonum-merkledb
as a dependency in your Cargo.toml
:
[]
= "0.12.0"
If you need only to read the data you can create Snapshot
. Objects
created from Snapshot
provide a read-only access to the storage data.
To modify data you need to create an object based on Fork
.
Fork
and Snapshot
can be obtained from the Database
object.
Currently only one database backend is supported - RockDB.
use Path;
use ;
let db_options = default;
let db = open.unwrap;
let list_name = "list";
// Read-only list
let snapshot = db.snapshot;
let list: = new;
// Mutable list
let fork = db.fork;
let mut list: = new;
After adding elements to the object you can obtain cryptographic proofs for their existence or absence.
list.push;
assert_eq!;
if let Absent = list.get_proof
Further Reading
License
exonum-merkledb
is licensed under the Apache License (Version 2.0).
See LICENSE for details.