pub struct MemoryVectorStorage { /* private fields */ }
Expand description
High-performance in-memory vector storage
Implementations§
Source§impl MemoryVectorStorage
impl MemoryVectorStorage
Sourcepub async fn new() -> Result<Self>
pub async fn new() -> Result<Self>
Create a new memory vector storage with default configuration
Sourcepub async fn with_capacity(capacity: usize) -> Result<Self>
pub async fn with_capacity(capacity: usize) -> Result<Self>
Create a new memory vector storage with specified capacity
Sourcepub async fn with_config(config: MemoryConfig) -> Result<Self>
pub async fn with_config(config: MemoryConfig) -> Result<Self>
Create a new memory vector storage with custom configuration
Sourcepub async fn memory_usage(&self) -> u64
pub async fn memory_usage(&self) -> u64
Get memory usage in bytes
Sourcepub async fn get_performance_metrics(&self) -> PerformanceMetrics
pub async fn get_performance_metrics(&self) -> PerformanceMetrics
Get performance metrics
Sourcepub async fn get_cache_stats(&self) -> CacheStats
pub async fn get_cache_stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Clone for MemoryVectorStorage
impl Clone for MemoryVectorStorage
Source§impl VectorStorage for MemoryVectorStorage
impl VectorStorage for MemoryVectorStorage
Source§type Config = MemoryConfig
type Config = MemoryConfig
Storage-specific configuration type
Source§fn create_index<'life0, 'async_trait>(
&'life0 self,
config: IndexConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_index<'life0, 'async_trait>(
&'life0 self,
config: IndexConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new vector index
Source§fn list_indexes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_indexes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all available indexes
Source§fn describe_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn describe_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get information about a specific index
Source§fn delete_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete an index and all its vectors
Source§fn upsert_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Insert or update documents in the index
Source§fn search<'life0, 'async_trait>(
&'life0 self,
request: SearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
request: SearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Search for similar vectors
Source§fn update_document<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_document<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update a specific document
Source§fn delete_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<DocumentId>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<DocumentId>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete documents by IDs
Source§fn get_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<DocumentId>,
include_vectors: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<DocumentId>,
include_vectors: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get documents by IDs
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the storage backend is healthy
Source§fn backend_info(&self) -> BackendInfo
fn backend_info(&self) -> BackendInfo
Get storage backend information
Auto Trait Implementations§
impl Freeze for MemoryVectorStorage
impl !RefUnwindSafe for MemoryVectorStorage
impl Send for MemoryVectorStorage
impl Sync for MemoryVectorStorage
impl Unpin for MemoryVectorStorage
impl !UnwindSafe for MemoryVectorStorage
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