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§
Sourcefn 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 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.
Sourcefn 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 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".