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 prune_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
through_seq: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, 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;
// Provided method
fn read_next<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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 prune_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
through_seq: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn prune_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
through_seq: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Prunes retained events for stream with sequence_no <= through_seq.
Implementations must not prune past the lowest known consumer-group offset. If no consumer
groups are known for the stream, through_seq is used as the retention cutoff.
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.
Provided Methods§
Sourcefn read_next<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn read_next<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Reads the next events for a consumer group from its durable acknowledged offset.
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
postgres only.impl StreamBackend for RedisBackend
impl StreamBackend for SqliteBackend
sqlite only.