cfx_storage/impls/merkle_patricia_trie/
mod.rs

1// Copyright 2019 Conflux Foundation. All rights reserved.
2// Conflux is free software and distributed under GNU General Public License.
3// See http://www.gnu.org/licenses/
4
5#[macro_use]
6pub(super) mod maybe_in_place_byte_array_macro;
7
8pub mod children_table;
9pub(super) mod compressed_path;
10pub(super) mod maybe_in_place_byte_array;
11pub mod merkle;
12pub mod mpt_cursor;
13pub mod mpt_merger;
14pub mod simple_mpt;
15pub mod trie_node;
16pub mod trie_proof;
17pub(super) mod walk;
18
19#[cfg(test)]
20mod tests;
21
22pub use self::{
23    children_table::*,
24    compressed_path::{
25        CompressedPathRaw, CompressedPathRef, CompressedPathTrait,
26    },
27    mpt_merger::MptMerger,
28    trie_node::{TrieNodeTrait, VanillaTrieNode},
29    trie_proof::TrieProof,
30};
31
32pub type MptKeyValue = (Vec<u8>, Box<[u8]>);
33
34/// Classes implement KVInserter is used to store key-values in MPT iteration.
35pub trait KVInserter<Value> {
36    fn push(&mut self, v: Value) -> Result<()>;
37}
38
39impl<Value> KVInserter<Value> for Vec<Value> {
40    fn push(&mut self, v: Value) -> Result<()> { Ok((*self).push(v)) }
41}
42
43use super::errors::Result;