public class Broker extends Object implements Serializable, Comparable<Broker>
Modifier and Type | Class and Description |
---|---|
static class |
Broker.State |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
attributes()
Get the attributes of the broker.
|
double |
capacityFor(Resource resource)
Get broker capacity for the requested resource.
|
int |
compareTo(Broker o)
Compare by broker id.
|
Set<Replica> |
currentOfflineReplicas()
Get current offline replicas -- i.e.
|
Disk |
disk(String logdir)
Get disk information that corresponds to the logdir.
|
Collection<Disk> |
disks()
Get all the disks of the broker.
|
Map<String,DiskStats> |
diskStats()
Get per-logdir disk statistics of the broker.
|
boolean |
equals(Object o) |
Map<String,Object> |
getJsonStructure() |
boolean |
hasBadDisks()
Check if the broker has bad disks (i.e.
|
int |
hashCode() |
Host |
host() |
int |
id()
Get broker Id.
|
Set<Replica> |
immigrantReplicas()
Get the immigrant replicas (The replicas that are moved here).
|
boolean |
isAlive()
Check broker liveness status.
|
boolean |
isDemoted()
Check if the broker is demoted from being a partition leader.
|
boolean |
isNew()
Check if the broker is a new broker
|
Set<Replica> |
leaderReplicas()
Get all the leader replicas.
|
Load |
leadershipLoadForNwResources()
The load for the replicas for which this broker is a leader.
|
Load |
load()
Get the broker load of the broker.
|
int |
numReplicasOfTopicInBroker(String topic)
Get number of replicas from the given topic in this broker.
|
Rack |
rack()
Get broker's rack.
|
Replica |
replica(org.apache.kafka.common.TopicPartition tp)
Get the replica if it is in the broker.
|
Comparator<Replica> |
replicaComparator()
Get a comparator for the replicas in the broker.
|
Set<Replica> |
replicas()
Get replicas residing in the broker.
|
Collection<Replica> |
replicasOfTopicInBroker(String topic)
Get replicas for topic.
|
Broker.State |
state() |
Set<String> |
topics()
Get the set of topics in the broker.
|
String |
toString() |
SortedReplicas |
trackedSortedReplicas(String sortName)
Get the tracked sorted replicas using the given sort name.
|
void |
writeTo(OutputStream out)
Output writing string representation of this class to the stream.
|
public Host host()
public Broker.State state()
public Rack rack()
public int id()
public double capacityFor(Resource resource)
resource
- Resource for which the capacity will be provided.public Set<Replica> immigrantReplicas()
public Set<Replica> currentOfflineReplicas()
public Replica replica(org.apache.kafka.common.TopicPartition tp)
tp
- Topic partition of the replica.public Collection<Replica> replicasOfTopicInBroker(String topic)
topic
- Topic of the requested replicas.public int numReplicasOfTopicInBroker(String topic)
topic
- Topic for which the replica count will be returned.public boolean isAlive()
public boolean isNew()
public boolean isDemoted()
public boolean hasBadDisks()
Broker.State.DEAD
, a Broker.State.BAD_DISKS
broker might receive replicas from other brokers during a rebalance.public Load load()
public Load leadershipLoadForNwResources()
public Map<String,String> attributes()
public SortedReplicas trackedSortedReplicas(String sortName)
sortName
- the sort name.SortedReplicas
for the given sort name.public Comparator<Replica> replicaComparator()
public Disk disk(String logdir)
logdir
- The logdir of the disk to query.public Collection<Disk> disks()
public Map<String,DiskStats> diskStats()
ClusterModel
has
been created with a request to populate replica placement info, otherwise returns an empty map.public void writeTo(OutputStream out) throws IOException
out
- the output stream.IOException
public int compareTo(Broker o)
compareTo
in interface Comparable<Broker>