SubTreeRead

Trait SubTreeRead 

Source
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§

Source

fn root(&self) -> MerkleRoot

Get the root of a subtree in raw bytes.

Source

fn validate(&self) -> bool

Recompute the merkle root from the backing storage and check it matches the saved root.

Source

fn subtree_has_key(&self, key: &Key) -> Result<bool, Error>

Check if a key is present in the sub-tree

Source

fn subtree_get(&self, key: &Key) -> Result<Vec<u8>, Error>

Get the height at which the key is inserted

Source

fn subtree_membership_proof( &self, keys: &[Key], values: Vec<StorageBytes<'_>>, ) -> Result<MembershipProof, Error>

Get a membership proof for various key-value pairs

Implementors§