pub struct Lookup<'a, 'cache, L: TrieLayout, Q: Query<L::Hash>> {
pub db: &'a dyn HashDBRef<L::Hash, DBValue>,
pub query: Q,
pub hash: TrieHash<L>,
pub cache: Option<&'cache mut dyn TrieCache<L::Codec>>,
pub recorder: Option<&'cache mut dyn TrieRecorder<TrieHash<L>>>,
}
Expand description
Trie lookup helper object.
Fields§
§db: &'a dyn HashDBRef<L::Hash, DBValue>
database to query from.
query: Q
Query object to record nodes and transform data.
hash: TrieHash<L>
Hash to start at
cache: Option<&'cache mut dyn TrieCache<L::Codec>>
Optional cache that should be used to speed up the lookup.
recorder: Option<&'cache mut dyn TrieRecorder<TrieHash<L>>>
Optional recorder that will be called to record all trie accesses.
Implementations§
source§impl<'a, 'cache, L, Q> Lookup<'a, 'cache, L, Q>where
L: TrieLayout,
Q: Query<L::Hash>,
impl<'a, 'cache, L, Q> Lookup<'a, 'cache, L, Q>where L: TrieLayout, Q: Query<L::Hash>,
sourcepub fn look_up(
self,
full_key: &[u8],
nibble_key: NibbleSlice<'_>
) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>>
pub fn look_up( self, full_key: &[u8], nibble_key: NibbleSlice<'_> ) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>>
Look up the given nibble_key
.
If the value is found, it will be passed to the given function to decode or copy.
The given full_key
should be the full key to the data that is requested. This will
be used when there is a cache to potentially speed up the lookup.
sourcepub fn look_up_hash(
self,
full_key: &[u8],
nibble_key: NibbleSlice<'_>
) -> Result<Option<TrieHash<L>>, TrieHash<L>, CError<L>>
pub fn look_up_hash( self, full_key: &[u8], nibble_key: NibbleSlice<'_> ) -> Result<Option<TrieHash<L>>, TrieHash<L>, CError<L>>
Look up the value hash for the given nibble_key
.
The given full_key
should be the full key to the data that is requested. This will
be used when there is a cache to potentially speed up the lookup.
Auto Trait Implementations§
impl<'a, 'cache, L, Q> !RefUnwindSafe for Lookup<'a, 'cache, L, Q>
impl<'a, 'cache, L, Q> !Send for Lookup<'a, 'cache, L, Q>
impl<'a, 'cache, L, Q> !Sync for Lookup<'a, 'cache, L, Q>
impl<'a, 'cache, L, Q> Unpin for Lookup<'a, 'cache, L, Q>where Q: Unpin, <<L as TrieLayout>::Hash as Hasher>::Out: Unpin,
impl<'a, 'cache, L, Q> !UnwindSafe for Lookup<'a, 'cache, L, Q>
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