pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open_memory() -> Self
pub fn begin(&self) -> TxId
pub fn commit(&self, tx: TxId) -> Result<()>
pub fn rollback(&self, tx: TxId) -> Result<()>
pub fn snapshot(&self) -> SnapshotId
pub fn execute( &self, sql: &str, params: &HashMap<String, Value>, ) -> Result<QueryResult>
pub fn explain(&self, sql: &str) -> Result<String>
pub fn execute_in_tx( &self, tx: TxId, sql: &str, params: &HashMap<String, Value>, ) -> Result<QueryResult>
pub fn insert_row( &self, tx: TxId, table: &str, values: HashMap<ColName, Value>, ) -> Result<RowId>
pub fn upsert_row( &self, tx: TxId, table: &str, conflict_col: &str, values: HashMap<ColName, Value>, ) -> Result<UpsertResult>
pub fn delete_row(&self, tx: TxId, table: &str, row_id: RowId) -> Result<()>
pub fn scan( &self, table: &str, snapshot: SnapshotId, ) -> Result<Vec<VersionedRow>>
pub fn scan_filter( &self, table: &str, snapshot: SnapshotId, predicate: &dyn Fn(&VersionedRow) -> bool, ) -> Result<Vec<VersionedRow>>
pub fn point_lookup( &self, table: &str, col: &str, value: &Value, snapshot: SnapshotId, ) -> Result<Option<VersionedRow>>
pub fn insert_edge( &self, tx: TxId, source: NodeId, target: NodeId, edge_type: EdgeType, properties: HashMap<String, Value>, ) -> Result<bool>
pub fn delete_edge( &self, tx: TxId, source: NodeId, target: NodeId, edge_type: &str, ) -> Result<()>
pub fn query_bfs( &self, start: NodeId, edge_types: Option<&[EdgeType]>, direction: Direction, max_depth: u32, snapshot: SnapshotId, ) -> Result<TraversalResult>
pub fn edge_count( &self, source: NodeId, edge_type: &str, snapshot: SnapshotId, ) -> Result<usize>
pub fn get_edge_properties( &self, source: NodeId, target: NodeId, edge_type: &str, snapshot: SnapshotId, ) -> Result<Option<HashMap<String, Value>>>
pub fn insert_vector( &self, tx: TxId, row_id: RowId, vector: Vec<f32>, ) -> Result<()>
pub fn delete_vector(&self, tx: TxId, row_id: RowId) -> Result<()>
pub fn query_vector( &self, query: &[f32], k: usize, candidates: Option<&RoaringTreemap>, snapshot: SnapshotId, ) -> Result<Vec<(RowId, f32)>>
pub fn has_live_vector(&self, row_id: RowId, snapshot: SnapshotId) -> bool
pub fn live_vector_entry( &self, row_id: RowId, snapshot: SnapshotId, ) -> Option<VectorEntry>
pub fn table_names(&self) -> Vec<String>
pub fn table_meta(&self, table: &str) -> Option<TableMeta>
Sourcepub fn run_pruning_cycle(&self) -> u64
pub fn run_pruning_cycle(&self) -> u64
Run one pruning cycle. Called by the background loop or manually in tests.
Sourcepub fn set_pruning_interval(&self, interval: Duration)
pub fn set_pruning_interval(&self, interval: Duration)
Set the pruning loop interval. Test-only API.
pub fn sync_watermark(&self) -> Lsn
pub fn set_sync_watermark(&self, watermark: Lsn)
pub fn instance_id(&self) -> Uuid
pub fn open_memory_with_plugin_and_accountant( plugin: Arc<dyn DatabasePlugin>, accountant: Arc<MemoryAccountant>, ) -> Result<Self>
pub fn open_memory_with_plugin(plugin: Arc<dyn DatabasePlugin>) -> Result<Self>
pub fn close(&self) -> Result<()>
Sourcepub fn open_with_plugin(
path: impl AsRef<Path>,
plugin: Arc<dyn DatabasePlugin>,
) -> Result<Self>
pub fn open_with_plugin( path: impl AsRef<Path>, plugin: Arc<dyn DatabasePlugin>, ) -> Result<Self>
File-backed database with custom plugin.
Sourcepub fn open_with_config(
path: impl AsRef<Path>,
plugin: Arc<dyn DatabasePlugin>,
accountant: Arc<MemoryAccountant>,
) -> Result<Self>
pub fn open_with_config( path: impl AsRef<Path>, plugin: Arc<dyn DatabasePlugin>, accountant: Arc<MemoryAccountant>, ) -> Result<Self>
Full constructor with budget.
pub fn open_with_config_and_disk_limit( path: impl AsRef<Path>, plugin: Arc<dyn DatabasePlugin>, accountant: Arc<MemoryAccountant>, startup_disk_limit: Option<u64>, ) -> Result<Self>
Sourcepub fn open_memory_with_accountant(accountant: Arc<MemoryAccountant>) -> Self
pub fn open_memory_with_accountant(accountant: Arc<MemoryAccountant>) -> Self
In-memory database with budget.
Sourcepub fn accountant(&self) -> &MemoryAccountant
pub fn accountant(&self) -> &MemoryAccountant
Access the memory accountant.
Sourcepub fn conflict_policies(&self) -> ConflictPolicies
pub fn conflict_policies(&self) -> ConflictPolicies
Get a clone of the current conflict policies.
Sourcepub fn set_default_conflict_policy(&self, policy: ConflictPolicy)
pub fn set_default_conflict_policy(&self, policy: ConflictPolicy)
Set the default conflict policy.
Sourcepub fn set_table_conflict_policy(&self, table: &str, policy: ConflictPolicy)
pub fn set_table_conflict_policy(&self, table: &str, policy: ConflictPolicy)
Set a per-table conflict policy.
Sourcepub fn drop_table_conflict_policy(&self, table: &str)
pub fn drop_table_conflict_policy(&self, table: &str)
Remove a per-table conflict policy override.
pub fn plugin(&self) -> &dyn DatabasePlugin
pub fn plugin_health(&self) -> PluginHealth
pub fn plugin_describe(&self) -> Value
pub fn set_disk_limit(&self, limit: Option<u64>) -> Result<()>
pub fn disk_limit(&self) -> Option<u64>
pub fn disk_limit_startup_ceiling(&self) -> Option<u64>
pub fn disk_file_size(&self) -> Option<u64>
pub fn check_disk_budget(&self, operation: &str) -> Result<()>
pub fn persisted_sync_watermarks(&self, tenant_id: &str) -> Result<(Lsn, Lsn)>
pub fn persist_sync_push_watermark( &self, tenant_id: &str, watermark: Lsn, ) -> Result<()>
pub fn persist_sync_pull_watermark( &self, tenant_id: &str, watermark: Lsn, ) -> Result<()>
pub fn change_log_since(&self, since_lsn: Lsn) -> Vec<ChangeLogEntry>
pub fn ddl_log_since(&self, since_lsn: Lsn) -> Vec<DdlChange>
Sourcepub fn changes_since(&self, since_lsn: Lsn) -> ChangeSet
pub fn changes_since(&self, since_lsn: Lsn) -> ChangeSet
Extracts changes from this database since the given LSN.
Sourcepub fn current_lsn(&self) -> Lsn
pub fn current_lsn(&self) -> Lsn
Returns the current LSN of this database.
Sourcepub fn committed_watermark(&self) -> TxId
pub fn committed_watermark(&self) -> TxId
Returns the highest-committed TxId on this database.
Sourcepub fn subscribe(&self) -> Receiver<CommitEvent>
pub fn subscribe(&self) -> Receiver<CommitEvent>
Subscribe to commit events. Returns a receiver that yields a CommitEvent
after each commit.
Sourcepub fn subscribe_with_capacity(&self, capacity: usize) -> Receiver<CommitEvent>
pub fn subscribe_with_capacity(&self, capacity: usize) -> Receiver<CommitEvent>
Subscribe with a custom channel capacity.
Sourcepub fn subscription_health(&self) -> SubscriptionMetrics
pub fn subscription_health(&self) -> SubscriptionMetrics
Returns health metrics for the subscription system.
Sourcepub fn apply_changes(
&self,
changes: ChangeSet,
policies: &ConflictPolicies,
) -> Result<ApplyResult>
pub fn apply_changes( &self, changes: ChangeSet, policies: &ConflictPolicies, ) -> Result<ApplyResult>
Applies a ChangeSet to this database with the given conflict policies.
Trait Implementations§
Source§impl ChangeApplication for Database
impl ChangeApplication for Database
fn apply_changes( &self, changes: ChangeSet, policies: &ConflictPolicies, ) -> Result<ApplyResult>
Source§impl ChangeTracking for Database
impl ChangeTracking for Database
fn changes_since(&self, since_lsn: Lsn) -> ChangeSet
fn current_lsn(&self) -> Lsn
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl !UnwindSafe 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
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