pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
Sourcepub fn set_spill_threshold(&self, bytes: u64)
pub fn set_spill_threshold(&self, bytes: u64)
Override the spill threshold at runtime (via SET spill_threshold).
A value of 0 explicitly disables spilling.
Sourcepub fn effective_spill_threshold(&self) -> u64
pub fn effective_spill_threshold(&self) -> u64
Get the effective spill threshold in bytes.
Priority:
- Runtime override (via
SET spill_threshold;0= explicitly disabled) config.spill_threshold- 80% of
buffer_pool_size - 0 (disabled)
Sourcepub fn spiller(&self) -> Option<Arc<Spiller>>
pub fn spiller(&self) -> Option<Arc<Spiller>>
Create a Spiller instance using the current database configuration.
Returns None if spilling is disabled (threshold is 0).
Sourcepub fn storage_driver(&self) -> StorageDriver
pub fn storage_driver(&self) -> StorageDriver
Create a [StorageDriver] for programmatic storage-level access
(page counts, buffer stats, file sizes, table counts) without Cypher.
Sourcepub fn catalog(&self) -> Arc<Mutex<Catalog>> ⓘ
pub fn catalog(&self) -> Arc<Mutex<Catalog>> ⓘ
Get a reference to the schema catalog for programmatic metadata access.
Sourcepub fn table_catalog(&self) -> Arc<TableCatalog> ⓘ
pub fn table_catalog(&self) -> Arc<TableCatalog> ⓘ
Get the data table catalog for programmatic data access.
Prefer using the unified DDL methods on Database instead of
accessing the table catalog directly.
Sourcepub fn create_node_table(
&self,
name: String,
columns: Vec<CatalogColumn>,
) -> Result<u64, String>
pub fn create_node_table( &self, name: String, columns: Vec<CatalogColumn>, ) -> Result<u64, String>
Create a node table: data table + serial sequences + ART index.
The schema entry is created by the binder during bind().
This method creates the storage-level table and associated resources.
Sourcepub fn create_rel_table(
&self,
name: String,
src_table_id: u64,
dst_table_id: u64,
columns: Vec<CatalogColumn>,
) -> Result<u64, String>
pub fn create_rel_table( &self, name: String, src_table_id: u64, dst_table_id: u64, columns: Vec<CatalogColumn>, ) -> Result<u64, String>
Create a rel table: data table.
The schema entry is created by the binder during bind().
This method creates the storage-level table.
Sourcepub fn drop_table(&self, name: &str) -> Result<(), String>
pub fn drop_table(&self, name: &str) -> Result<(), String>
Drop a table: serial sequences + data table + schema entry.
Sourcepub fn refresh_vector_indexes(&self, _table_ids: &[u64])
pub fn refresh_vector_indexes(&self, _table_ids: &[u64])
No-op when the vector extension is not compiled in.
Sourcepub fn create_art_index(
&self,
table_name: &str,
index_name: &str,
) -> Result<(), String>
pub fn create_art_index( &self, table_name: &str, index_name: &str, ) -> Result<(), String>
Create an ART index on a node table: data index.
The schema entry is created by the binder during bind().
Sourcepub fn drop_art_index(
&self,
table_name: &str,
_index_name: &str,
) -> Result<(), String>
pub fn drop_art_index( &self, table_name: &str, _index_name: &str, ) -> Result<(), String>
Drop an ART index from a node table: data index + schema entry.
Sourcepub fn table_num_rows(&self, name: &str) -> u64
pub fn table_num_rows(&self, name: &str) -> u64
Get the number of rows in a table by name.
Sourcepub fn get_table_id(&self, name: &str) -> Result<Option<u64>, String>
pub fn get_table_id(&self, name: &str) -> Result<Option<u64>, String>
Get table IDs for write operations (used by transaction locking).
Propagates a poisoned catalog lock instead of silently treating it as a missing table (Audit 2 NIT).
Sourcepub fn catalog_file_path(&self) -> PathBuf
pub fn catalog_file_path(&self) -> PathBuf
Path of the persisted catalog file for this database.
Sourcepub fn connect_tcp(addr: impl Into<String>) -> Result<RemoteDatabase, String>
pub fn connect_tcp(addr: impl Into<String>) -> Result<RemoteDatabase, String>
Connect to a remote Akar server (embedded server mode, P47).
The server process owns the Database instance and its exclusive file
lock; remote clients only talk to the server over TCP and never open the
database directory themselves. Multiple processes can therefore access
the same database concurrently: one writer via the server plus any
number of read-only clients (and additional writers when
concurrent_writes is enabled).
See crate::remote::RemoteDatabase for the returned handle’s API.
Sourcepub fn is_in_memory(&self) -> bool
pub fn is_in_memory(&self) -> bool
Returns true when the database runs fully in-memory (:memory:),
in which case catalog persistence is skipped.
Sourcepub fn persist_catalog(&self) -> Result<(), String>
pub fn persist_catalog(&self) -> Result<(), String>
Persist the system catalog to disk.
Called after every DDL statement so schema changes survive restarts.
The write is atomic (temp file + rename) and no-ops for :memory:
databases.
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl !UnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more