#![allow(dead_code, unused_imports, unused_variables, unused_mut)]
#![allow(non_camel_case_types, ambiguous_glob_reexports, hidden_glob_reexports)]
#![allow(unexpected_cfgs, unused_assignments)]
use std::collections::HashMap;
use std::sync::Arc;
use tokio::sync::RwLock;
use async_trait::async_trait;
use uuid::Uuid;
use lumosai_vector_core::prelude::*;
mod storage;
mod index;
mod utils;
pub use storage::MemoryVectorStorage;
pub type MemoryVectorStore = MemoryVectorStorage;
pub use index::MemoryIndex;
#[derive(Debug, Clone)]
pub struct MemoryConfig {
pub initial_capacity: usize,
pub max_vectors_per_index: Option<usize>,
pub enable_approximate: bool,
pub memory_threshold_mb: Option<usize>,
}
impl Default for MemoryConfig {
fn default() -> Self {
Self {
initial_capacity: 1000,
max_vectors_per_index: None,
enable_approximate: false,
memory_threshold_mb: None,
}
}
}
impl MemoryConfig {
pub fn new() -> Self {
Self::default()
}
pub fn with_initial_capacity(mut self, capacity: usize) -> Self {
self.initial_capacity = capacity;
self
}
pub fn with_max_vectors(mut self, max_vectors: usize) -> Self {
self.max_vectors_per_index = Some(max_vectors);
self
}
pub fn with_approximate_search(mut self, enable: bool) -> Self {
self.enable_approximate = enable;
self
}
pub fn with_memory_threshold(mut self, threshold_mb: usize) -> Self {
self.memory_threshold_mb = Some(threshold_mb);
self
}
}