geographdb-core 0.3.1

Geometric graph database core - 3D spatial indexing for code analysis
Documentation
//! Edge storage with CSR (Compressed Sparse Row) format

use super::data_structures::EdgeRec;
use anyhow::Result;

/// Edge storage manager
pub struct EdgeStore {
    // TODO: Implement memory-mapped CSR storage
    edges: Vec<EdgeRec>,
}

impl EdgeStore {
    pub fn new() -> Self {
        Self { edges: Vec::new() }
    }

    pub fn insert(&mut self, edge: EdgeRec) -> Result<u64> {
        let id = self.edges.len() as u64;
        self.edges.push(edge);
        Ok(id)
    }

    pub fn get(&self, id: u64) -> Option<&EdgeRec> {
        self.edges.get(id as usize)
    }
}

impl Default for EdgeStore {
    fn default() -> Self {
        Self::new()
    }
}