pub trait StreamBackend: Send + Sync {
Show 13 methods
// Required methods
fn name(&self) -> &'static str;
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
partitions: u32,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_topics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<TopicName>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_event<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
event: StreamEvent,
) -> Pin<Box<dyn Future<Output = StreamResult<Offset>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
events: Vec<StreamEvent>,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Offset>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn receive_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: Option<&'life2 ConsumerGroup>,
position: StreamPosition,
max_events: usize,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<(StreamEvent, Offset)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn commit_offset<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
offset: Offset,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn seek<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
position: StreamPosition,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_consumer_lag<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
) -> Pin<Box<dyn Future<Output = StreamResult<HashMap<PartitionId, u64>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_topic_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
) -> Pin<Box<dyn Future<Output = StreamResult<HashMap<String, String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Common trait for all streaming backends
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the backend
Sourcefn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from the backend
Sourcefn create_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
partitions: u32,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
partitions: u32,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new topic/stream
Sourcefn delete_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_topic<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a topic/stream
Sourcefn list_topics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<TopicName>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_topics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<TopicName>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all topics/streams
Sourcefn send_event<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
event: StreamEvent,
) -> Pin<Box<dyn Future<Output = StreamResult<Offset>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_event<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
event: StreamEvent,
) -> Pin<Box<dyn Future<Output = StreamResult<Offset>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a single event
Sourcefn send_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
events: Vec<StreamEvent>,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Offset>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
events: Vec<StreamEvent>,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Offset>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send multiple events as a batch
Sourcefn receive_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: Option<&'life2 ConsumerGroup>,
position: StreamPosition,
max_events: usize,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<(StreamEvent, Offset)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn receive_events<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: Option<&'life2 ConsumerGroup>,
position: StreamPosition,
max_events: usize,
) -> Pin<Box<dyn Future<Output = StreamResult<Vec<(StreamEvent, Offset)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Receive events from a topic
Sourcefn commit_offset<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
offset: Offset,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn commit_offset<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
offset: Offset,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Commit consumer offset
Sourcefn seek<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
position: StreamPosition,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn seek<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
partition: PartitionId,
position: StreamPosition,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Seek to a specific position
Sourcefn get_consumer_lag<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
) -> Pin<Box<dyn Future<Output = StreamResult<HashMap<PartitionId, u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_consumer_lag<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
topic: &'life1 TopicName,
consumer_group: &'life2 ConsumerGroup,
) -> Pin<Box<dyn Future<Output = StreamResult<HashMap<PartitionId, u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get consumer lag information