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, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: '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<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn consumer_group_info<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Interface for append-only, replayable event streams with consumer groups and acknowledgments.
Required Methods§
Sourcefn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
event: NewEvent,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
event: NewEvent,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Appends a new event to the specified stream log, returning its assigned sequence number.
Sourcefn 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<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Subscribes to notification events when new entries are appended to a stream.
Sourcefn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
seq: i64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Acknowledges event processing up to seq for a consumer group on a stream log.
Sourcefn read_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
after_seq: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Reads events from a stream with sequence numbers strictly greater than after_seq.
Sourcefn consumer_group_info<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn consumer_group_info<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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§
impl StreamBackend for MemoryBackend
impl StreamBackend for MockBackend
impl StreamBackend for PostgresBackend
Available on crate feature
postgres only.impl StreamBackend for RedisBackend
impl StreamBackend for SqliteBackend
Available on crate feature
sqlite only.