pub trait SubTreeRead {
// Required methods
fn root(&self) -> MerkleRoot;
fn validate(&self) -> bool;
fn subtree_has_key(&self, key: &Key) -> Result<bool, Error>;
fn subtree_get(&self, key: &Key) -> Result<Vec<u8>, Error>;
fn subtree_membership_proof(
&self,
keys: &[Key],
values: Vec<StorageBytes<'_>>,
) -> Result<MembershipProof, Error>;
}Expand description
Trait for reading from a merkle tree that is a sub-tree of the global merkle tree.
Required Methods§
Sourcefn root(&self) -> MerkleRoot
fn root(&self) -> MerkleRoot
Get the root of a subtree in raw bytes.
Sourcefn validate(&self) -> bool
fn validate(&self) -> bool
Recompute the merkle root from the backing storage and check it matches the saved root.
Sourcefn subtree_has_key(&self, key: &Key) -> Result<bool, Error>
fn subtree_has_key(&self, key: &Key) -> Result<bool, Error>
Check if a key is present in the sub-tree
Sourcefn subtree_get(&self, key: &Key) -> Result<Vec<u8>, Error>
fn subtree_get(&self, key: &Key) -> Result<Vec<u8>, Error>
Get the height at which the key is inserted
Sourcefn subtree_membership_proof(
&self,
keys: &[Key],
values: Vec<StorageBytes<'_>>,
) -> Result<MembershipProof, Error>
fn subtree_membership_proof( &self, keys: &[Key], values: Vec<StorageBytes<'_>>, ) -> Result<MembershipProof, Error>
Get a membership proof for various key-value pairs