pub enum VectorIndexBackend {
Vamana(VamanaIndex),
Spann(SpannIndex),
}Expand description
Unified vector index backend supporting Vamana and SPANN
Variants§
Vamana(VamanaIndex)
Spann(SpannIndex)
Implementations§
Source§impl VectorIndexBackend
impl VectorIndexBackend
Sourcepub fn auto(config: BackendConfig, expected_vectors: usize) -> Result<Self>
pub fn auto(config: BackendConfig, expected_vectors: usize) -> Result<Self>
Create backend with auto-selection based on expected vector count
Sourcepub fn new_vamana(config: BackendConfig) -> Result<Self>
pub fn new_vamana(config: BackendConfig) -> Result<Self>
Create Vamana backend explicitly
Sourcepub fn new_spann(config: BackendConfig) -> Result<Self>
pub fn new_spann(config: BackendConfig) -> Result<Self>
Create SPANN backend explicitly
Sourcepub fn backend_type(&self) -> BackendType
pub fn backend_type(&self) -> BackendType
Get backend type
Sourcepub fn add_vector(&mut self, vector: Vec<f32>) -> Result<u32>
pub fn add_vector(&mut self, vector: Vec<f32>) -> Result<u32>
Add a vector to the index, returns vector ID
Sourcepub fn search(&self, query: &[f32], k: usize) -> Result<Vec<(u32, f32)>>
pub fn search(&self, query: &[f32], k: usize) -> Result<Vec<(u32, f32)>>
Search for k nearest neighbors
Sourcepub fn save_to_file(&self, path: &Path) -> Result<()>
pub fn save_to_file(&self, path: &Path) -> Result<()>
Save index to file
Sourcepub fn load_from_file(path: &Path, backend_type: BackendType) -> Result<Self>
pub fn load_from_file(path: &Path, backend_type: BackendType) -> Result<Self>
Load index from file
Sourcepub fn build(&mut self, vectors: Vec<Vec<f32>>) -> Result<()>
pub fn build(&mut self, vectors: Vec<Vec<f32>>) -> Result<()>
Build index from vectors (for SPANN, Vamana builds incrementally)
Sourcepub fn needs_rebuild(&self) -> bool
pub fn needs_rebuild(&self) -> bool
Check if index needs rebuild (Vamana only)
Sourcepub fn auto_rebuild_if_needed(&mut self) -> Result<bool>
pub fn auto_rebuild_if_needed(&mut self) -> Result<bool>
Auto-rebuild if needed (Vamana only)
Sourcepub fn incremental_insert_count(&self) -> usize
pub fn incremental_insert_count(&self) -> usize
Get incremental insert count (Vamana only)
Sourcepub fn deleted_count(&self) -> usize
pub fn deleted_count(&self) -> usize
Get deleted count (Vamana only)
Sourcepub fn deletion_ratio(&self) -> f32
pub fn deletion_ratio(&self) -> f32
Get deletion ratio (Vamana only)
Sourcepub fn needs_compaction(&self) -> bool
pub fn needs_compaction(&self) -> bool
Check if needs compaction (Vamana only)
Sourcepub fn verify_index_file(path: &Path, backend_type: BackendType) -> Result<bool>
pub fn verify_index_file(path: &Path, backend_type: BackendType) -> Result<bool>
Verify index file integrity
Auto Trait Implementations§
impl !Freeze for VectorIndexBackend
impl !RefUnwindSafe for VectorIndexBackend
impl Send for VectorIndexBackend
impl Sync for VectorIndexBackend
impl Unpin for VectorIndexBackend
impl UnsafeUnpin for VectorIndexBackend
impl !UnwindSafe for VectorIndexBackend
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> 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