pub trait EventStore: Send + Sync {
// Required methods
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
envelope: AgentEventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn finish_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTurnEvents>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_turns<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTurnEvents>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Trait for storing and retrieving turn-scoped event streams.
Event writes are split into two phases:
appendrecords individual envelopesfinish_turnmarks the authoritative close barrier
Required Methods§
Sourcefn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
envelope: AgentEventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
envelope: AgentEventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Append an event envelope for the given thread and turn.
§Errors
Returns an error if the event cannot be persisted.
Sourcefn finish_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn finish_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Mark the given turn as finished and flush any buffered writes.
§Errors
Returns an error if the store cannot durably close the turn.
Sourcefn get_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTurnEvents>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTurnEvents>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve the stored data for a single turn.
§Errors
Returns an error if the turn cannot be retrieved.
Sourcefn get_turns<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTurnEvents>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_turns<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTurnEvents>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve all stored turns for the given thread in ascending turn order.
§Errors
Returns an error if the thread history cannot be retrieved.
Provided Methods§
Sourcefn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve all event envelopes for the given thread across every stored turn.
§Errors
Returns an error if the thread history cannot be retrieved.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".