Skip to main content

OnlineUpdatable

Trait OnlineUpdatable 

Source
pub trait OnlineUpdatable: Send + Sync {
    // Required methods
    fn online_insert(
        &self,
        id: VectorId,
        vector: Vec<f32>,
    ) -> Result<(), String>;
    fn online_insert_batch(
        &self,
        vectors: Vec<(VectorId, Vec<f32>)>,
    ) -> Result<usize, String>;
    fn online_delete(&self, id: &VectorId) -> Result<bool, String>;
    fn online_delete_batch(&self, ids: &[VectorId]) -> Result<usize, String>;
    fn contains(&self, id: &VectorId) -> bool;
    fn len(&self) -> usize;
    fn maintenance(&self) -> Result<MaintenanceResult, String>;
    fn online_stats(&self) -> OnlineUpdateStats;

    // Provided methods
    fn online_update(
        &self,
        id: VectorId,
        vector: Vec<f32>,
    ) -> Result<(), String> { ... }
    fn online_update_batch(
        &self,
        vectors: Vec<(VectorId, Vec<f32>)>,
    ) -> Result<usize, String> { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

Trait for indexes that support online updates

Required Methods§

Source

fn online_insert(&self, id: VectorId, vector: Vec<f32>) -> Result<(), String>

Insert a single vector

Source

fn online_insert_batch( &self, vectors: Vec<(VectorId, Vec<f32>)>, ) -> Result<usize, String>

Insert multiple vectors in a batch

Source

fn online_delete(&self, id: &VectorId) -> Result<bool, String>

Delete a vector by ID (may be lazy)

Source

fn online_delete_batch(&self, ids: &[VectorId]) -> Result<usize, String>

Delete multiple vectors by ID

Source

fn contains(&self, id: &VectorId) -> bool

Check if a vector exists

Source

fn len(&self) -> usize

Get the current vector count

Source

fn maintenance(&self) -> Result<MaintenanceResult, String>

Perform maintenance operations (cleanup deleted vectors, optimize structure)

Source

fn online_stats(&self) -> OnlineUpdateStats

Get online update statistics

Provided Methods§

Source

fn online_update(&self, id: VectorId, vector: Vec<f32>) -> Result<(), String>

Update a vector (atomic delete + insert)

Source

fn online_update_batch( &self, vectors: Vec<(VectorId, Vec<f32>)>, ) -> Result<usize, String>

Update multiple vectors

Source

fn is_empty(&self) -> bool

Check if the index is empty

Implementors§