Skip to main content

Database

Struct Database 

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

Implementations§

Source§

impl Database

Source

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

Source

pub fn open_memory() -> Self

Source

pub fn begin(&self) -> TxId

Source

pub fn commit(&self, tx: TxId) -> Result<()>

Source

pub fn rollback(&self, tx: TxId) -> Result<()>

Source

pub fn snapshot(&self) -> SnapshotId

Source

pub fn execute( &self, sql: &str, params: &HashMap<String, Value>, ) -> Result<QueryResult>

Source

pub fn explain(&self, sql: &str) -> Result<String>

Source

pub fn execute_in_tx( &self, tx: TxId, sql: &str, params: &HashMap<String, Value>, ) -> Result<QueryResult>

Source

pub fn insert_row( &self, tx: TxId, table: &str, values: HashMap<ColName, Value>, ) -> Result<RowId>

Source

pub fn upsert_row( &self, tx: TxId, table: &str, conflict_col: &str, values: HashMap<ColName, Value>, ) -> Result<UpsertResult>

Source

pub fn delete_row(&self, tx: TxId, table: &str, row_id: RowId) -> Result<()>

Source

pub fn scan( &self, table: &str, snapshot: SnapshotId, ) -> Result<Vec<VersionedRow>>

Source

pub fn scan_filter( &self, table: &str, snapshot: SnapshotId, predicate: &dyn Fn(&VersionedRow) -> bool, ) -> Result<Vec<VersionedRow>>

Source

pub fn point_lookup( &self, table: &str, col: &str, value: &Value, snapshot: SnapshotId, ) -> Result<Option<VersionedRow>>

Source

pub fn insert_edge( &self, tx: TxId, source: NodeId, target: NodeId, edge_type: EdgeType, properties: HashMap<String, Value>, ) -> Result<bool>

Source

pub fn delete_edge( &self, tx: TxId, source: NodeId, target: NodeId, edge_type: &str, ) -> Result<()>

Source

pub fn query_bfs( &self, start: NodeId, edge_types: Option<&[EdgeType]>, direction: Direction, max_depth: u32, snapshot: SnapshotId, ) -> Result<TraversalResult>

Source

pub fn edge_count( &self, source: NodeId, edge_type: &str, snapshot: SnapshotId, ) -> Result<usize>

Source

pub fn get_edge_properties( &self, source: NodeId, target: NodeId, edge_type: &str, snapshot: SnapshotId, ) -> Result<Option<HashMap<String, Value>>>

Source

pub fn insert_vector( &self, tx: TxId, row_id: RowId, vector: Vec<f32>, ) -> Result<()>

Source

pub fn delete_vector(&self, tx: TxId, row_id: RowId) -> Result<()>

Source

pub fn query_vector( &self, query: &[f32], k: usize, candidates: Option<&RoaringTreemap>, snapshot: SnapshotId, ) -> Result<Vec<(RowId, f32)>>

Source

pub fn has_live_vector(&self, row_id: RowId, snapshot: SnapshotId) -> bool

Source

pub fn live_vector_entry( &self, row_id: RowId, snapshot: SnapshotId, ) -> Option<VectorEntry>

Source

pub fn table_names(&self) -> Vec<String>

Source

pub fn table_meta(&self, table: &str) -> Option<TableMeta>

Source

pub fn run_pruning_cycle(&self) -> u64

Run one pruning cycle. Called by the background loop or manually in tests.

Source

pub fn set_pruning_interval(&self, interval: Duration)

Set the pruning loop interval. Test-only API.

Source

pub fn sync_watermark(&self) -> u64

Source

pub fn set_sync_watermark(&self, watermark: u64)

Source

pub fn instance_id(&self) -> Uuid

Source

pub fn open_memory_with_plugin_and_accountant( plugin: Arc<dyn DatabasePlugin>, accountant: Arc<MemoryAccountant>, ) -> Result<Self>

Source

pub fn open_memory_with_plugin(plugin: Arc<dyn DatabasePlugin>) -> Result<Self>

Source

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

Source

pub fn open_with_plugin( path: impl AsRef<Path>, plugin: Arc<dyn DatabasePlugin>, ) -> Result<Self>

File-backed database with custom plugin.

Source

pub fn open_with_config( path: impl AsRef<Path>, plugin: Arc<dyn DatabasePlugin>, accountant: Arc<MemoryAccountant>, ) -> Result<Self>

Full constructor with budget.

Source

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>

Source

pub fn open_memory_with_accountant(accountant: Arc<MemoryAccountant>) -> Self

In-memory database with budget.

Source

pub fn accountant(&self) -> &MemoryAccountant

Access the memory accountant.

Source

pub fn conflict_policies(&self) -> ConflictPolicies

Get a clone of the current conflict policies.

Source

pub fn set_default_conflict_policy(&self, policy: ConflictPolicy)

Set the default conflict policy.

Source

pub fn set_table_conflict_policy(&self, table: &str, policy: ConflictPolicy)

Set a per-table conflict policy.

Source

pub fn drop_table_conflict_policy(&self, table: &str)

Remove a per-table conflict policy override.

Source

pub fn plugin(&self) -> &dyn DatabasePlugin

Source

pub fn plugin_health(&self) -> PluginHealth

Source

pub fn plugin_describe(&self) -> Value

Source

pub fn set_disk_limit(&self, limit: Option<u64>) -> Result<()>

Source

pub fn disk_limit(&self) -> Option<u64>

Source

pub fn disk_limit_startup_ceiling(&self) -> Option<u64>

Source

pub fn disk_file_size(&self) -> Option<u64>

Source

pub fn check_disk_budget(&self, operation: &str) -> Result<()>

Source

pub fn persisted_sync_watermarks(&self, tenant_id: &str) -> Result<(u64, u64)>

Source

pub fn persist_sync_push_watermark( &self, tenant_id: &str, watermark: u64, ) -> Result<()>

Source

pub fn persist_sync_pull_watermark( &self, tenant_id: &str, watermark: u64, ) -> Result<()>

Source

pub fn change_log_since(&self, since_lsn: u64) -> Vec<ChangeLogEntry>

Source

pub fn ddl_log_since(&self, since_lsn: u64) -> Vec<DdlChange>

Source

pub fn changes_since(&self, since_lsn: u64) -> ChangeSet

Extracts changes from this database since the given LSN.

Source

pub fn current_lsn(&self) -> u64

Returns the current LSN of this database.

Source

pub fn subscribe(&self) -> Receiver<CommitEvent>

Subscribe to commit events. Returns a receiver that yields a CommitEvent after each commit.

Source

pub fn subscribe_with_capacity(&self, capacity: usize) -> Receiver<CommitEvent>

Subscribe with a custom channel capacity.

Source

pub fn subscription_health(&self) -> SubscriptionMetrics

Returns health metrics for the subscription system.

Source

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

Source§

fn apply_changes( &self, changes: ChangeSet, policies: &ConflictPolicies, ) -> Result<ApplyResult>

Source§

impl ChangeTracking for Database

Source§

fn changes_since(&self, since_lsn: u64) -> ChangeSet

Source§

fn current_lsn(&self) -> u64

Source§

impl Debug for Database

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Database

Source§

fn drop(&mut self)

Executes the destructor for this type. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V