Struct cita_trie::PatriciaTrie
source · pub struct PatriciaTrie<D, H>where
D: DB,
H: Hasher,{ /* private fields */ }
Implementations§
source§impl<D, H> PatriciaTrie<D, H>where
D: DB,
H: Hasher,
impl<D, H> PatriciaTrie<D, H>where D: DB, H: Hasher,
pub fn iter(&self) -> TrieIterator<'_, D, H>
pub fn new(db: Arc<D>, hasher: Arc<H>) -> Self
pub fn from(db: Arc<D>, hasher: Arc<H>, root: &[u8]) -> Result<Self, TrieError>
pub fn extract_backup( db: Arc<D>, backup_db: Option<Arc<D>>, hasher: Arc<H>, root_hash: &[u8] ) -> Result<(Self, Vec<Vec<u8>>), TrieError>
Trait Implementations§
source§impl<D, H> Trie<D, H> for PatriciaTrie<D, H>where
D: DB,
H: Hasher,
impl<D, H> Trie<D, H> for PatriciaTrie<D, H>where D: DB, H: Hasher,
source§fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, TrieError>
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, TrieError>
Returns the value for key stored in the trie.
source§fn contains(&self, key: &[u8]) -> Result<bool, TrieError>
fn contains(&self, key: &[u8]) -> Result<bool, TrieError>
Checks that the key is present in the trie
source§fn insert(&mut self, key: Vec<u8>, value: Vec<u8>) -> Result<(), TrieError>
fn insert(&mut self, key: Vec<u8>, value: Vec<u8>) -> Result<(), TrieError>
Inserts value into trie and modifies it if it exists
source§fn remove(&mut self, key: &[u8]) -> Result<bool, TrieError>
fn remove(&mut self, key: &[u8]) -> Result<bool, TrieError>
Removes any existing value for key from the trie.
source§fn root(&mut self) -> Result<Vec<u8>, TrieError>
fn root(&mut self) -> Result<Vec<u8>, TrieError>
Saves all the nodes in the db, clears the cache data, recalculates the root. Returns the root hash of the trie.
source§fn get_proof(&self, key: &[u8]) -> Result<Vec<Vec<u8>>, TrieError>
fn get_proof(&self, key: &[u8]) -> Result<Vec<Vec<u8>>, TrieError>
Prove constructs a merkle proof for key. The result contains all encoded nodes on the path to the value at key. The value itself is also included in the last node and can be retrieved by verifying the proof.
If the trie does not contain a value for key, the returned proof contains all nodes of the longest existing prefix of the key (at least the root node), ending with the node that proves the absence of the key.
Auto Trait Implementations§
impl<D, H> !RefUnwindSafe for PatriciaTrie<D, H>
impl<D, H> !Send for PatriciaTrie<D, H>
impl<D, H> !Sync for PatriciaTrie<D, H>
impl<D, H> Unpin for PatriciaTrie<D, H>
impl<D, H> !UnwindSafe for PatriciaTrie<D, H>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more