mod hnsw;
mod ivfflat;
mod scan;
mod hnsw_am;
mod ivfflat_am;
mod ivfflat_storage;
pub use hnsw::*;
pub use ivfflat::*;
pub use scan::*;
use std::sync::atomic::{AtomicUsize, Ordering};
static INDEX_MEMORY_BYTES: AtomicUsize = AtomicUsize::new(0);
pub fn get_total_index_memory_mb() -> f64 {
INDEX_MEMORY_BYTES.load(Ordering::Relaxed) as f64 / (1024.0 * 1024.0)
}
pub fn track_index_allocation(bytes: usize) {
INDEX_MEMORY_BYTES.fetch_add(bytes, Ordering::Relaxed);
}
pub fn track_index_deallocation(bytes: usize) {
INDEX_MEMORY_BYTES.fetch_sub(bytes, Ordering::Relaxed);
}
#[derive(Debug, Clone)]
pub struct IndexStats {
pub name: String,
pub index_type: String,
pub vector_count: i64,
pub dimensions: i32,
pub index_size_mb: f64,
pub fragmentation_pct: f64,
}
pub fn get_all_index_stats() -> Vec<IndexStats> {
Vec::new()
}
#[derive(Debug)]
pub struct MaintenanceStats {
pub nodes_updated: usize,
pub connections_optimized: usize,
pub memory_reclaimed_bytes: usize,
pub duration_ms: u64,
}
pub fn perform_maintenance(_index_name: &str) -> Result<MaintenanceStats, String> {
Ok(MaintenanceStats {
nodes_updated: 0,
connections_optimized: 0,
memory_reclaimed_bytes: 0,
duration_ms: 0,
})
}