pub struct SledTreeOverlayStateDiff {
pub cache: BTreeMap<IVec, (Option<IVec>, IVec)>,
pub removed: BTreeMap<IVec, IVec>,
}Expand description
Auxilliary struct representing a SledTreeOverlayState diff log.
Fields§
§cache: BTreeMap<IVec, (Option<IVec>, IVec)>Inserted data represented as a BTreeMap.
The value contains both the previous key value(if it existed), along
with the new one.
removed: BTreeMap<IVec, IVec>In removed, we keep track of keys that were removed in the overlay,
along with their value.
Implementations§
Source§impl SledTreeOverlayStateDiff
impl SledTreeOverlayStateDiff
Sourcepub fn new(tree: &Tree, state: &SledTreeOverlayState) -> Result<Self, Error>
pub fn new(tree: &Tree, state: &SledTreeOverlayState) -> Result<Self, Error>
Instantiate a new SledTreeOverlayStateDiff, over the provided
sled::Tree that is being overlayed.
Sourcepub fn new_dropped(tree: &Tree) -> Self
pub fn new_dropped(tree: &Tree) -> Self
Instantiate a new SledTreeOverlayStateDiff, over the provided
sled::Tree that is being dropped. The diff will contain all
existing tree keys in its cache as inserts, representing the last tree state.
Sourcepub fn aggregate(&self) -> Option<Batch>
pub fn aggregate(&self) -> Option<Batch>
Aggregate all the tree overlay state changes into
a sled::Batch ready for further operation.
If there are no changes, return None.
Sourcepub fn revert(&self) -> Option<Batch>
pub fn revert(&self) -> Option<Batch>
Aggregate all the current tree overlay state changes inverse
actions into a sled::Batch ready for further operation.
If there are no changes, return None.
Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Produces a SledTreeOverlayStateDiff containing the inverse
changes from our own.
Sourcepub fn remove_diff(&mut self, other: &Self)
pub fn remove_diff(&mut self, other: &Self)
Remove provided tree overlay state changes from our own.
Sourcepub fn update_values(&mut self, other: &Self)
pub fn update_values(&mut self, other: &Self)
Update our cache key values to the ones in the provided tree overlay state changes.
Trait Implementations§
Source§impl Clone for SledTreeOverlayStateDiff
impl Clone for SledTreeOverlayStateDiff
Source§fn clone(&self) -> SledTreeOverlayStateDiff
fn clone(&self) -> SledTreeOverlayStateDiff
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more