Skip to main content

agent_storage/contracts/
run_event_store.rs

1//! Appends and reads immutable
2
3use super::{StorageError, StoredRunEvent};
4use async_trait::async_trait;
5use uuid::Uuid;
6
7/// Appends and reads immutable run events.
8///
9/// Appends must be contiguous and start at sequence zero. A duplicate or
10/// out-of-order sequence is rejected. Reads are returned in ascending sequence
11/// order; after_sequence is an exclusive cursor for reconnectable consumers.
12#[async_trait]
13pub trait RunEventStore: Send + Sync {
14    async fn append_event(&self, event: StoredRunEvent) -> Result<(), StorageError>;
15    async fn list_events(
16        &self,
17        run_id: Uuid,
18        after_sequence: Option<u64>,
19    ) -> Result<Vec<StoredRunEvent>, StorageError>;
20}