iridium-db 0.4.0

A high-performance vector-graph hybrid storage and indexing engine
use super::*;
use crate::features::storage::{compaction, hnsw};

fn temp_dir(prefix: &str) -> std::path::PathBuf {
    let mut dir = std::env::temp_dir();
    let stamp = format!(
        "{}_{}_{}",
        prefix,
        std::process::id(),
        std::time::SystemTime::now()
            .duration_since(std::time::UNIX_EPOCH)
            .unwrap()
            .as_nanos()
    );
    dir.push(stamp);
    std::fs::create_dir_all(&dir).expect("temp dir create");
    dir
}

struct EnvVarGuard {
    key: String,
    old: Option<String>,
}

impl EnvVarGuard {
    fn set(key: &str, value: &str) -> Self {
        let old = std::env::var(key).ok();
        std::env::set_var(key, value);
        Self {
            key: key.to_string(),
            old,
        }
    }
}

impl Drop for EnvVarGuard {
    fn drop(&mut self) {
        if let Some(value) = self.old.as_ref() {
            std::env::set_var(&self.key, value);
        } else {
            std::env::remove_var(&self.key);
        }
    }
}

mod ann_routing;
mod batch_and_maintenance;
mod bitmap_and_recovery;
mod blob_store;
mod core_paths;
mod embedding_pending;
mod locks_and_cache;
mod quantized_i8;
mod space_lifecycle;
mod thread_core;
mod tombstone;