Struct sled_overlay::tree::SledTreeOverlay
source · pub struct SledTreeOverlay { /* private fields */ }Expand description
An overlay on top of a single sled::Tree instance
Implementations§
source§impl SledTreeOverlay
impl SledTreeOverlay
sourcepub fn new(tree: &Tree) -> Self
pub fn new(tree: &Tree) -> Self
Instantiate a new SledTreeOverlay on top of a given sled::Tree.
sourcepub fn contains_key(&self, key: &[u8]) -> Result<bool, Error>
pub fn contains_key(&self, key: &[u8]) -> Result<bool, Error>
Returns true if the overlay contains a value for a specified key.
sourcepub fn last(&self) -> Result<Option<(IVec, IVec)>, Error>
pub fn last(&self) -> Result<Option<(IVec, IVec)>, Error>
Returns last value from the overlay or None if its empty,
based on the Ord implementation for Vec<u8>.
sourcepub fn get(&self, key: &[u8]) -> Result<Option<IVec>, Error>
pub fn get(&self, key: &[u8]) -> Result<Option<IVec>, Error>
Retrieve a value from the overlay if it exists.
sourcepub fn insert(
&mut self,
key: &[u8],
value: &[u8]
) -> Result<Option<IVec>, Error>
pub fn insert( &mut self, key: &[u8], value: &[u8] ) -> Result<Option<IVec>, Error>
Insert a key to a new value, returning the last value if it was set.
sourcepub fn remove(&mut self, key: &[u8]) -> Result<Option<IVec>, Error>
pub fn remove(&mut self, key: &[u8]) -> Result<Option<IVec>, Error>
Delete a value, if it exists, returning the old value.
sourcepub fn aggregate(&self) -> Option<Batch>
pub fn aggregate(&self) -> Option<Batch>
Aggregate all the current overlay changes into a sled::Batch ready for
further operation. If there are no changes, return None.
sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Checkpoint current cache state so we can revert to it, if needed.
sourcepub fn revert_to_checkpoint(&mut self)
pub fn revert_to_checkpoint(&mut self)
Revert to current cache state checkpoint.
Trait Implementations§
source§impl Clone for SledTreeOverlay
impl Clone for SledTreeOverlay
source§fn clone(&self) -> SledTreeOverlay
fn clone(&self) -> SledTreeOverlay
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SledTreeOverlay
impl Send for SledTreeOverlay
impl Sync for SledTreeOverlay
impl Unpin for SledTreeOverlay
impl !UnwindSafe for SledTreeOverlay
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