Trait grovedb_merk::tree::Commit

source ·
pub trait Commit {
    // Required method
    fn write(
        &mut self,
        tree: &mut TreeNode,
        old_specialized_cost: &impl Fn(&Vec<u8>, &Vec<u8>) -> Result<u32, Error>,
    ) -> Result<(), Error>;

    // Provided method
    fn prune(&self, _tree: &TreeNode) -> (bool, bool) { ... }
}
Expand description

To be used when committing a tree (writing it to a store after applying the changes).

Required Methods§

source

fn write( &mut self, tree: &mut TreeNode, old_specialized_cost: &impl Fn(&Vec<u8>, &Vec<u8>) -> Result<u32, Error>, ) -> Result<(), Error>

Called once per updated node when a finalized tree is to be written to a backing store or cache.

Provided Methods§

source

fn prune(&self, _tree: &TreeNode) -> (bool, bool)

Called once per node after writing a node and its children. The returned tuple specifies whether or not to prune the left and right child nodes, respectively. For example, returning (true, true) will prune both nodes, removing them from memory.

Object Safety§

This trait is not object safe.

Implementors§