Skip to main content

GraphEventJournal

Trait GraphEventJournal 

Source
pub trait GraphEventJournal: Send + Sync {
    // Required methods
    fn append<'life0, 'async_trait>(
        &'life0 self,
        obs: GraphObservation,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        offset: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphObservation>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A durable, append-only journal of GraphObservations keyed by run id.

Journals decouple durable replay from live broadcast: a UI or supervisor can attach after a graph run has started and reconstruct history by reading from a known offset rather than relying on having subscribed to an in-memory GraphEventSink.

Required Methods§

Source

fn append<'life0, 'async_trait>( &'life0 self, obs: GraphObservation, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Appends obs to the journal and returns the offset it was stored at within its run’s stream.

Source

fn read_from<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphObservation>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns every observation for run_id whose stream offset is >= offset, in offset order. Reading from 0 replays the whole run; reading an unknown run returns an empty Vec.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§