pub struct LirePatcher<'a> {
pub main: &'a mut HnswIndex,
pub delta: &'a mut DeltaIndex,
pub drift_threshold: f32,
}Expand description
SPFresh LIRE-style topology-aware local patcher.
Holds mutable references to both the main HNSW and the delta buffer so both can be updated atomically within a single flush.
Fields§
§main: &'a mut HnswIndexMain HNSW graph that fresh vectors will be patched into.
delta: &'a mut DeltaIndexDelta buffer whose fresh vectors (and tombstones) will be drained.
drift_threshold: f32Drift threshold in [0.0, 1.0]. When the average neighbor-overlap
fraction for a batch falls below this value the subgraph is flagged
for deeper re-pruning. Default: 0.3.
Implementations§
Source§impl<'a> LirePatcher<'a>
impl<'a> LirePatcher<'a>
Sourcepub fn new(main: &'a mut HnswIndex, delta: &'a mut DeltaIndex) -> Self
pub fn new(main: &'a mut HnswIndex, delta: &'a mut DeltaIndex) -> Self
Create a patcher with the default drift threshold (0.3).
Sourcepub fn patch(
&mut self,
_k_neighbors: usize,
_ef_construction: usize,
) -> Result<PatchStats, VectorError>
pub fn patch( &mut self, _k_neighbors: usize, _ef_construction: usize, ) -> Result<PatchStats, VectorError>
Flush the delta buffer into the main HNSW.
§Steps
- Drain tombstones → call
HnswIndex::deleteon each. - Drain fresh vectors → call
HnswIndex::inserton each. - After each insert, estimate local topology drift for the newly assigned node and accumulate the overlap fraction.
- If average overlap fraction <
drift_threshold, incrementdrift_subgraphs.
k_neighbors and ef_construction are accepted for API completeness
and forward-compatibility with future Vamana-style patchers; the
current HNSW implementation derives its own neighbor count from
HnswParams stored on the index, so these values are informational.
Auto Trait Implementations§
impl<'a> Freeze for LirePatcher<'a>
impl<'a> !RefUnwindSafe for LirePatcher<'a>
impl<'a> Send for LirePatcher<'a>
impl<'a> !Sync for LirePatcher<'a>
impl<'a> Unpin for LirePatcher<'a>
impl<'a> UnsafeUnpin for LirePatcher<'a>
impl<'a> !UnwindSafe for LirePatcher<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.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.