pub struct MultiVersionContainer<T: Debug + Clone + Send + Sync + 'static> { /* private fields */ }Expand description
A thread-safe container for multi values.
This structure maintains multiple versions of a value, allowing for point-in-time queries and concurrent access patterns.
Implementations§
Source§impl<T: Debug + Clone + Send + Sync + 'static> MultiVersionContainer<T>
impl<T: Debug + Clone + Send + Sync + 'static> MultiVersionContainer<T>
Sourcepub fn insert(
&self,
version: impl Into<CommitVersion>,
value: T,
) -> Option<Option<T>>
pub fn insert( &self, version: impl Into<CommitVersion>, value: T, ) -> Option<Option<T>>
Inserts a value at a specific version.
Returns the previous value at this version if one existed.
Sourcepub fn get(&self, version: impl Into<CommitVersion>) -> Option<T>
pub fn get(&self, version: impl Into<CommitVersion>) -> Option<T>
Gets the value that was active at a specific version.
This returns the value with the highest version that is <= the requested version.
Sourcepub fn get_or_tombstone(
&self,
version: impl Into<CommitVersion>,
) -> Option<Option<T>>
pub fn get_or_tombstone( &self, version: impl Into<CommitVersion>, ) -> Option<Option<T>>
Gets the value that was active at a specific version.
This returns the value with the highest version that is <= the or the tombstone if it was explicitly removed
Sourcepub fn get_latest(&self) -> Option<T>
pub fn get_latest(&self) -> Option<T>
Gets the latest (most recent) value.
Sourcepub fn versions(&self) -> Vec<CommitVersion>
pub fn versions(&self) -> Vec<CommitVersion>
Gets all versions that have values.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for MultiVersionContainer<T>
impl<T> RefUnwindSafe for MultiVersionContainer<T>
impl<T> Send for MultiVersionContainer<T>
impl<T> Sync for MultiVersionContainer<T>
impl<T> Unpin for MultiVersionContainer<T>
impl<T> UnwindSafe for MultiVersionContainer<T>
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