pub trait ReadableEventStore:
Send
+ Sync
+ 'static {
// Required methods
fn read_history<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_history_from<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
from_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_run_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_workflow_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_active<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 WorkflowFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowSummary>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn schedule_timer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
timer_id: &'life2 TimerId,
fire_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn expired_timers<'life0, 'async_trait>(
&'life0 self,
as_of: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TimerEntry>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Read and durable-timer contract for Aion event stores.
Required Methods§
Sourcefn read_history<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_history<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the complete event history for workflow_id in ascending sequence order.
A workflow with no recorded events is observed as an empty history. This includes unknown
workflow identifiers: because the first append with expected_seq == 0 creates a workflow
implicitly, “unknown workflow” and “empty history” are the same observable state for reads.
This method must not return StoreError::NotFound for absent workflows.
Sourcefn read_history_from<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
from_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_history_from<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
from_seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the event history for workflow_id restricted to events with sequence number
greater than or equal to from_seq, in ascending sequence order.
This is the range-read primitive behind O(delta) WS resume: callers replaying from a cursor must not pay for the full history. Semantics:
from_seq <= 1is equivalent toSelf::read_history: sequence numbers start at 1, so every recorded event satisfies the bound.from_seqbeyond the current head returns an empty vector, never an error. Whether a beyond-head cursor is valid is protocol judgment, not store judgment: the WS resume protocol rejectsresume_from_seq > head + 1as an invalid cursor (ResumeCursorAheadOfHistory), but it makes that call by comparing the cursor against the head it observes — the store only answers which events exist at or after the requested sequence.- Unknown workflows behave exactly like
Self::read_historyfor unknown workflows: empty history, neverStoreError::NotFound, because “unknown workflow” and “empty history” are the same observable state for reads.
There is deliberately no default implementation: a read-all-then-filter fallback would
silently reintroduce O(history) behavior. Every backend must implement this as a real
range read (for SQL backends, an indexed seq >= ? range scan).
Sourcefn read_run_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_run_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunSummary>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the concrete run chain for workflow_id in continuation order.
Sourcefn list_workflow_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_workflow_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists every workflow identifier that has at least one event in history.
Unlike Self::list_active, this includes terminal workflows and exists to let projection
repair jobs reconcile derived indexes against the authoritative event history.
Sourcefn list_active<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_active<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowId>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists workflow identifiers whose projected status is non-terminal.
Sourcefn query<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 WorkflowFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowSummary>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 WorkflowFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowSummary>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns workflow summaries matching filter.
Sourcefn schedule_timer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
timer_id: &'life2 TimerId,
fire_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn schedule_timer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
workflow_id: &'life1 WorkflowId,
timer_id: &'life2 TimerId,
fire_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persists a durable timer for workflow_id that is due at fire_at.
Timer scheduling remains on the public store surface because timers are not workflow-history
appends and are used by the timer subsystem after the recorder has written TimerStarted.
Sourcefn expired_timers<'life0, 'async_trait>(
&'life0 self,
as_of: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TimerEntry>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn expired_timers<'life0, 'async_trait>(
&'life0 self,
as_of: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TimerEntry>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns durable timers whose fire_at is less than or equal to as_of.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".