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>,
) -> KafkaResult<TopicPartitionList>
pub fn from_topic_map( topic_map: &HashMap<(String, i32), Offset>, ) -> KafkaResult<TopicPartitionList>
Given a topic map, generates a new TopicPartitionList
.
Sourcepub fn ptr(&self) -> *mut RDKafkaTopicPartitionList
pub fn ptr(&self) -> *mut RDKafkaTopicPartitionList
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,
) -> KafkaResult<()>
pub fn set_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset, ) -> KafkaResult<()>
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,
) -> KafkaResult<()>
pub fn add_partition_offset( &mut self, topic: &str, partition: i32, offset: Offset, ) -> KafkaResult<()>
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<'_>>
pub fn elements(&self) -> Vec<TopicPartitionListElem<'_>>
Returns all the elements of the list.
Sourcepub fn elements_for_topic<'a>(
&'a self,
topic: &str,
) -> Vec<TopicPartitionListElem<'a>>
pub fn elements_for_topic<'a>( &'a self, topic: &str, ) -> Vec<TopicPartitionListElem<'a>>
Returns all the elements of the list that belong to the specified topic.