Skip to main content

ShardedSparseHandle

Struct ShardedSparseHandle 

Source
pub struct ShardedSparseHandle { /* private fields */ }

Implementations§

Source§

impl ShardedSparseHandle

Source

pub fn create( base_path: &str, config: &ShardedSparseConfig, ) -> Result<Self, String>

Create a new sharded index on a filesystem directory.

Source

pub fn open(base_path: &str) -> Result<Self, String>

Open an existing sharded index from a filesystem directory.

Source

pub fn create_with_store<S: BlobStore>( store: Arc<S>, name: &str, cache_base: &Path, config: &ShardedSparseConfig, ) -> Result<Self, String>

Create a new sharded index whose truth is a blob store; cache_base holds the disposable local mmap cache.

Source

pub fn open_with_store<S: BlobStore>( store: Arc<S>, name: &str, cache_base: &Path, ) -> Result<Self, String>

Open an existing sharded index from a blob store.

Source

pub fn create_with_storage( storage: Box<dyn SparseShardStorage>, config: &ShardedSparseConfig, ) -> Result<Self, String>

Source

pub fn open_with_storage( storage: Box<dyn SparseShardStorage>, ) -> Result<Self, String>

Source

pub fn num_shards(&self) -> usize

Source

pub fn config(&self) -> &ShardedSparseConfig

Source

pub fn len(&self) -> usize

Number of vectors across shards, as of the last commit of each.

Source

pub fn is_empty(&self) -> bool

Source

pub fn shard_for_node_id(&self, node_id: u64) -> Option<usize>

Shard holding node_id, if the router saw it inserted.

Source

pub fn insert(&self, node_id: u64, vector: &SparseVector) -> Result<(), String>

Route the vector to a shard by its dimensions and queue the insert. Failures inside the shard surface at the next commit().

Source

pub fn remove(&self, node_id: u64) -> Result<bool, String>

Remove a vector. Returns whether it existed.

Source

pub fn commit(&self) -> Result<(), String>

Persist every shard and the router. Reports the first insert error of each shard since its last commit.

Source

pub fn search( &self, query: &SparseVector, limit: usize, ) -> Result<Vec<(u64, f32)>, String>

Top-limit by dot product across all shards.

Source

pub fn search_filtered( &self, query: &SparseVector, limit: usize, allowed_ids: &[u64], ) -> Result<Vec<(u64, f32)>, String>

search restricted to allowed_ids.

Source

pub fn close(&self) -> Result<(), String>

Commit, stop the shard actors, make the handle inert.

Source

pub fn drop_index(self) -> Result<(), String>

Close, then destroy the storage (shards and root files).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.