pub struct InfiniteDb { /* private fields */ }Expand description
Top-level embedded database handle and diagnostics.
The embedded database handle. Not Send/Sync — create one per thread
or wrap in a Mutex for multi-threaded access.
Implementations§
Source§impl InfiniteDb
impl InfiniteDb
pub fn begin_hyperedge_import( &mut self, space: SpaceId, ) -> Result<BulkHyperedgeImport<'_>>
pub fn begin_hyperedge_import_with_options( &mut self, space: SpaceId, options: BulkHyperedgeImportOptions, ) -> Result<BulkHyperedgeImport<'_>>
pub fn insert_hyperedges_bulk<I>(
&mut self,
space: SpaceId,
edges: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = Hyperedge>,
pub fn insert_hyperedges_bulk_with_options<I>(
&mut self,
space: SpaceId,
edges: I,
options: BulkHyperedgeImportOptions,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = Hyperedge>,
pub fn delete_hyperedges_bulk<I>(
&mut self,
space: SpaceId,
ids: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = HyperedgeId>,
Source§impl InfiniteDb
impl InfiniteDb
Sourcepub fn begin_record_import(
&mut self,
space: SpaceId,
) -> Result<BulkRecordImport<'_>>
pub fn begin_record_import( &mut self, space: SpaceId, ) -> Result<BulkRecordImport<'_>>
Begin a buffered bulk record import into space.
Sourcepub fn begin_record_import_with_options(
&mut self,
space: SpaceId,
options: BulkWriteOptions,
) -> Result<BulkRecordImport<'_>>
pub fn begin_record_import_with_options( &mut self, space: SpaceId, options: BulkWriteOptions, ) -> Result<BulkRecordImport<'_>>
Begin bulk record import with explicit WAL/flush tuning.
Sourcepub fn insert_records_bulk<I>(
&mut self,
space: SpaceId,
rows: I,
) -> Result<BulkWriteResult>
pub fn insert_records_bulk<I>( &mut self, space: SpaceId, rows: I, ) -> Result<BulkWriteResult>
Import many records in one bulk session.
Sourcepub fn delete_records_bulk<I>(
&mut self,
space: SpaceId,
points: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = DimensionVector>,
pub fn delete_records_bulk<I>(
&mut self,
space: SpaceId,
points: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = DimensionVector>,
Tombstone many record addresses in one bulk session.
Source§impl InfiniteDb
impl InfiniteDb
Source§impl InfiniteDb
impl InfiniteDb
Sourcepub fn begin_signal_import(
&mut self,
space: SpaceId,
) -> Result<BulkSignalImport<'_>>
pub fn begin_signal_import( &mut self, space: SpaceId, ) -> Result<BulkSignalImport<'_>>
Begin a buffered bulk signal import into space.
pub fn begin_signal_import_with_options( &mut self, space: SpaceId, options: BulkWriteOptions, ) -> Result<BulkSignalImport<'_>>
pub fn insert_signals_bulk<I>(
&mut self,
space: SpaceId,
samples: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = SignalSample>,
pub fn delete_signals_bulk<I>(
&mut self,
space: SpaceId,
samples: I,
) -> Result<BulkWriteResult>where
I: IntoIterator<Item = SignalSample>,
Source§impl InfiniteDb
impl InfiniteDb
Sourcepub fn open<P: AsRef<Path>>(dir: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(dir: P) -> Result<Self>
Open (or create) a database in dir. Replays the WAL on first open.
Sourcepub fn open_with_options<P: AsRef<Path>>(
dir: P,
options: &OpenOptions,
) -> Result<Self>
pub fn open_with_options<P: AsRef<Path>>( dir: P, options: &OpenOptions, ) -> Result<Self>
Open with explicit tuning (cache size, flush threshold, WAL policy).
Sourcepub fn register_space(&mut self, config: SpaceConfig) -> Result<(), String>
pub fn register_space(&mut self, config: SpaceConfig) -> Result<(), String>
Register a new space. Must be called before inserting records into it.
Sourcepub fn insert(
&mut self,
space: SpaceId,
point: DimensionVector,
data: Vec<u8>,
) -> Result<RevisionId>
pub fn insert( &mut self, space: SpaceId, point: DimensionVector, data: Vec<u8>, ) -> Result<RevisionId>
Insert or update a record. Appends a new revision to the WAL.
The record is buffered in memory; call flush() to seal it into a block.
Sourcepub fn delete(
&mut self,
space: SpaceId,
point: DimensionVector,
) -> Result<RevisionId>
pub fn delete( &mut self, space: SpaceId, point: DimensionVector, ) -> Result<RevisionId>
Logically delete a record at point in space.
Sourcepub fn insert_hyperedge(
&mut self,
space: SpaceId,
edge: Hyperedge,
) -> Result<RevisionId>
pub fn insert_hyperedge( &mut self, space: SpaceId, edge: Hyperedge, ) -> Result<RevisionId>
Insert or update a typed hyperedge record.
Sourcepub fn delete_hyperedge(
&mut self,
space: SpaceId,
id: HyperedgeId,
) -> Result<RevisionId>
pub fn delete_hyperedge( &mut self, space: SpaceId, id: HyperedgeId, ) -> Result<RevisionId>
Logically delete a hyperedge record by ID.
Sourcepub fn query_hyperedges(
&mut self,
space: SpaceId,
as_of: Option<RevisionId>,
) -> Result<Vec<Hyperedge>>
pub fn query_hyperedges( &mut self, space: SpaceId, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>
Query all decodable hyperedges from a space.
Sourcepub fn query_hyperedges_for_endpoint(
&mut self,
space: SpaceId,
endpoint: &EndpointRef,
as_of: Option<RevisionId>,
) -> Result<Vec<Hyperedge>>
pub fn query_hyperedges_for_endpoint( &mut self, space: SpaceId, endpoint: &EndpointRef, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>
Query hyperedges that reference the provided endpoint.
Uses the reverse endpoint index in ENDPOINT_INDEX_SPACE so this does
not scan every hyperedge in the space.
Sourcepub fn traverse(
&mut self,
edge_space: SpaceId,
spec: &TraversalSpec,
) -> Result<Subgraph>
pub fn traverse( &mut self, edge_space: SpaceId, spec: &TraversalSpec, ) -> Result<Subgraph>
BFS walk from spec.start, following hyperedges up to spec.max_depth.
Sourcepub fn query_hyperedges_by_kind(
&mut self,
space: SpaceId,
kind: &str,
as_of: Option<RevisionId>,
) -> Result<Vec<Hyperedge>>
pub fn query_hyperedges_by_kind( &mut self, space: SpaceId, kind: &str, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>
Query hyperedges by relationship kind.
Sourcepub fn insert_hyperedge_typed<K: KindLabel>(
&mut self,
space: SpaceId,
id: HyperedgeId,
kind: K,
endpoints: Vec<AdapterEndpoint>,
weight_milli: Option<i64>,
metadata: BTreeMap<String, String>,
valid_to: Option<RevisionId>,
catalog: Option<&KindCatalog>,
) -> Result<RevisionId>
pub fn insert_hyperedge_typed<K: KindLabel>( &mut self, space: SpaceId, id: HyperedgeId, kind: K, endpoints: Vec<AdapterEndpoint>, weight_milli: Option<i64>, metadata: BTreeMap<String, String>, valid_to: Option<RevisionId>, catalog: Option<&KindCatalog>, ) -> Result<RevisionId>
Adapter-friendly hyperedge write API with optional catalog enforcement.
Sourcepub fn query_hyperedges_by_kind_typed<K: KindLabel>(
&mut self,
space: SpaceId,
kind: K,
as_of: Option<RevisionId>,
) -> Result<Vec<Hyperedge>>
pub fn query_hyperedges_by_kind_typed<K: KindLabel>( &mut self, space: SpaceId, kind: K, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>
Adapter-friendly kind-filter query.
Sourcepub fn insert_signal_sample(
&mut self,
space: SpaceId,
sample: SignalSample,
) -> Result<RevisionId>
pub fn insert_signal_sample( &mut self, space: SpaceId, sample: SignalSample, ) -> Result<RevisionId>
Insert a signal sample in the provided signal space.
Sourcepub fn insert_signal_sample_typed<SB: SpaceBinding, K: KindLabel>(
&mut self,
signal_id: SignalId,
kind: K,
parent_prefix: DimensionVector,
local_coords: Vec<u32>,
value_milli: i64,
source_revision: Option<RevisionId>,
constraint: Option<SignalConstraint>,
catalog: Option<&KindCatalog>,
) -> Result<RevisionId>
pub fn insert_signal_sample_typed<SB: SpaceBinding, K: KindLabel>( &mut self, signal_id: SignalId, kind: K, parent_prefix: DimensionVector, local_coords: Vec<u32>, value_milli: i64, source_revision: Option<RevisionId>, constraint: Option<SignalConstraint>, catalog: Option<&KindCatalog>, ) -> Result<RevisionId>
Adapter-friendly signal write API bound to a typed space.
Sourcepub fn query_signal_scope(
&mut self,
space: SpaceId,
parent_coords: &[u32],
as_of: Option<RevisionId>,
) -> Result<Vec<SignalSample>>
pub fn query_signal_scope( &mut self, space: SpaceId, parent_coords: &[u32], as_of: Option<RevisionId>, ) -> Result<Vec<SignalSample>>
Query all signal samples under a parent scope prefix.
Sourcepub fn query_signal_range(
&mut self,
space: SpaceId,
parent_coords: &[u32],
min_local: &[u32],
max_local: &[u32],
as_of: Option<RevisionId>,
) -> Result<Vec<SignalSample>>
pub fn query_signal_range( &mut self, space: SpaceId, parent_coords: &[u32], min_local: &[u32], max_local: &[u32], as_of: Option<RevisionId>, ) -> Result<Vec<SignalSample>>
Query signal samples in a local coordinate range under a parent scope.
Sourcepub fn flush(&mut self, space: SpaceId) -> Result<()>
pub fn flush(&mut self, space: SpaceId) -> Result<()>
Seal all buffered records for space into a new block on disk.
Sourcepub fn current_snapshot(&self, space: SpaceId) -> Option<SnapshotId>
pub fn current_snapshot(&self, space: SpaceId) -> Option<SnapshotId>
Return the current snapshot ID for space.
Sourcepub fn query(
&mut self,
space: SpaceId,
as_of: Option<RevisionId>,
) -> Result<Vec<Record>>
pub fn query( &mut self, space: SpaceId, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>
Scan all live records in space, optionally capped at as_of.
Full-space scan — no spatial filtering. Use query_bbox to filter by coordinates.
Sourcepub fn execute(&mut self, q: &Query) -> Result<Vec<Record>>
pub fn execute(&mut self, q: &Query) -> Result<Vec<Record>>
Execute a Query descriptor against the space’s current snapshot.
Resolution order for the block-pruning key interval:
q.key_rangewhen present (a precomputed Hilbert interval);- otherwise derived from
q.range’s corner coordinates; - otherwise a full-space scan.
When q.range is set, an exact per-record coordinate filter is applied
so results match query_bbox. Historical snapshot reads are not yet
supported, so q.snapshot must match the space’s current snapshot.
Sourcepub fn query_bbox(
&mut self,
space: SpaceId,
min: DimensionVector,
max: DimensionVector,
as_of: Option<RevisionId>,
) -> Result<Vec<Record>>
pub fn query_bbox( &mut self, space: SpaceId, min: DimensionVector, max: DimensionVector, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>
Bounding-box query in N dimensions.
Returns every live record in space whose point satisfies
min[i] <= point[i] <= max[i] on every axis simultaneously.
Works correctly for any dimensionality (1–16 dims). A Hilbert-key
interval is used to prune candidate blocks at the block level; an
exact within() check per record eliminates any false positives caused
by the Hilbert curve mapping a bounding box to many disjoint intervals.
min and max must have the same number of coordinates as the points
stored in the space.
Sourcepub fn query_subscope(
&mut self,
space: SpaceId,
parent_coords: &[u32],
as_of: Option<RevisionId>,
) -> Result<Vec<Record>>
pub fn query_subscope( &mut self, space: SpaceId, parent_coords: &[u32], as_of: Option<RevisionId>, ) -> Result<Vec<Record>>
Sub-space query: pins the first parent_coords.len() dimensions to exact
values and leaves the remaining inner dimensions fully open (0..u32::MAX).
This is the idiomatic way to retrieve all property records for a specific parent element in the nested Hilbert design:
// All load properties of element 42:
db.query_subscope(SPACE_LOADS, &[42], None);Sourcepub fn branch_id(&self, name: &str) -> Option<BranchId>
pub fn branch_id(&self, name: &str) -> Option<BranchId>
Look up a branch ID by name, if one exists.
Sourcepub fn create_branch(
&mut self,
name: impl Into<String>,
from: BranchId,
) -> Result<BranchId, String>
pub fn create_branch( &mut self, name: impl Into<String>, from: BranchId, ) -> Result<BranchId, String>
Create a new branch forked from an existing one at the current revision.
Sourcepub fn memory_stats(&self) -> MemoryStats
pub fn memory_stats(&self) -> MemoryStats
Returns a snapshot of current memory and cache usage.
Sourcepub fn snapshot_for_space(&self, space: SpaceId) -> Option<Snapshot>
pub fn snapshot_for_space(&self, space: SpaceId) -> Option<Snapshot>
Return the active snapshot for a space, if one exists.
Sourcepub fn read_block(&mut self, id: BlockId) -> Result<Block>
pub fn read_block(&mut self, id: BlockId) -> Result<Block>
Read a sealed block from disk (through the LRU cache).
Sourcepub fn compact_space(
&mut self,
space: SpaceId,
config: &CompactionConfig,
) -> Result<CompactionResult>
pub fn compact_space( &mut self, space: SpaceId, config: &CompactionConfig, ) -> Result<CompactionResult>
Merge fragmented blocks in space into fewer larger blocks.