pub struct SegmentTracker { /* private fields */ }Expand description
Tracks segment references and pending deletions
Implementations§
Source§impl SegmentTracker
impl SegmentTracker
Sourcepub fn register(&self, segment_id: &str)
pub fn register(&self, segment_id: &str)
Register a new segment (called when segment is committed)
Sourcepub fn acquire(&self, segment_ids: &[String]) -> Vec<String>
pub fn acquire(&self, segment_ids: &[String]) -> Vec<String>
Acquire references to a set of segments (called when taking a snapshot) Returns the segment IDs that were successfully acquired
Sourcepub fn release(&self, segment_ids: &[String]) -> Vec<SegmentId>
pub fn release(&self, segment_ids: &[String]) -> Vec<SegmentId>
Release references to a set of segments (called when snapshot is dropped) Returns segment IDs that are now ready for deletion
Sourcepub fn mark_for_deletion(&self, segment_ids: &[String]) -> Vec<SegmentId>
pub fn mark_for_deletion(&self, segment_ids: &[String]) -> Vec<SegmentId>
Mark segments for deletion (called after merge completes) Segments with ref count 0 are returned immediately for deletion Segments with refs > 0 are queued for deletion when refs are released
Sourcepub fn is_pending_deletion(&self, segment_id: &str) -> bool
pub fn is_pending_deletion(&self, segment_id: &str) -> bool
Check if a segment is pending deletion
Sourcepub fn is_deletion_protected(&self, segment_id: &str) -> bool
pub fn is_deletion_protected(&self, segment_id: &str) -> bool
Whether files must remain protected from orphan sweeping.
This covers both segments waiting for readers and segments whose last reader released them but whose asynchronous filesystem deletion has not completed yet. Moving between those states is atomic under the tracker lock, so the sweeper cannot race the deletion callback.
Sourcepub fn complete_deletion(&self, segment_ids: &[SegmentId])
pub fn complete_deletion(&self, segment_ids: &[SegmentId])
Finish the scheduled-deletion lifecycle after the filesystem attempt.
Failed deletes are also completed here so a later orphan sweep can retry them instead of protecting the files forever.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SegmentTracker
impl !RefUnwindSafe for SegmentTracker
impl Send for SegmentTracker
impl Sync for SegmentTracker
impl Unpin for SegmentTracker
impl UnsafeUnpin for SegmentTracker
impl UnwindSafe for SegmentTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.