pub struct StandardEngine(/* private fields */);Implementations§
Source§impl StandardEngine
impl StandardEngine
pub async fn new( multi: TransactionMultiVersion, single: TransactionSingle, cdc: TransactionCdc, event_bus: EventBus, interceptors: Box<dyn InterceptorFactory<StandardCommandTransaction>>, catalog: MaterializedCatalog, custom_functions: Option<Functions>, ) -> Self
pub fn multi(&self) -> &TransactionMultiVersion
pub fn multi_owned(&self) -> TransactionMultiVersion
pub fn single(&self) -> &TransactionSingle
pub fn single_owned(&self) -> TransactionSingle
pub fn cdc(&self) -> &TransactionCdc
pub fn cdc_owned(&self) -> TransactionCdc
pub async fn emit<E: Event>(&self, event: E)
pub fn catalog(&self) -> &MaterializedCatalog
pub fn flow_operator_store(&self) -> &FlowOperatorStore
Sourcepub async fn current_version(&self) -> Result<CommitVersion>
pub async fn current_version(&self) -> Result<CommitVersion>
Get the current version from the transaction manager
Sourcepub async fn try_wait_for_watermark(
&self,
version: CommitVersion,
timeout: Duration,
) -> Result<(), AwaitWatermarkError>
pub async fn try_wait_for_watermark( &self, version: CommitVersion, timeout: Duration, ) -> Result<(), AwaitWatermarkError>
Wait for the watermark to reach the specified version. Returns Ok(()) if the watermark reaches the version within the timeout, or Err(AwaitWatermarkError) if the timeout expires.
This is useful for CDC polling to ensure all in-flight commits have completed their storage writes before querying for CDC events.
Sourcepub fn done_until(&self) -> CommitVersion
pub fn done_until(&self) -> CommitVersion
Returns the highest version where ALL prior versions have completed. This is useful for CDC polling to know the safe upper bound for fetching CDC events - all events up to this version are guaranteed to be in storage.
Sourcepub fn watermarks(&self) -> (CommitVersion, CommitVersion)
pub fn watermarks(&self) -> (CommitVersion, CommitVersion)
Returns (query_done_until, command_done_until) for debugging watermark state.
pub fn executor(&self) -> Executor
Sourcepub fn register_virtual_table<T: TableVirtualUser + Clone>(
&self,
namespace: &str,
name: &str,
table: T,
) -> Result<TableVirtualId>
pub fn register_virtual_table<T: TableVirtualUser + Clone>( &self, namespace: &str, name: &str, table: T, ) -> Result<TableVirtualId>
Register a user-defined virtual table.
The virtual table will be available for queries using the given namespace and name.
§Arguments
namespace- The namespace name (e.g., “default”, “my_namespace”)name- The table nametable- The virtual table implementation
§Returns
The assigned TableVirtualId on success.
§Example
use reifydb_engine::table_virtual::{TableVirtualUser, TableVirtualUserColumnDef};
use reifydb_type::Type;
use reifydb_core::value::Value;
#[derive(Clone)]
struct MyTable;
impl TableVirtualUser for MyTable {
fn columns(&self) -> Vec<TableVirtualUserColumnDef> {
vec![TableVirtualUserColumnDef::new("id", Type::Uint8)]
}
fn rows(&self) -> Vec<Vec<Value>> {
vec![vec![Value::Uint8(1)], vec![Value::Uint8(2)]]
}
}
let id = engine.register_virtual_table("default", "my_table", MyTable)?;Sourcepub fn unregister_virtual_table(
&self,
namespace: &str,
name: &str,
) -> Result<()>
pub fn unregister_virtual_table( &self, namespace: &str, name: &str, ) -> Result<()>
Unregister a user-defined virtual table.
§Arguments
namespace- The namespace namename- The table name
Sourcepub fn register_virtual_table_iterator<F>(
&self,
namespace: &str,
name: &str,
creator: F,
) -> Result<TableVirtualId>
pub fn register_virtual_table_iterator<F>( &self, namespace: &str, name: &str, creator: F, ) -> Result<TableVirtualId>
Register a user-defined virtual table using an iterator-based implementation.
This method is for tables that stream data in batches, which is more efficient for large datasets. The creator function is called once per query to create a fresh iterator instance.
§Arguments
namespace- The namespace to register the table inname- The table namecreator- A function that creates a new iterator instance for each query
§Returns
The ID of the registered virtual table
Sourcepub fn bulk_insert<'e>(
&'e self,
identity: &'e Identity,
) -> BulkInsertBuilder<'e, Validated>
pub fn bulk_insert<'e>( &'e self, identity: &'e Identity, ) -> BulkInsertBuilder<'e, Validated>
Start a bulk insert operation with full validation.
This provides a fluent API for fast bulk inserts that bypasses RQL parsing. All inserts within a single builder execute in one transaction.
§Example
use reifydb_type::params;
engine.bulk_insert(&identity)
.table("namespace.users")
.row(params!{ id: 1, name: "Alice" })
.row(params!{ id: 2, name: "Bob" })
.done()
.execute()?;Sourcepub fn bulk_insert_trusted<'e>(
&'e self,
identity: &'e Identity,
) -> BulkInsertBuilder<'e, Trusted>
pub fn bulk_insert_trusted<'e>( &'e self, identity: &'e Identity, ) -> BulkInsertBuilder<'e, Trusted>
Start a bulk insert operation with validation disabled (trusted mode).
Use this for pre-validated internal data where constraint validation can be skipped for maximum performance.
§Safety
The caller is responsible for ensuring the data conforms to the schema constraints. Invalid data may cause undefined behavior.