weavatrix-search-vector 0.3.1

Persistent, mutable, bounded vector candidate search for Rust and Weavatrix
Documentation
use super::{reader, writer};
use crate::error::SearchError;
use crate::mutable::MutableVectorIndex;
use std::path::Path;

impl MutableVectorIndex {
    /// Loads a complete mutable bundle. Legacy immutable vector snapshots are
    /// accepted with empty metadata and deltas.
    ///
    /// # Errors
    ///
    /// Returns typed snapshot or storage errors.
    pub fn load(path: impl AsRef<Path>) -> Result<Self, SearchError> {
        reader::load_complete(path.as_ref()).map(|(mutable, _)| mutable)
    }

    /// Atomically saves base and sealed graphs, staged vectors, tombstones,
    /// and metadata without forcing compaction.
    ///
    /// # Errors
    ///
    /// Returns a compaction or storage error.
    pub fn save(&self, path: impl AsRef<Path>) -> Result<(), SearchError> {
        writer::save_complete(self, None, path.as_ref())
    }
}