Struct sea_streamer_kafka::TopicPartitionList
source ยท pub struct TopicPartitionList { /* private fields */ }
Expand description
A structure to store and manipulate a list of topics and partitions with optional offsets.
Implementationsยง
sourceยงimpl TopicPartitionList
impl TopicPartitionList
sourcepub fn new() -> TopicPartitionList
pub fn new() -> TopicPartitionList
Creates a new empty list with default capacity.
sourcepub fn with_capacity(capacity: usize) -> TopicPartitionList
pub fn with_capacity(capacity: usize) -> TopicPartitionList
Creates a new empty list with the specified capacity.
sourcepub fn from_topic_map(
topic_map: &HashMap<(String, i32), Offset, RandomState>
) -> Result<TopicPartitionList, KafkaError>
pub fn from_topic_map( topic_map: &HashMap<(String, i32), Offset, RandomState> ) -> Result<TopicPartitionList, KafkaError>
Given a topic map, generates a new TopicPartitionList
.
sourcepub fn ptr(&self) -> *mut rd_kafka_topic_partition_list_s
pub fn ptr(&self) -> *mut rd_kafka_topic_partition_list_s
Returns the pointer to the internal librdkafka structure.
sourcepub fn add_topic_unassigned<'a>(
&'a mut self,
topic: &str
) -> TopicPartitionListElem<'a>
pub fn add_topic_unassigned<'a>( &'a mut self, topic: &str ) -> TopicPartitionListElem<'a>
Adds a topic with unassigned partitions to the list.
sourcepub fn add_partition<'a>(
&'a mut self,
topic: &str,
partition: i32
) -> TopicPartitionListElem<'a>
pub fn add_partition<'a>( &'a mut self, topic: &str, partition: i32 ) -> TopicPartitionListElem<'a>
Adds a topic and partition to the list.
sourcepub fn add_partition_range(
&mut self,
topic: &str,
start_partition: i32,
stop_partition: i32
)
pub fn add_partition_range( &mut self, topic: &str, start_partition: i32, stop_partition: i32 )
Adds a topic and partition range to the list.
sourcepub fn set_partition_offset(
&mut self,
topic: &str,
partition: i32,
offset: Offset
) -> Result<(), KafkaError>
pub fn set_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset ) -> Result<(), KafkaError>
Sets the offset for an already created topic partition. It will fail if the topic partition isnโt in the list.
sourcepub fn add_partition_offset(
&mut self,
topic: &str,
partition: i32,
offset: Offset
) -> Result<(), KafkaError>
pub fn add_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset ) -> Result<(), KafkaError>
Adds a topic and partition to the list, with the specified offset.
sourcepub fn find_partition(
&self,
topic: &str,
partition: i32
) -> Option<TopicPartitionListElem<'_>>
pub fn find_partition( &self, topic: &str, partition: i32 ) -> Option<TopicPartitionListElem<'_>>
Given a topic name and a partition number, returns the corresponding list element.
sourcepub fn set_all_offsets(&mut self, offset: Offset) -> Result<(), KafkaError>
pub fn set_all_offsets(&mut self, offset: Offset) -> Result<(), KafkaError>
Sets all partitions in the list to the specified offset.
sourcepub fn elements(&self) -> Vec<TopicPartitionListElem<'_>, Global>
pub fn elements(&self) -> Vec<TopicPartitionListElem<'_>, Global>
Returns all the elements of the list.
sourcepub fn elements_for_topic<'a>(
&'a self,
topic: &str
) -> Vec<TopicPartitionListElem<'a>, Global>
pub fn elements_for_topic<'a>( &'a self, topic: &str ) -> Vec<TopicPartitionListElem<'a>, Global>
Returns all the elements of the list that belong to the specified topic.
sourcepub fn to_topic_map(&self) -> HashMap<(String, i32), Offset, RandomState>
pub fn to_topic_map(&self) -> HashMap<(String, i32), Offset, RandomState>
Returns a hashmap-based representation of the list.
Trait Implementationsยง
sourceยงimpl Clone for TopicPartitionList
impl Clone for TopicPartitionList
sourceยงfn clone(&self) -> TopicPartitionList
fn clone(&self) -> TopicPartitionList
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceยงimpl Debug for TopicPartitionList
impl Debug for TopicPartitionList
sourceยงimpl Default for TopicPartitionList
impl Default for TopicPartitionList
sourceยงfn default() -> TopicPartitionList
fn default() -> TopicPartitionList
sourceยงimpl PartialEq<TopicPartitionList> for TopicPartitionList
impl PartialEq<TopicPartitionList> for TopicPartitionList
sourceยงfn eq(&self, other: &TopicPartitionList) -> bool
fn eq(&self, other: &TopicPartitionList) -> bool
self
and other
values to be equal, and is used
by ==
.