pub struct VersionChain<T> { /* private fields */ }Expand description
Version chain for a single key
Implementations§
Source§impl<T: Clone> VersionChain<T>
impl<T: Clone> VersionChain<T>
pub fn new() -> Self
Sourcepub fn add_version(&mut self, version: VersionedValue<T>)
pub fn add_version(&mut self, version: VersionedValue<T>)
Add a new version (prepends to front as newest)
Sourcepub fn latest(&self) -> Option<&VersionedValue<T>>
pub fn latest(&self) -> Option<&VersionedValue<T>>
Get the latest version
Sourcepub fn version_at(&self, epoch: u64) -> Option<&VersionedValue<T>>
pub fn version_at(&self, epoch: u64) -> Option<&VersionedValue<T>>
Get version visible at specific epoch Returns None if the key was deleted at or before the given epoch
Sourcepub fn gc(&mut self, watermark: u64) -> (usize, usize)
pub fn gc(&mut self, watermark: u64) -> (usize, usize)
Clean up versions older than watermark Returns (versions_removed, bytes_freed estimate)
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<T: Debug> Debug for VersionChain<T>
impl<T: Debug> Debug for VersionChain<T>
Auto Trait Implementations§
impl<T> Freeze for VersionChain<T>
impl<T> RefUnwindSafe for VersionChain<T>where
T: RefUnwindSafe,
impl<T> Send for VersionChain<T>where
T: Send,
impl<T> Sync for VersionChain<T>where
T: Sync,
impl<T> Unpin for VersionChain<T>where
T: Unpin,
impl<T> UnwindSafe for VersionChain<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more