Trait Store

Source
pub trait Store<K, V, const N: usize>: Default
where K: Key<N>,
{ // Required methods fn get_branch(&self, node: &H256) -> Result<Option<BranchNode<K, N>>, Error>; fn get_leaf( &self, leaf_key: &H256, ) -> Result<Option<LeafNode<K, V, N>>, Error>; fn insert_branch( &mut self, node: H256, branch: BranchNode<K, N>, ) -> Result<(), Error>; fn insert_leaf( &mut self, leaf_key: H256, leaf: LeafNode<K, V, N>, ) -> Result<(), Error>; fn remove_branch(&mut self, node: &H256) -> Result<(), Error>; fn remove_leaf(&mut self, leaf_key: &H256) -> Result<(), Error>; fn sorted_leaves<'a>(&'a self) -> impl Iterator<Item = (K, &'a V)> where V: 'a; fn size(&self) -> usize; }
Expand description

Trait for customize backend storage

Required Methods§

Source

fn get_branch(&self, node: &H256) -> Result<Option<BranchNode<K, N>>, Error>

Source

fn get_leaf(&self, leaf_key: &H256) -> Result<Option<LeafNode<K, V, N>>, Error>

Source

fn insert_branch( &mut self, node: H256, branch: BranchNode<K, N>, ) -> Result<(), Error>

Source

fn insert_leaf( &mut self, leaf_key: H256, leaf: LeafNode<K, V, N>, ) -> Result<(), Error>

Source

fn remove_branch(&mut self, node: &H256) -> Result<(), Error>

Source

fn remove_leaf(&mut self, leaf_key: &H256) -> Result<(), Error>

Source

fn sorted_leaves<'a>(&'a self) -> impl Iterator<Item = (K, &'a V)>
where V: 'a,

Source

fn size(&self) -> usize

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<K, V: Clone, const N: usize> Store<K, V, N> for DefaultStore<K, V, N>
where K: Key<N>,