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 open<P: AsRef<Path>>(dir: P) -> Result<Self>

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

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 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 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 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.

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.