public class Broker extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Broker>
Modifier and Type | Class and Description |
---|---|
static class |
Broker.State |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.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.
|
java.util.Set<Replica> |
currentOfflineReplicas()
Get current offline replicas -- i.e.
|
Disk |
disk(java.lang.String logdir)
Get disk information that corresponds to the logdir.
|
java.util.Collection<Disk> |
disks()
Get all the disks of the broker.
|
java.util.Map<java.lang.String,DiskStats> |
diskStats()
Get per-logdir disk statistics of the broker.
|
boolean |
equals(java.lang.Object o) |
java.util.Map<java.lang.String,java.lang.Object> |
getJsonStructure() |
boolean |
hasBadDisks()
Check if the broker has bad disks (i.e.
|
int |
hashCode() |
Host |
host() |
int |
id()
Get broker Id.
|
java.util.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
|
java.util.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(java.lang.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.
|
java.util.Comparator<Replica> |
replicaComparator()
Get a comparator for the replicas in the broker.
|
java.util.Set<Replica> |
replicas()
Get replicas residing in the broker.
|
java.util.Collection<Replica> |
replicasOfTopicInBroker(java.lang.String topic)
Get replicas for topic.
|
Broker.State |
state() |
java.util.Set<java.lang.String> |
topics()
Get the set of topics in the broker.
|
java.lang.String |
toString() |
SortedReplicas |
trackedSortedReplicas(java.lang.String sortName)
Get the tracked sorted replicas using the given sort name.
|
void |
writeTo(java.io.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 java.util.Set<Replica> replicas()
public java.util.Set<Replica> leaderReplicas()
public java.util.Set<Replica> immigrantReplicas()
public java.util.Set<Replica> currentOfflineReplicas()
public Replica replica(org.apache.kafka.common.TopicPartition tp)
tp
- Topic partition of the replica.public java.util.Collection<Replica> replicasOfTopicInBroker(java.lang.String topic)
topic
- Topic of the requested replicas.public int numReplicasOfTopicInBroker(java.lang.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 java.util.Set<java.lang.String> topics()
public java.util.Map<java.lang.String,java.lang.String> attributes()
public SortedReplicas trackedSortedReplicas(java.lang.String sortName)
sortName
- the sort name.SortedReplicas
for the given sort name.public java.util.Comparator<Replica> replicaComparator()
public Disk disk(java.lang.String logdir)
logdir
- The logdir of the disk to query.public java.util.Collection<Disk> disks()
public java.util.Map<java.lang.String,java.lang.Object> getJsonStructure()
public java.util.Map<java.lang.String,DiskStats> diskStats()
ClusterModel
has
been created with a request to populate replica placement info, otherwise returns an empty map.public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- the output stream.java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(Broker o)
compareTo
in interface java.lang.Comparable<Broker>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object