[−][src]Struct starling::merkle_bit::MerkleBIT
The MerkleBIT structure relies on many specified types:
Required Type Annotations
- DatabaseType: The type to use for database-like operations. DatabaseType must implement the Database trait.
- BranchType: The type used for representing branches in the tree. BranchType must implement the Branch trait.
- LeafType: The type used for representing leaves in the tree. LeafType must implement the Leaf trait.
- DataType: The type used for representing data nodes in the tree. DataType must implement the Data trait.
- NodeType: The type used for the outer node that can be either a branch, leaf, or data. NodeType must implement the Node trait.
- HasherType: The type of hasher to use for hashing locations on the tree. HasherType must implement the Hasher trait.
- ValueType: The type to return from a get. ValueType must implement the Encode and Decode traits.
Properties
- db: The database to store and retrieve values
- depth: The maximum permitted depth of the tree.
Methods
impl<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType> MerkleBIT<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType> where
DatabaseType: Database<NodeType = NodeType>,
BranchType: Branch,
LeafType: Leaf + Clone,
DataType: Data,
NodeType: Node<BranchType, LeafType, DataType, ValueType>,
HasherType: Hasher<HashType = HasherType>,
ValueType: Decode + Encode,
[src]
DatabaseType: Database<NodeType = NodeType>,
BranchType: Branch,
LeafType: Leaf + Clone,
DataType: Data,
NodeType: Node<BranchType, LeafType, DataType, ValueType>,
HasherType: Hasher<HashType = HasherType>,
ValueType: Decode + Encode,
pub fn new(path: &PathBuf, depth: usize) -> BinaryMerkleTreeResult<Self>
[src]
Create a new MerkleBIT from a saved database
pub fn from_db(db: DatabaseType, depth: usize) -> BinaryMerkleTreeResult<Self>
[src]
Create a new MerkleBIT from an already opened database
pub fn get<'a>(
&self,
root_hash: &[u8],
keys: &mut [&'a [u8]]
) -> BinaryMerkleTreeResult<HashMap<&'a [u8], Option<ValueType>>>
[src]
&self,
root_hash: &[u8],
keys: &mut [&'a [u8]]
) -> BinaryMerkleTreeResult<HashMap<&'a [u8], Option<ValueType>>>
Get items from the MerkleBIT. Returns a map of Options which may include the corresponding values.
pub fn insert(
&mut self,
previous_root: Option<&[u8]>,
keys: &mut [&[u8]],
values: &mut [&ValueType]
) -> BinaryMerkleTreeResult<Vec<u8>>
[src]
&mut self,
previous_root: Option<&[u8]>,
keys: &mut [&[u8]],
values: &mut [&ValueType]
) -> BinaryMerkleTreeResult<Vec<u8>>
Insert items into the MerkleBIT. Keys must be sorted. Returns a new root hash for the MerkleBIT.
pub fn remove(&mut self, root_hash: &[u8]) -> BinaryMerkleTreeResult<()>
[src]
Remove all items with less than 1 reference under the given root.
Auto Trait Implementations
impl<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType> !Send for MerkleBIT<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType>
impl<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType> !Sync for MerkleBIT<DatabaseType, BranchType, LeafType, DataType, NodeType, HasherType, ValueType>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,