Skip to main content

StreamBackend

Trait StreamBackend 

Source
pub trait StreamBackend: Send + Sync {
    // Required methods
    fn publish<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 str,
        event: NewEvent,
    ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        stream: &'life1 str,
        consumer_group: &'life2 str,
        last_seq: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationStream>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn ack<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        stream: &'life1 str,
        consumer_group: &'life2 str,
        seq: i64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 str,
        after_seq: i64,
        limit: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Event>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn consumer_group_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Interface for append-only, replayable event streams with consumer groups and acknowledgments.

Required Methods§

Source

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

Appends a new event to the specified stream log, returning its assigned sequence number.

Source

fn subscribe_stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, stream: &'life1 str, consumer_group: &'life2 str, last_seq: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<NotificationStream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Subscribes to notification events when new entries are appended to a stream.

Source

fn ack<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, stream: &'life1 str, consumer_group: &'life2 str, seq: i64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Acknowledges event processing up to seq for a consumer group on a stream log.

Source

fn read_events<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 str, after_seq: i64, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Event>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads events from a stream with sequence numbers strictly greater than after_seq.

Source

fn consumer_group_info<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches consumer group offset status for a stream log.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§