Skip to main content

ObservabilityStore

Trait ObservabilityStore 

Source
pub trait ObservabilityStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn append_activity_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        expected_seq: u64,
        event: &'life1 ActivityEvent,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn activity_head<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 ActivityStreamKey,
    ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_activity_events_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 ActivityStreamKey,
        from_seq: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityRecord>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_activity_streams<'life0, 'life1, 'async_trait>(
        &'life0 self,
        workflow_id: &'life1 WorkflowId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityStreamSummary>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Durable, append-only observability keyspace contract.

Implemented by the haematite backend for production and by InMemoryObservabilityStore for tests + conformance. The server is the single writer; every method keys on the (workflow, activity, attempt) triple, never on the workflow alone.

Required Methods§

Source

fn append_activity_event<'life0, 'life1, 'async_trait>( &'life0 self, expected_seq: u64, event: &'life1 ActivityEvent, ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Append event to its (workflow, activity, attempt) stream at expected_seq (the current head the caller believes it holds).

On success returns the newly assigned store_seq (which equals expected_seq) — the caller advances its head to store_seq + 1. On a stale expectation returns StoreError::SequenceConflict with the actual head, leaving the stream unchanged, so the server’s sequencer can re-read the advanced head and retry. Ephemeral events must never be passed here — they are WS-forward-only and are filtered out before this call.

§Errors

StoreError::SequenceConflict on a stale expected_seq; otherwise a backend or serialization error.

Source

fn activity_head<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 ActivityStreamKey, ) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the current head (next store_seq to be written) for key.

An unwritten stream reads head 0. The server’s sequencer seeds its retry loop from this value.

§Errors

A backend or serialization error.

Source

fn read_activity_events_from<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 ActivityStreamKey, from_seq: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityRecord>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read every record for key with store_seq >= from_seq, in order.

This is the resume-by-store_seq primitive: a reconnecting transcript client replays from its last-seen cursor without paying for the whole stream. An unwritten stream (or a from_seq beyond the head) reads empty.

§Errors

A backend or serialization error.

Source

fn list_activity_streams<'life0, 'life1, 'async_trait>( &'life0 self, workflow_id: &'life1 WorkflowId, ) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityStreamSummary>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enumerate every retained transcript stream of workflow_id, ordered by (activity_id, attempt) ascending. A workflow with no retained transcript reads empty (old runs simply have none).

§Errors

A backend or serialization error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§