pub struct StandardEngine(/* private fields */);Implementations§
Source§impl StandardEngine
impl StandardEngine
pub fn new( multi: TransactionMultiVersion, single: TransactionSingleVersion, cdc: TransactionCdc, event_bus: EventBus, interceptors: Box<dyn InterceptorFactory<StandardCommandTransaction>>, catalog: MaterializedCatalog, ) -> Self
pub fn with_functions( multi: TransactionMultiVersion, single: TransactionSingleVersion, 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) -> &TransactionSingleVersion
pub fn single_owned(&self) -> TransactionSingleVersion
pub fn cdc(&self) -> &TransactionCdc
pub fn cdc_owned(&self) -> TransactionCdc
pub fn emit<E: Event>(&self, event: E)
pub fn catalog(&self) -> &MaterializedCatalog
pub fn flow_operator_store(&self) -> &FlowOperatorStore
Sourcepub fn current_version(&self) -> Result<CommitVersion>
pub fn current_version(&self) -> Result<CommitVersion>
Get the current version from the transaction manager
Sourcepub fn try_wait_for_watermark(
&self,
version: CommitVersion,
timeout: Duration,
) -> Result<(), AwaitWatermarkError>
pub 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
Trait Implementations§
Source§impl Clone for StandardEngine
impl Clone for StandardEngine
Source§impl Deref for StandardEngine
impl Deref for StandardEngine
Source§impl Engine for StandardEngine
impl Engine for StandardEngine
type Command = StandardCommandTransaction
type Query = StandardQueryTransaction
fn begin_command(&self) -> Result<Self::Command>
fn begin_query(&self) -> Result<Self::Query>
fn command_as( &self, identity: &Identity, rql: &str, params: Params, ) -> Result<Vec<Frame>>
fn query_as( &self, identity: &Identity, rql: &str, params: Params, ) -> Result<Vec<Frame>>
Source§impl ExecuteCommand<StandardCommandTransaction> for StandardEngine
impl ExecuteCommand<StandardCommandTransaction> for StandardEngine
fn execute_command( &self, txn: &mut StandardCommandTransaction, cmd: Command<'_>, ) -> Result<Vec<Frame>>
Source§impl ExecuteQuery<StandardQueryTransaction> for StandardEngine
impl ExecuteQuery<StandardQueryTransaction> for StandardEngine
fn execute_query( &self, txn: &mut StandardQueryTransaction, qry: Query<'_>, ) -> Result<Vec<Frame>>
Source§impl WithEventBus for StandardEngine
impl WithEventBus for StandardEngine
Auto Trait Implementations§
impl Freeze for StandardEngine
impl !RefUnwindSafe for StandardEngine
impl Send for StandardEngine
impl Sync for StandardEngine
impl Unpin for StandardEngine
impl !UnwindSafe for StandardEngine
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)