Skip to main content

InfiniteDb

Struct InfiniteDb 

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

Thread-safe embedded database with concurrent reads and fire-and-forget writes.

Implementations§

Source§

impl InfiniteDb

Source

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

Open or create a database at dir with default OpenOptions.

Source

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

Open or create a database at dir with explicit tuning and format version.

Source

pub fn branch_head(&self, branch: BranchId) -> Option<SnapshotId>

Head snapshot pointer for branch.

Source

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

Resolve a branch id by name.

Source

pub fn conflicts(&self) -> &ConflictQueue

Conflict queue populated during sync replication (requires sync feature).

Source

pub fn format_version(&self) -> u32

On-disk format version (2, 3, or 4) for this database directory.

Source

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

Register a new space and persist catalog metadata. Required before writes to that space.

Source

pub fn insert( &self, space: SpaceId, point: DimensionVector, data: Vec<u8>, ) -> Result<RevisionId>

Fire-and-forget insert on main. Blocks only when the target queue is full.

Source

pub fn insert_on_branch( &self, branch: BranchId, space: SpaceId, point: DimensionVector, data: Vec<u8>, ) -> Result<RevisionId>

Fire-and-forget insert on a branch (overlay for non-main branches).

Source

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

Fire-and-forget delete on main.

Source

pub fn delete_on_branch( &self, branch: BranchId, space: SpaceId, point: DimensionVector, ) -> Result<RevisionId>

Fire-and-forget delete on a branch.

Source

pub fn create_branch( &self, name: &str, from: BranchId, ) -> Result<BranchId, String>

Fork a new branch from from at the current revision.

Source

pub fn merge_branch( &self, target: BranchId, source: BranchId, strategy: MergeStrategy, resolver: Option<Box<dyn Fn(MergeConflict) -> Record + Send + Sync>>, ) -> Result<MergeResult>

Three-way merge source into target (usually main).

Source

pub fn query_on_branch( &self, branch: BranchId, space: SpaceId, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>

Query space through a branch overlay.

Source

pub fn enqueue_batch(&self, jobs: Vec<WriteJob>) -> Result<()>

Enqueue writes across multiple spaces (ordered by space id).

Caller-supplied WriteJob::revision values must not exceed the global revision counter; this method advances the counter to the maximum job revision.

Source

pub fn query( &self, space: SpaceId, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>

Query all live records in space on main, optionally capped at as_of.

Source

pub fn query_bbox( &self, space: SpaceId, min: DimensionVector, max: DimensionVector, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>

Bounding-box query on main.

Source

pub fn query_bbox_on_branch( &self, branch: BranchId, space: SpaceId, min: DimensionVector, max: DimensionVector, as_of: Option<RevisionId>, ) -> Result<Vec<Record>>

Bounding-box query through a branch overlay.

Source

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

Flush pending writes for one space to durable storage without syncing all spaces.

Source

pub fn sync(&self) -> Result<()>

Flush all write queues and persist metadata. Call after writes to make data queryable.

Source

pub fn revision(&self) -> u64

Current monotonic revision counter (logical write clock).

Source

pub fn read(&self) -> ReadTxn<'_>

Begin a concurrent read transaction pinned at the current revision.

Source

pub fn io_stats(&self) -> IoStats

I/O queue depth and write-path counters across all backend threads.

Source

pub fn space_shard_count(&self) -> usize

Number of I/O shards (1 for format v2, per-space or per-Hilbert-shard for v3/v4).

Trait Implementations§

Source§

impl Drop for InfiniteDb

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.