Skip to main content

InfiniteDb

Struct InfiniteDb 

Source
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

Source

pub fn begin_hyperedge_import( &mut self, space: SpaceId, ) -> Result<BulkHyperedgeImport<'_>>

Source

pub fn begin_hyperedge_import_with_options( &mut self, space: SpaceId, options: BulkHyperedgeImportOptions, ) -> Result<BulkHyperedgeImport<'_>>

Source

pub fn insert_hyperedges_bulk<I>( &mut self, space: SpaceId, edges: I, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = Hyperedge>,

Source

pub fn insert_hyperedges_bulk_with_options<I>( &mut self, space: SpaceId, edges: I, options: BulkHyperedgeImportOptions, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = Hyperedge>,

Source

pub fn delete_hyperedges_bulk<I>( &mut self, space: SpaceId, ids: I, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = HyperedgeId>,

Source§

impl InfiniteDb

Source

pub fn begin_record_import( &mut self, space: SpaceId, ) -> Result<BulkRecordImport<'_>>

Begin a buffered bulk record import into space.

Source

pub fn begin_record_import_with_options( &mut self, space: SpaceId, options: BulkWriteOptions, ) -> Result<BulkRecordImport<'_>>

Begin bulk record import with explicit WAL/flush tuning.

Source

pub fn insert_records_bulk<I>( &mut self, space: SpaceId, rows: I, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = (DimensionVector, Vec<u8>)>,

Import many records in one bulk session.

Source

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

Source

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

Force the WAL buffer to disk (strict durability escape hatch).

Source§

impl InfiniteDb

Source

pub fn begin_signal_import( &mut self, space: SpaceId, ) -> Result<BulkSignalImport<'_>>

Begin a buffered bulk signal import into space.

Source

pub fn begin_signal_import_with_options( &mut self, space: SpaceId, options: BulkWriteOptions, ) -> Result<BulkSignalImport<'_>>

Source

pub fn insert_signals_bulk<I>( &mut self, space: SpaceId, samples: I, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = SignalSample>,

Source

pub fn delete_signals_bulk<I>( &mut self, space: SpaceId, samples: I, ) -> Result<BulkWriteResult>
where I: IntoIterator<Item = SignalSample>,

Source§

impl InfiniteDb

Source

pub fn open<P: AsRef<Path>>(dir: P) -> Result<Self>

Open (or create) a database in dir. Replays the WAL on first open.

Source

pub fn open_with_options<P: AsRef<Path>>( dir: P, options: &OpenOptions, ) -> Result<Self>

Open with explicit tuning (cache size, flush threshold, WAL policy).

Source

pub fn register_space(&mut self, config: SpaceConfig) -> Result<(), String>

Register a new space. Must be called before inserting records into it.

Source

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.

Source

pub fn delete( &mut self, space: SpaceId, point: DimensionVector, ) -> Result<RevisionId>

Logically delete a record at point in space.

Source

pub fn insert_hyperedge( &mut self, space: SpaceId, edge: Hyperedge, ) -> Result<RevisionId>

Insert or update a typed hyperedge record.

Source

pub fn delete_hyperedge( &mut self, space: SpaceId, id: HyperedgeId, ) -> Result<RevisionId>

Logically delete a hyperedge record by ID.

Source

pub fn query_hyperedges( &mut self, space: SpaceId, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>

Query all decodable hyperedges from a space.

Source

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.

Source

pub fn traverse( &mut self, edge_space: SpaceId, spec: &TraversalSpec, ) -> Result<Subgraph>

BFS walk from spec.start, following hyperedges up to spec.max_depth.

Source

pub fn query_hyperedges_by_kind( &mut self, space: SpaceId, kind: &str, as_of: Option<RevisionId>, ) -> Result<Vec<Hyperedge>>

Query hyperedges by relationship kind.

Source

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.

Source

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.

Source

pub fn insert_signal_sample( &mut self, space: SpaceId, sample: SignalSample, ) -> Result<RevisionId>

Insert a signal sample in the provided signal space.

Source

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.

Source

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.

Source

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.

Source

pub fn flush(&mut self, space: SpaceId) -> Result<()>

Seal all buffered records for space into a new block on disk.

Source

pub fn current_snapshot(&self, space: SpaceId) -> Option<SnapshotId>

Return the current snapshot ID for space.

Source

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.

Source

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:

  1. q.key_range when present (a precomputed Hilbert interval);
  2. otherwise derived from q.range’s corner coordinates;
  3. 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.

Source

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.

Source

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);
Source

pub fn branch_id(&self, name: &str) -> Option<BranchId>

Look up a branch ID by name, if one exists.

Source

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.

Source

pub fn memory_stats(&self) -> MemoryStats

Returns a snapshot of current memory and cache usage.

Source

pub fn snapshot_for_space(&self, space: SpaceId) -> Option<Snapshot>

Return the active snapshot for a space, if one exists.

Source

pub fn revision(&self) -> u64

Current monotonic revision counter.

Source

pub fn read_block(&mut self, id: BlockId) -> Result<Block>

Read a sealed block from disk (through the LRU cache).

Source

pub fn compact_space( &mut self, space: SpaceId, config: &CompactionConfig, ) -> Result<CompactionResult>

Merge fragmented blocks in space into fewer larger blocks.

Source

pub fn gc_blocks(&mut self, superseded: &[BlockId]) -> Result<usize>

Delete block files that are no longer referenced by any live snapshot.

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.