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§
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn command_as(
&self,
identity: &Identity,
rql: &str,
params: Params,
) -> SendableFrameStream
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.
Sourcefn query_as(
&self,
identity: &Identity,
rql: &str,
params: Params,
) -> SendableFrameStream
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.