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
impl Database
Sourcepub fn create(path: impl AsRef<Path>) -> Result<Self, DbError>
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).
Sourcepub fn status(&self) -> DatabaseStatus
pub fn status(&self) -> DatabaseStatus
Sourcepub fn catalog_summary(&self) -> CatalogSummary
pub fn catalog_summary(&self) -> CatalogSummary
Sourcepub fn begin_read(&self) -> ReadTransaction
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.
Sourcepub fn begin_write(&mut self) -> Result<WriteTransaction<'_>, DbError>
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.