use async_trait::async_trait;
use crate::error::Result;
use crate::proto::{
CommandBook, CommandResponse, EventBook, ProcessManagerHandleResponse, Projection, Query,
SagaResponse, SpeculateCommandHandlerRequest, SpeculatePmRequest, SpeculateProjectorRequest,
SpeculateSagaRequest,
};
#[async_trait]
pub trait GatewayClient: Send + Sync {
async fn execute(&self, command: CommandBook) -> Result<CommandResponse>;
}
#[async_trait]
pub trait SpeculativeClient: Send + Sync {
async fn command_handler(
&self,
request: SpeculateCommandHandlerRequest,
) -> Result<CommandResponse>;
async fn projector(&self, request: SpeculateProjectorRequest) -> Result<Projection>;
async fn saga(&self, request: SpeculateSagaRequest) -> Result<SagaResponse>;
async fn process_manager(
&self,
request: SpeculatePmRequest,
) -> Result<ProcessManagerHandleResponse>;
}
#[async_trait]
pub trait QueryClient: Send + Sync {
async fn get_events(&self, query: Query) -> Result<EventBook>;
}