#[cfg(feature = "local")]
pub(crate) mod local;
#[cfg(feature = "postgres")]
pub(crate) mod postgres;
use super::*;
use axum::async_trait;
#[async_trait]
pub(crate) trait Connection: Send {
async fn new_stream(&mut self, headers: SerializedHeaders) -> Result<StreamId>;
async fn insert_event(
&mut self,
stream_id: StreamId,
stream_event_index: StreamEventIndex,
payload: &str,
) -> Result<()>;
async fn flush(&mut self) -> Result<()> {
Ok(())
}
fn commit(&mut self) -> Result<()> {
Ok(())
}
fn commit_on_sigint(&self) -> bool {
false
}
}
pub trait StorageOpen {
type Conn;
async fn open(self) -> anyhow::Result<Self::Conn>;
}