1use async_trait::async_trait;
2
3use crate::error::Result;
4use crate::model::{FlowEvent, FlowEventEnvelope};
5
6mod local_file;
7mod memory;
8#[cfg(feature = "postgres")]
9mod postgres;
10#[cfg(feature = "sqlite")]
11mod sqlite;
12
13pub use local_file::LocalFileEventStore;
14pub use memory::InMemoryEventStore;
15#[cfg(feature = "postgres")]
16pub use postgres::PostgresEventStore;
17#[cfg(feature = "sqlite")]
18pub use sqlite::SqliteEventStore;
19
20#[async_trait]
22pub trait FlowEventStore: Send + Sync {
23 async fn append(&self, run_id: &str, event: FlowEvent) -> Result<FlowEventEnvelope>;
24
25 async fn append_if_sequence(
26 &self,
27 run_id: &str,
28 expected_sequence: u64,
29 event: FlowEvent,
30 ) -> Result<FlowEventEnvelope>;
31
32 async fn list(&self, run_id: &str) -> Result<Vec<FlowEventEnvelope>>;
33
34 async fn list_run_ids(&self) -> Result<Vec<String>>;
35}