pub struct VersionPruner { /* private fields */ }Expand description
Version pruning filter
Determines which versions can be safely garbage collected.
Implementations§
Source§impl VersionPruner
impl VersionPruner
pub fn new(config: RetentionConfig) -> Self
Sourcepub fn register_snapshot(&self, timestamp: Timestamp)
pub fn register_snapshot(&self, timestamp: Timestamp)
Register an active snapshot
Sourcepub fn unregister_snapshot(&self, timestamp: Timestamp)
pub fn unregister_snapshot(&self, timestamp: Timestamp)
Unregister a snapshot
Sourcepub fn oldest_snapshot(&self) -> Option<Timestamp>
pub fn oldest_snapshot(&self) -> Option<Timestamp>
Get the oldest active snapshot
Sourcepub fn can_prune_version(
&self,
version_timestamp: Timestamp,
is_latest: bool,
version_index: usize,
) -> bool
pub fn can_prune_version( &self, version_timestamp: Timestamp, is_latest: bool, version_index: usize, ) -> bool
Check if a version can be pruned
A version can be pruned if:
- It’s not the latest version
- It’s older than max_version_age
- No active snapshot needs it
A snapshot at time T needs all versions with timestamp <= T (these are the versions that were visible at snapshot time)
Sourcepub fn can_collect_tombstone(&self, tombstone_timestamp: Timestamp) -> bool
pub fn can_collect_tombstone(&self, tombstone_timestamp: Timestamp) -> bool
Check if a tombstone can be collected
A tombstone can be collected only if:
- It’s older than the grace period
- No active snapshot needs to see it
Sourcepub fn update_time(&self)
pub fn update_time(&self)
Update current time
Auto Trait Implementations§
impl !Freeze for VersionPruner
impl !RefUnwindSafe for VersionPruner
impl Send for VersionPruner
impl Sync for VersionPruner
impl Unpin for VersionPruner
impl UnsafeUnpin for VersionPruner
impl UnwindSafe for VersionPruner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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