public class Partition
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Method and Description |
---|---|
void |
addIneligibleBroker(Broker ineligibleBroker)
Record the broker which is unable to host the replica of the partition.
|
boolean |
canAssignReplicaToBroker(Broker candidateBroker)
Check if the broker is eligible to host the replica of the partition.
|
void |
clear()
Clear the leader to null and clear followers.
|
boolean |
containsRack(Rack rack)
Returns a boolean indicating if replica of this partition are on rack
passed in as argument.
|
java.util.List<Broker> |
followerBrokers()
Get the set of brokers that followers reside in.
|
java.util.List<Replica> |
followers()
Get follower replicas.
|
Replica |
leader()
Get the leader replica.
|
void |
moveReplicaToEnd(Replica replica)
Move a replica to the end of the replica list.
|
java.util.List<Broker> |
onlineFollowerBrokers()
Get the set of brokers that online followers reside in.
|
java.util.List<Replica> |
onlineFollowers()
Get online follower replicas.
|
java.util.Set<Broker> |
partitionBrokers()
Get the set of brokers that contain replicas of the partition.
|
java.util.Set<Broker> |
partitionObserverBrokers()
Get the set of brokers that contain observer replicas of the partition.
|
java.util.Set<Broker> |
partitionSyncBrokers()
Get the set of brokers that contain sync(non-observer) replicas of the partition
|
java.util.List<Replica> |
replicas() |
void |
swapFollowerPositions(int index1,
int index2)
Given two follower indices in the replica list, swap their positions.
|
void |
swapReplicaPositions(int index1,
int index2)
Given two replica indices in the replica list, swap their positions.
|
org.apache.kafka.common.TopicPartition |
topicPartition() |
java.lang.String |
toString()
Get string representation of Partition in XML format.
|
public org.apache.kafka.common.TopicPartition topicPartition()
public java.util.List<Replica> replicas()
public java.util.List<Replica> followers()
public java.util.List<Replica> onlineFollowers()
public Replica leader()
public java.util.List<Broker> followerBrokers()
public java.util.List<Broker> onlineFollowerBrokers()
public void swapFollowerPositions(int index1, int index2)
index1
- The index of the first follower to be swapped.index2
- The index of the second follower to be swappedpublic void swapReplicaPositions(int index1, int index2)
index1
- The index of the first replica to be swapped.index2
- The index of the second replica to be swappedpublic void moveReplicaToEnd(Replica replica)
replica
- the replica to move to the end.public java.util.Set<Broker> partitionBrokers()
public java.util.Set<Broker> partitionObserverBrokers()
public java.util.Set<Broker> partitionSyncBrokers()
public boolean containsRack(Rack rack)
public void clear()
public java.lang.String toString()
toString
in class java.lang.Object
public void addIneligibleBroker(Broker ineligibleBroker)
ineligibleBroker
- The ineligible broker.public boolean canAssignReplicaToBroker(Broker candidateBroker)
candidateBroker
- The candidate broker.