Skip to main content

Database

Struct Database 

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

Open OXGDB database handle.

§Performance

Moving a handle is O(n) for the owned in-memory database state.

Implementations§

Source§

impl Database

Source

pub fn create(path: impl AsRef<Path>) -> Result<Self, DbError>

Creates a new empty OXGDB database at path.

§Errors

Returns DbError::AlreadyExists when a greenfield store already exists, or DbError::Io when creation fails.

§Performance

This function is O(path length + empty store bytes).

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, DbError>

Opens an existing OXGDB database.

§Errors

Returns DbError when the store is missing, malformed, or semantically invalid.

§Performance

This function is O(serialized database bytes).

Source

pub fn validate_path(path: impl AsRef<Path>) -> Result<(), DbError>

Validates an OXGDB database at path.

§Errors

Returns DbError when store or semantic validation fails.

§Performance

This function is O(serialized database bytes).

Source

pub fn compact(&mut self) -> Result<(), DbError>

Rewrites the store in the current greenfield format.

§Errors

Returns DbError when validation, encoding, writing, or replacement fails.

§Performance

This method is O(serialized database bytes).

Source

pub fn validate(&self) -> Result<(), DbError>

Validates this open handle’s store and in-memory state.

§Errors

Returns DbError when validation fails.

§Performance

This method is O(serialized database bytes).

Source

pub fn status(&self) -> DatabaseStatus

Returns operational status for this handle.

§Performance

This method is O(1).

Source

pub fn catalog_summary(&self) -> CatalogSummary

Returns a catalog-size summary.

§Performance

This method is O(catalog entry count).

Source

pub fn begin_read(&self) -> ReadTransaction

Starts a read transaction pinned to the current visible generation.

§Performance

This method is O(1): the reader shares the committed state through an atomically reference-counted handle rather than copying it. A later committed generation does not disturb a reader already holding its generation’s handle.

Source

pub fn begin_write(&mut self) -> Result<WriteTransaction<'_>, DbError>

Starts the single writer transaction.

§Errors

Returns DbError::TransactionIdOverflow when writer IDs are exhausted.

§Performance

This method is O(1): the writer shares the committed base through an atomically reference-counted handle and copies it lazily on the first mutation (copy-on-write), so an empty or rolled-back transaction never clones the state.

Source

pub fn prepare( &self, language: QueryLanguage, query: &str, ) -> Result<PreparedQuery, DbError>

Prepares a query against the current catalog.

§Errors

Returns DbError when parsing or semantic analysis fails.

§Performance

This method is O(query length + catalog lookup cost).

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.