Struct sled_overlay::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 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, returning the old value if it existed.
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.