pub struct TopicPartitionInfo { /* private fields */ }Expand description
A class containing leadership, replicas and ISR information for a topic partition.
Corresponds to org.apache.kafka.common.TopicPartitionInfo.
leader is None when there is no leader (Java null); elr and
last_known_elr are None when the information is unavailable (the Java
short constructor leaves them null).
Implementations§
Source§impl TopicPartitionInfo
impl TopicPartitionInfo
Sourcepub fn with_elr_last_known_elr(
partition: i32,
leader: Option<Node>,
replicas: Vec<Node>,
isr: Vec<Node>,
elr: Vec<Node>,
last_known_elr: Vec<Node>,
) -> Self
pub fn with_elr_last_known_elr( partition: i32, leader: Option<Node>, replicas: Vec<Node>, isr: Vec<Node>, elr: Vec<Node>, last_known_elr: Vec<Node>, ) -> Self
Create an instance with the provided parameters.
partition- the partition idleader- the leader of the partition orNoneif there is nonereplicas- the replicas of the partition in the same order as the replica assignment (the preferred replica is the head of the list)isr- the in-sync replicaselr- the eligible leader replicaslast_known_elr- the last known eligible leader replicas
Sourcepub fn new(
partition: i32,
leader: Option<Node>,
replicas: Vec<Node>,
isr: Vec<Node>,
) -> Self
pub fn new( partition: i32, leader: Option<Node>, replicas: Vec<Node>, isr: Vec<Node>, ) -> Self
Create an instance without eligible-leader-replica information (the Java
four-argument constructor, which leaves elr/last_known_elr null).
Sourcepub fn leader(&self) -> Option<&Node>
pub fn leader(&self) -> Option<&Node>
Return the leader of the partition or None if there is none.
Sourcepub fn replicas(&self) -> &[Node]
pub fn replicas(&self) -> &[Node]
Return the replicas of the partition in the same order as the replica assignment. The preferred replica is the head of the list.
Sourcepub fn isr(&self) -> &[Node]
pub fn isr(&self) -> &[Node]
Return the in-sync replicas of the partition. The ordering is unspecified.
Sourcepub fn elr(&self) -> Option<&[Node]>
pub fn elr(&self) -> Option<&[Node]>
Return the eligible leader replicas of the partition, or None if
unavailable. The ordering is unspecified.
Sourcepub fn last_known_elr(&self) -> Option<&[Node]>
pub fn last_known_elr(&self) -> Option<&[Node]>
Return the last known eligible leader replicas of the partition, or
None if unavailable. The ordering is unspecified.
Trait Implementations§
Source§impl Clone for TopicPartitionInfo
impl Clone for TopicPartitionInfo
Source§fn clone(&self) -> TopicPartitionInfo
fn clone(&self) -> TopicPartitionInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TopicPartitionInfo
impl Debug for TopicPartitionInfo
Source§impl Display for TopicPartitionInfo
impl Display for TopicPartitionInfo
Source§impl PartialEq for TopicPartitionInfo
impl PartialEq for TopicPartitionInfo
impl Eq for TopicPartitionInfo
impl StructuralPartialEq for TopicPartitionInfo
Auto Trait Implementations§
impl Freeze for TopicPartitionInfo
impl RefUnwindSafe for TopicPartitionInfo
impl Send for TopicPartitionInfo
impl Sync for TopicPartitionInfo
impl Unpin for TopicPartitionInfo
impl UnsafeUnpin for TopicPartitionInfo
impl UnwindSafe for TopicPartitionInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.