use crate::core::events::EventEnvelope;
use crate::events::types::{SeekPosition, SeqNo};
use anyhow::Result;
use async_trait::async_trait;
use std::pin::Pin;
use tokio_stream::Stream;
#[async_trait]
pub trait EventLog: Send + Sync {
async fn append(&self, envelope: EventEnvelope) -> Result<SeqNo>;
async fn subscribe(
&self,
consumer: &str,
position: SeekPosition,
) -> Result<Pin<Box<dyn Stream<Item = EventEnvelope> + Send>>>;
async fn ack(&self, consumer: &str, seq_no: SeqNo) -> Result<()>;
async fn seek(&self, consumer: &str, position: SeekPosition) -> Result<()>;
async fn last_seq_no(&self) -> Option<SeqNo>;
}