Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn save<'life0, 'async_trait>(
        &'life0 self,
        value: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        limit: usize,
        threshold: f32,
    ) -> Pin<Box<dyn Future<Output = TopNResults> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reset<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait representing a storage backend.

Required Methods§

Source

fn save<'life0, 'async_trait>( &'life0 self, value: String, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Saves a value into the storage.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, limit: usize, threshold: f32, ) -> Pin<Box<dyn Future<Output = TopNResults> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Searches the storage with a query, limiting the results and applying a threshold.

Source

fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resets the storage by clearing all stored data.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§