grovedb_merk/lib.rs
1// MIT LICENSE
2//
3// Copyright (c) 2021 Dash Core Group
4//
5// Permission is hereby granted, free of charge, to any
6// person obtaining a copy of this software and associated
7// documentation files (the "Software"), to deal in the
8// Software without restriction, including without
9// limitation the rights to use, copy, modify, merge,
10// publish, distribute, sublicense, and/or sell copies of
11// the Software, and to permit persons to whom the Software
12// is furnished to do so, subject to the following
13// conditions:
14//
15// The above copyright notice and this permission notice
16// shall be included in all copies or substantial portions
17// of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
20// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
21// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
22// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
23// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
26// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27// DEALINGS IN THE SOFTWARE.
28
29//! High-performance Merkle key/value store
30
31// #![deny(missing_docs)]
32
33/// The top-level store API.
34#[cfg(feature = "minimal")]
35pub mod merk;
36
37#[cfg(feature = "grovedbg")]
38pub mod debugger;
39
40#[cfg(feature = "minimal")]
41pub use crate::merk::{chunks::ChunkProducer, options::MerkOptions, restore::Restorer};
42
43/// Provides a container type that allows temporarily taking ownership of a
44/// value.
45// TODO: move this into its own crate
46#[cfg(feature = "minimal")]
47pub mod owner;
48/// Algorithms for generating and verifying Merkle proofs.
49#[cfg(any(feature = "minimal", feature = "verify"))]
50pub mod proofs;
51
52/// Various helpers useful for tests or benchmarks.
53#[cfg(feature = "test_utils")]
54pub mod test_utils;
55
56/// The core tree data structure.
57#[cfg(any(feature = "minimal", feature = "verify"))]
58pub mod tree;
59
60/// Errors
61#[cfg(any(feature = "minimal", feature = "verify"))]
62pub mod error;
63
64/// Estimated costs
65#[cfg(any(feature = "minimal", feature = "verify"))]
66pub mod estimated_costs;
67
68#[cfg(any(feature = "minimal", feature = "verify"))]
69pub mod tree_type;
70#[cfg(feature = "minimal")]
71mod visualize;
72
73#[cfg(feature = "minimal")]
74pub use ed;
75#[cfg(any(feature = "minimal", feature = "verify"))]
76pub use error::Error;
77#[cfg(feature = "minimal")]
78pub use tree::{
79 BatchEntry, Link, MerkBatch, Op, PanicSource, HASH_BLOCK_SIZE, HASH_BLOCK_SIZE_U32,
80 HASH_LENGTH, HASH_LENGTH_U32, HASH_LENGTH_U32_X2,
81};
82#[cfg(any(feature = "minimal", feature = "verify"))]
83pub use tree::{CryptoHash, TreeFeatureType};
84#[cfg(any(feature = "minimal", feature = "verify"))]
85pub use tree_type::MaybeTree;
86#[cfg(any(feature = "minimal", feature = "verify"))]
87pub use tree_type::TreeType;
88
89#[cfg(feature = "minimal")]
90pub use crate::merk::{
91 defaults::ROOT_KEY_KEY,
92 prove::{ProofConstructionResult, ProofWithoutEncodingResult},
93 KVIterator, Merk, MerkType, RootHashKeyAndAggregateData,
94};
95#[cfg(feature = "minimal")]
96pub use crate::visualize::VisualizeableMerk;