EventStream

Trait EventStream 

Source
pub trait EventStream: Send + Sync {
    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        event: MemoryGraphEvent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe(
        &self,
    ) -> Pin<Box<dyn Stream<Item = MemoryGraphEvent> + Send + '_>>;

    // Provided method
    fn publish_batch<'life0, 'async_trait>(
        &'life0 self,
        events: Vec<MemoryGraphEvent>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for event streaming

Required Methods§

Source

fn publish<'life0, 'async_trait>( &'life0 self, event: MemoryGraphEvent, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish an event to the stream

Source

fn subscribe(&self) -> Pin<Box<dyn Stream<Item = MemoryGraphEvent> + Send + '_>>

Subscribe to the event stream

Provided Methods§

Source

fn publish_batch<'life0, 'async_trait>( &'life0 self, events: Vec<MemoryGraphEvent>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish multiple events in batch

Implementors§