Skip to main content

StorageManager

Struct StorageManager 

Source
pub struct StorageManager { /* private fields */ }
Expand description

Storage manager for geometric graph database Uses memory-mapped files for persistent storage

Implementations§

Source§

impl StorageManager

Source

pub fn create(path: &Path) -> Result<Self>

Create a new storage manager with a new database file

Source

pub fn open(path: &Path) -> Result<Self>

Open an existing database file

Source

pub fn node_count(&self) -> usize

Source

pub fn edge_count(&self) -> usize

Source

pub fn metadata_count(&self) -> usize

Source

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]

Source

pub fn get_metadata(&self, id: u64) -> Option<&MetadataRec>

Get a metadata record by ID

Source

pub fn insert_node(&mut self, node: NodeRec) -> Result<u64>

Source

pub fn insert_edge(&mut self, edge: EdgeRec) -> Result<u64>

Source

pub fn get_node(&self, id: u64) -> Option<&NodeRec>

Source

pub fn get_edge(&self, id: u64) -> Option<&EdgeRec>

Source

pub fn get_edges_for_node(&self, _node_id: u64) -> Vec<&EdgeRec>

Source

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

Source

pub fn get_node_at_timestamp( &self, logical_id: u64, timestamp: u64, ) -> Option<&NodeRec>

Source

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:

  1. Find the current version of the node (where end_ts == 0)
  2. Set end_ts = new_begin_ts on the current version (mark as superseded)
  3. Insert a new version with begin_ts = new_begin_ts, end_ts = 0

Returns the ID of the new version

Source

pub fn flush(&mut self) -> Result<()>

Source

pub fn rebuild_spatial_index(&mut self) -> Result<()>

Rebuild the spatial page store from all current nodes + edges. Call this explicitly after bulk insertions.

Source

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.

Source

pub fn spatial_point_query(&mut self, x: f32, y: f32, z: f32) -> Vec<u64>

Point query via dual-octree page store.

Source

pub fn maybe_load_spatial_store(&mut self) -> Result<()>

Try to load a persisted spatial page store from the sidecar file.

Trait Implementations§

Source§

impl Drop for StorageManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.