public class Rack extends Object implements Serializable, ResourceStats
Constructor and Description |
---|
Rack(String id)
Constructor of the rack class using the given id to identify the rack.
|
Modifier and Type | Method and Description |
---|---|
Broker |
broker(int brokerId)
Get the broker with the given broker id.
|
Collection<Broker> |
brokers()
Get the collection of brokers in the current rack.
|
Capacity |
capacity() |
Map<String,Object> |
getJsonStructure() |
Collection<Host> |
hosts()
Return the hosts in this rack.
|
String |
id()
Get the rack id.
|
boolean |
isEligibleDestination() |
boolean |
isRackAlive()
Checks if rack has at least one alive servers.
|
Load |
load()
Get the rack load information.
|
int |
numTopicReplicas(String topic)
Get the number of replicas with the given topic name in this rack.
|
List<Replica> |
replicas()
Get the list of replicas in the rack.
|
Set<String> |
topics()
Get a set of topic names in the cluster.
|
String |
toString()
Get string representation of
Rack . |
Utilization |
utilization() |
void |
writeTo(OutputStream out)
Output writing string representation of this class to the stream.
|
public Rack(String id)
id
- An identifier for this rack.public Load load()
load
in interface ResourceStats
public Utilization utilization()
utilization
in interface ResourceStats
public String id()
public Collection<Broker> brokers()
public Collection<Host> hosts()
public Broker broker(int brokerId)
brokerId
- id of the queried broker.public int numTopicReplicas(String topic)
topic
- Name of the topic for which the number of replicas in this rack will be counted.public Capacity capacity()
capacity
in interface ResourceStats
public boolean isEligibleDestination()
public boolean isRackAlive()
public void writeTo(OutputStream out) throws IOException
out
- the output stream.IOException