pub trait DatabaseConnectionAsync {
// Required methods
fn transact_async(
&self,
events: NonEmpty<ProspectiveEvent>,
conditions: Vec<AppendCondition>,
) -> impl Future<Output = Result<CorrelationId, DatabaseError>>;
fn transact_async_with_id(
&self,
transaction_id: &str,
events: NonEmpty<ProspectiveEvent>,
conditions: Vec<AppendCondition>,
) -> impl Future<Output = Result<CorrelationId, DatabaseError>>;
fn execute_state_change_async(
&self,
name: &StateChangeName,
version: StateChangeVersion,
request: CommandRequest,
) -> impl Future<Output = Result<CorrelationId, StateChangeError>>;
}Expand description
Extension trait for async database operations.
Async operations return immediately with a correlation ID that can be used to track the result via Kafka or other message brokers.
Required Methods§
Sourcefn transact_async(
&self,
events: NonEmpty<ProspectiveEvent>,
conditions: Vec<AppendCondition>,
) -> impl Future<Output = Result<CorrelationId, DatabaseError>>
fn transact_async( &self, events: NonEmpty<ProspectiveEvent>, conditions: Vec<AppendCondition>, ) -> impl Future<Output = Result<CorrelationId, DatabaseError>>
Transact asynchronously.
Returns a correlation ID that can be used to track the result.
Sourcefn transact_async_with_id(
&self,
transaction_id: &str,
events: NonEmpty<ProspectiveEvent>,
conditions: Vec<AppendCondition>,
) -> impl Future<Output = Result<CorrelationId, DatabaseError>>
fn transact_async_with_id( &self, transaction_id: &str, events: NonEmpty<ProspectiveEvent>, conditions: Vec<AppendCondition>, ) -> impl Future<Output = Result<CorrelationId, DatabaseError>>
Transact asynchronously with a specific transaction ID.
Sourcefn execute_state_change_async(
&self,
name: &StateChangeName,
version: StateChangeVersion,
request: CommandRequest,
) -> impl Future<Output = Result<CorrelationId, StateChangeError>>
fn execute_state_change_async( &self, name: &StateChangeName, version: StateChangeVersion, request: CommandRequest, ) -> impl Future<Output = Result<CorrelationId, StateChangeError>>
Execute a state change asynchronously.
Returns a correlation ID that can be used to track the result.
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.