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