use crate::{
embedded::{EmbeddedCore, EventView, IngestEvent, Query},
error::Result,
};
#[async_trait::async_trait]
pub trait EventStore: Send + Sync {
async fn ingest(&self, event: IngestEvent<'_>) -> Result<()>;
async fn ingest_batch(&self, events: Vec<IngestEvent<'_>>) -> Result<()>;
async fn query(&self, query: Query) -> Result<Vec<EventView>>;
async fn shutdown(&self) -> Result<()>;
}
#[async_trait::async_trait]
impl EventStore for EmbeddedCore {
async fn ingest(&self, event: IngestEvent<'_>) -> Result<()> {
EmbeddedCore::ingest(self, event).await
}
async fn ingest_batch(&self, events: Vec<IngestEvent<'_>>) -> Result<()> {
EmbeddedCore::ingest_batch(self, events).await
}
async fn query(&self, query: Query) -> Result<Vec<EventView>> {
EmbeddedCore::query(self, query).await
}
async fn shutdown(&self) -> Result<()> {
EmbeddedCore::shutdown(self).await
}
}