pub struct Engine { /* private fields */ }Expand description
Active [OxGraph] backend state loaded from OXGTOPO bytes.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn node_count(&self) -> u32
pub fn node_count(&self) -> u32
Returns the canonical node count from artifact metadata.
Sourcepub fn from_snapshot_bytes(bytes: &[u8]) -> Result<Self, PostgresGraphError>
pub fn from_snapshot_bytes(bytes: &[u8]) -> Result<Self, PostgresGraphError>
Loads an engine via EngineBuilder.
§Errors
Returns PostgresGraphError when snapshot validation or topology attach fails.
Sourcepub fn stats(&self) -> EngineStatus
pub fn stats(&self) -> EngineStatus
Returns operational status for admin surfaces.
Sourcepub fn set_config(&mut self, config: Config) -> Result<(), PostgresGraphError>
pub fn set_config(&mut self, config: Config) -> Result<(), PostgresGraphError>
Updates configuration after validation.
§Errors
Returns PostgresGraphError::Config when limits or freshness settings are invalid.
Sourcepub const fn overlay(&self) -> &OverlayState
pub const fn overlay(&self) -> &OverlayState
Borrows overlay state for read-only query visibility checks.
Sourcepub const fn overlay_mut(&mut self) -> &mut OverlayState
pub const fn overlay_mut(&mut self) -> &mut OverlayState
Borrows the overlay buffer for sync replay.
Sourcepub fn snapshot_bytes(&self) -> &[u8] ⓘ
pub fn snapshot_bytes(&self) -> &[u8] ⓘ
Returns immutable snapshot bytes backing the engine.
Sourcepub fn topology(&self) -> &GraphTopology<'_>
pub fn topology(&self) -> &GraphTopology<'_>
Returns both topology views opened at engine build.
Sourcepub fn forward(&self) -> &ForwardCsr<'_>
pub fn forward(&self) -> &ForwardCsr<'_>
Returns the forward CSR view (outgoing adjacency only).
Sourcepub fn inbound(&self) -> &InboundCsc<'_>
pub fn inbound(&self) -> &InboundCsc<'_>
Returns the inbound CSC view (incoming adjacency only).
Sourcepub fn replace_snapshot_bytes(
&mut self,
bytes: &[u8],
) -> Result<(), PostgresGraphError>
pub fn replace_snapshot_bytes( &mut self, bytes: &[u8], ) -> Result<(), PostgresGraphError>
Replaces artifact bytes after maintenance rebuild.
§Errors
Returns PostgresGraphError when the replacement snapshot fails validation.
Sourcepub fn traverse(
&mut self,
seed: u32,
limits: TraverseLimits,
direction: TraversalDirection,
) -> Result<Vec<u32>, PostgresGraphError>
pub fn traverse( &mut self, seed: u32, limits: TraverseLimits, direction: TraversalDirection, ) -> Result<Vec<u32>, PostgresGraphError>
Breadth-first traversal from one seed node.
§Errors
Returns PostgresGraphError::Query when the seed is out of bounds or limits are zero.
§Performance
This method is O(r + e) where r is nodes discovered up to result_limit and e is
edges examined along the chosen profile; ≤ 1ms for n ≤ 10k on typical chain fixtures.
Sourcepub fn traverse_from_seeds(
&mut self,
seeds: &[u32],
limits: TraverseLimits,
direction: TraversalDirection,
) -> Result<Vec<u32>, PostgresGraphError>
pub fn traverse_from_seeds( &mut self, seeds: &[u32], limits: TraverseLimits, direction: TraversalDirection, ) -> Result<Vec<u32>, PostgresGraphError>
Breadth-first traversal from multiple seed nodes in one kernel run.
§Errors
Returns PostgresGraphError::Query when every seed is out of bounds or limits are zero.
§Performance
Same as Self::traverse with multiple seeds; one kernel run.
Sourcepub fn visited_count(
&mut self,
seed: u32,
limits: TraverseLimits,
direction: TraversalDirection,
) -> Result<usize, PostgresGraphError>
pub fn visited_count( &mut self, seed: u32, limits: TraverseLimits, direction: TraversalDirection, ) -> Result<usize, PostgresGraphError>
Returns visited-node count for one seed without collecting ids.
§Errors
Returns PostgresGraphError::Query when the seed is out of bounds or limits are zero.
§Performance
This method is O(r + e) without output allocation; matches collect cardinality.
Sourcepub fn search(
&self,
predicate: SearchPredicate,
limit: NonZeroUsize,
) -> Result<Vec<u32>, PostgresGraphError>
pub fn search( &self, predicate: SearchPredicate, limit: NonZeroUsize, ) -> Result<Vec<u32>, PostgresGraphError>
Searches dense node ids using a simple predicate.
§Errors
Returns PostgresGraphError::Query when the effective limit is zero.
§Performance
This method is O(n) for n canonical nodes until the effective limit is reached.
Sourcepub fn apply_sync_rows(
&mut self,
rows: &[SyncRow],
) -> Result<usize, PostgresGraphError>
pub fn apply_sync_rows( &mut self, rows: &[SyncRow], ) -> Result<usize, PostgresGraphError>
Applies sync rows to the overlay in sequence order.
§Errors
Returns PostgresGraphError::Sync when row sequence numbers are not monotonic.
Sourcepub fn sync_health(&self) -> SyncHealth
pub fn sync_health(&self) -> SyncHealth
Returns sync overlay health for admin surfaces.
Sourcepub fn rebuild_from_catalog(
&mut self,
catalog: &Catalog,
edges: &[EdgeRow],
built_at_unix: u64,
) -> Result<(), PostgresGraphError>
pub fn rebuild_from_catalog( &mut self, catalog: &Catalog, edges: &[EdgeRow], built_at_unix: u64, ) -> Result<(), PostgresGraphError>
Rebuilds the base artifact from catalog metadata and freshly scanned edge rows.
§Errors
Returns PostgresGraphError::Config when maintenance is disabled, or build/validation
errors from catalog planning and snapshot encoding.