Engine

Trait Engine 

Source
pub trait Engine:
    WithEventBus
    + Send
    + Sync
    + Clone
    + 'static {
    type Command: CommandTransaction;
    type Query: QueryTransaction;

    // Required methods
    fn begin_command<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Command>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn begin_query<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Query>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn command_as(
        &self,
        identity: &Identity,
        rql: &str,
        params: Params,
    ) -> SendableFrameStream;
    fn query_as(
        &self,
        identity: &Identity,
        rql: &str,
        params: Params,
    ) -> SendableFrameStream;
}
Expand description

Async database engine trait.

This trait defines the core interface for database engines. The command_as and query_as methods return async streams for non-blocking execution.

All methods create Send futures to work with tokio’s multi-threaded runtime.

Required Associated Types§

Required Methods§

Source

fn begin_command<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Command>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin a new command (write) transaction.

Source

fn begin_query<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Query>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin a new query (read) transaction.

Source

fn command_as( &self, identity: &Identity, rql: &str, params: Params, ) -> SendableFrameStream

Execute a command and return a stream of result frames.

Commands are write operations (INSERT, UPDATE, DELETE, DDL) that modify the database state. The command runs in a transaction that is automatically committed on success or rolled back on error.

Source

fn query_as( &self, identity: &Identity, rql: &str, params: Params, ) -> SendableFrameStream

Execute a query and return a stream of result frames.

Queries are read operations (SELECT) that do not modify the database. Results are streamed as they become available, providing backpressure if the consumer is slow.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§