public class Disk extends Object implements Comparable<Disk>
Modifier and Type | Class and Description |
---|---|
static class |
Disk.State |
Modifier and Type | Method and Description |
---|---|
Broker |
broker() |
double |
capacity() |
int |
compareTo(Disk d) |
DiskStats |
diskStats() |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isAlive() |
Set<Replica> |
leaderReplicas() |
String |
logDir() |
Set<Replica> |
replicas() |
void |
setState(Disk.State newState)
Set Disk status.
|
Disk.State |
state() |
String |
toString() |
SortedReplicas |
trackedSortedReplicas(String sortName)
Get the tracked sorted replicas using the given sort name.
|
void |
trackSortedReplicas(String sortName,
Function<Replica,Boolean> selectionFunc,
Function<Replica,Double> scoreFunc) |
void |
trackSortedReplicas(String sortName,
Function<Replica,Boolean> selectionFunc,
Function<Replica,Integer> priorityFunc,
Function<Replica,Double> scoreFunc)
Track the sorted replicas using the given score function.
|
void |
untrackSortedReplicas(String sortName)
Untrack the sorted replicas for the given sort name.
|
double |
utilization() |
void |
writeTo(OutputStream out)
Output writing string representation of this class to the stream.
|
public String logDir()
public double capacity()
public Disk.State state()
public boolean isAlive()
public Broker broker()
public double utilization()
public void setState(Disk.State newState)
newState
- The new state of the broker.public void trackSortedReplicas(String sortName, Function<Replica,Boolean> selectionFunc, Function<Replica,Integer> priorityFunc, Function<Replica,Double> scoreFunc)
sortName
- the name of the tracked sorted replicas.selectionFunc
- the selection function to decide which replicas to include.priorityFunc
- the priority function to sort replicas.scoreFunc
- the score function to sort replicas.public void trackSortedReplicas(String sortName, Function<Replica,Boolean> selectionFunc, Function<Replica,Double> scoreFunc)
public void untrackSortedReplicas(String sortName)
sortName
- the name of the tracked sorted replicas.public SortedReplicas trackedSortedReplicas(String sortName)
sortName
- the sort name.SortedReplicas
for the given sort name.public int compareTo(Disk d)
compareTo
in interface Comparable<Disk>
public void writeTo(OutputStream out) throws IOException
out
- the output stream.IOException
public DiskStats diskStats()