Struct oasis_core_runtime::storage::mkvs::OverlayTree
source · pub struct OverlayTree<T: FallibleMKVS> { /* private fields */ }
Expand description
A key-value tree overlay that holds all updates in memory and only commits them if requested. This can be used to create snapshots that can be discarded.
While updates (inserts, removes) are stored in the overlay, reads are not cached in the overlay as the inner tree has its own cache and double caching makes less sense.
Implementations§
source§impl<T: FallibleMKVS> OverlayTree<T>
impl<T: FallibleMKVS> OverlayTree<T>
pub fn get_proof(&self, key: &[u8]) -> Result<Option<Proof>>
sourcepub fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<Vec<u8>>>
pub fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<Vec<u8>>>
Insert a key/value pair into the tree.
Trait Implementations§
source§impl<T: FallibleMKVS> MKVS for OverlayTree<T>
impl<T: FallibleMKVS> MKVS for OverlayTree<T>
source§fn cache_contains_key(&self, key: &[u8]) -> bool
fn cache_contains_key(&self, key: &[u8]) -> bool
Check if the local MKVS cache contains the given key. Read more
source§fn insert(&mut self, key: &[u8], value: &[u8]) -> Option<Vec<u8>>
fn insert(&mut self, key: &[u8], value: &[u8]) -> Option<Vec<u8>>
Update entry with given key. Read more
source§fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>
fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>
Remove entry with given key, returning the value at the key if the key was previously
in the database.
source§fn prefetch_prefixes(&self, prefixes: &[Prefix], limit: u16)
fn prefetch_prefixes(&self, prefixes: &[Prefix], limit: u16)
Populate the in-memory tree with nodes for keys starting with given prefixes.
Auto Trait Implementations§
impl<T> Freeze for OverlayTree<T>where
T: Freeze,
impl<T> RefUnwindSafe for OverlayTree<T>where
T: RefUnwindSafe,
impl<T> Send for OverlayTree<T>where
T: Send,
impl<T> Sync for OverlayTree<T>where
T: Sync,
impl<T> Unpin for OverlayTree<T>where
T: Unpin,
impl<T> UnwindSafe for OverlayTree<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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