pub struct StorageManager { /* private fields */ }Expand description
Storage manager for geometric graph database Uses memory-mapped files for persistent storage
Implementations§
Source§impl StorageManager
impl StorageManager
Sourcepub fn create(path: &Path) -> Result<Self>
pub fn create(path: &Path) -> Result<Self>
Create a new storage manager with a new database file
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn metadata_count(&self) -> usize
Sourcepub fn insert_metadata_at(
&mut self,
id: u64,
metadata: MetadataRec,
) -> Result<()>
pub fn insert_metadata_at( &mut self, id: u64, metadata: MetadataRec, ) -> Result<()>
Insert a metadata record at a specific ID (matches node ID) This ensures metadata[N] always corresponds to node[N]
Sourcepub fn get_metadata(&self, id: u64) -> Option<&MetadataRec>
pub fn get_metadata(&self, id: u64) -> Option<&MetadataRec>
Get a metadata record by ID
pub fn insert_node(&mut self, node: NodeRec) -> Result<u64>
pub fn insert_edge(&mut self, edge: EdgeRec) -> Result<u64>
pub fn get_node(&self, id: u64) -> Option<&NodeRec>
pub fn get_edge(&self, id: u64) -> Option<&EdgeRec>
pub fn get_edges_for_node(&self, _node_id: u64) -> Vec<&EdgeRec>
Sourcepub fn get_version_history(&self, logical_id: u64) -> Option<&Vec<u64>>
pub fn get_version_history(&self, logical_id: u64) -> Option<&Vec<u64>>
LSTS (Linearly Versioned Timestamp) query
Returns the node version that was visible at the given timestamp. A version is visible if:
- begin_ts <= query_timestamp
- end_ts == 0 OR end_ts > query_timestamp
- visibility == VERSION_COMMITTED (1)
Get the version history for a logical node
pub fn get_node_at_timestamp( &self, logical_id: u64, timestamp: u64, ) -> Option<&NodeRec>
Sourcepub fn update_node(
&mut self,
logical_id: u64,
new_node: NodeRec,
new_begin_ts: u64,
) -> Result<u64>
pub fn update_node( &mut self, logical_id: u64, new_node: NodeRec, new_begin_ts: u64, ) -> Result<u64>
Update a node with LSTS versioning
This implements the core LSTS update semantics:
- Find the current version of the node (where end_ts == 0)
- Set end_ts = new_begin_ts on the current version (mark as superseded)
- Insert a new version with begin_ts = new_begin_ts, end_ts = 0
Returns the ID of the new version
pub fn flush(&mut self) -> Result<()>
Sourcepub fn rebuild_spatial_index(&mut self) -> Result<()>
pub fn rebuild_spatial_index(&mut self) -> Result<()>
Rebuild the spatial page store from all current nodes + edges. Call this explicitly after bulk insertions.
Sourcepub fn spatial_range_query(&mut self, query: &BoundingBox) -> Vec<u64>
pub fn spatial_range_query(&mut self, query: &BoundingBox) -> Vec<u64>
Range query via dual-octree page store. Returns node IDs in matching pages. Rebuilds the index lazily on first call if not explicitly built.
Sourcepub fn spatial_point_query(&mut self, x: f32, y: f32, z: f32) -> Vec<u64>
pub fn spatial_point_query(&mut self, x: f32, y: f32, z: f32) -> Vec<u64>
Point query via dual-octree page store.
Sourcepub fn maybe_load_spatial_store(&mut self) -> Result<()>
pub fn maybe_load_spatial_store(&mut self) -> Result<()>
Try to load a persisted spatial page store from the sidecar file.