pub trait TreeReader {
// Required methods
fn get_node_option(&self, node_key: &NodeKey) -> Result<Option<Node>>;
fn get_value_option(
&self,
max_version: Version,
key_hash: KeyHash,
) -> Result<Option<OwnedValue>>;
fn get_rightmost_leaf(&self) -> Result<Option<(NodeKey, LeafNode)>>;
// Provided methods
fn get_node(&self, node_key: &NodeKey) -> Result<Node> { ... }
fn get_value(
&self,
max_version: Version,
key_hash: KeyHash,
) -> Result<OwnedValue> { ... }
}
Expand description
Defines the interface between a
JellyfishMerkleTree
and underlying storage holding nodes.
Required Methods§
Sourcefn get_node_option(&self, node_key: &NodeKey) -> Result<Option<Node>>
fn get_node_option(&self, node_key: &NodeKey) -> Result<Option<Node>>
Gets node given a node key. Returns None
if the node does not exist.
Sourcefn get_value_option(
&self,
max_version: Version,
key_hash: KeyHash,
) -> Result<Option<OwnedValue>>
fn get_value_option( &self, max_version: Version, key_hash: KeyHash, ) -> Result<Option<OwnedValue>>
Gets a value by identifier, returning the newest value whose version is less than or equal to the specified version. Returns None if the value does not exist.