pub struct DirtyRegionTracker { /* private fields */ }Expand description
Tracks which HNSW nodes are dirty (changed since the last successful sync).
Thread-safe: all public methods take &self and use interior mutability.
Implementations§
Source§impl DirtyRegionTracker
impl DirtyRegionTracker
Sourcepub fn new(max_dirty_nodes: usize) -> Self
pub fn new(max_dirty_nodes: usize) -> Self
Create a new tracker.
max_dirty_nodes is used only as the denominator when computing
dirty_ratio; it does not enforce a hard limit on dirty-set growth.
Sourcepub fn mark_dirty(&self, layer: usize, node_id: u64)
pub fn mark_dirty(&self, layer: usize, node_id: u64)
Mark node_id as dirty in layer.
Sourcepub fn mark_dirty_batch(&self, layer: usize, node_ids: &[u64])
pub fn mark_dirty_batch(&self, layer: usize, node_ids: &[u64])
Mark all nodes in node_ids as dirty in layer.
Sourcepub fn clear_region(&self, region: &EmbeddingRegion) -> usize
pub fn clear_region(&self, region: &EmbeddingRegion) -> usize
Remove all dirty entries whose layer and node ID fall inside region.
Returns the number of entries removed.
Sourcepub fn dirty_in_region(&self, region: &EmbeddingRegion) -> Vec<u64>
pub fn dirty_in_region(&self, region: &EmbeddingRegion) -> Vec<u64>
Return all dirty node IDs whose layer and node ID fall inside region.
Sourcepub fn total_dirty(&self) -> usize
pub fn total_dirty(&self) -> usize
Total number of dirty nodes across all layers.
Sourcepub fn dirty_ratio(&self) -> f64
pub fn dirty_ratio(&self) -> f64
Fraction of max_dirty_nodes that are currently dirty.
Clamped to [0.0, 1.0].
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Current generation counter value.
Sourcepub fn advance_generation(&self) -> u64
pub fn advance_generation(&self) -> u64
Atomically increment the generation counter and return the new value.
Call this after a sync round completes to invalidate stale deltas.
Sourcepub fn dirty_layers(&self) -> Vec<usize>
pub fn dirty_layers(&self) -> Vec<usize>
Layers that have at least one dirty node, in ascending order.
Auto Trait Implementations§
impl !Freeze for DirtyRegionTracker
impl !RefUnwindSafe for DirtyRegionTracker
impl Send for DirtyRegionTracker
impl Sync for DirtyRegionTracker
impl Unpin for DirtyRegionTracker
impl UnsafeUnpin for DirtyRegionTracker
impl UnwindSafe for DirtyRegionTracker
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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
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.