public class SortedReplicas extends Object
A class used by the brokers/disks to host the replicas sorted in a certain order.
The SortedReplicas uses three functions to sort the replicas in the broker/disk.sortedReplicas()
. As alternatives, reverselySortedReplicas()
are provided for convenience.
sortedReplicas()
is no longer binary searchable based on the score.
The SortedReplicas are initialized lazily, i.e. until one of sortedReplicas()
,
reverselySortedReplicas()
and sortedReplicaWrappers()
is invoked, the sorted replicas
will not be populated.
Modifier and Type | Method and Description |
---|---|
void |
add(Replica replica)
Add a new replicas to the sorted replicas.
|
Function<Replica,Integer> |
priorityFunction() |
List<Replica> |
reverselySortedReplicas()
Get a list of replicas in the descending order of their priority and score.
|
Function<Replica,Double> |
scoreFunction() |
Function<Replica,Boolean> |
selectionFunction() |
List<Replica> |
sortedReplicas()
Get the sorted replicas in the ascending order of their priority and score.
|
NavigableSet<ReplicaWrapper> |
sortedReplicaWrappers()
Get the sorted replica wrappers in the ascending order of their priority and score.
|
public NavigableSet<ReplicaWrapper> sortedReplicaWrappers()
public List<Replica> sortedReplicas()
public List<Replica> reverselySortedReplicas()
public Function<Replica,Boolean> selectionFunction()
SortedReplicas
public Function<Replica,Integer> priorityFunction()
SortedReplicas
public Function<Replica,Double> scoreFunction()
SortedReplicas
public void add(Replica replica)
SortedReplicas
has not been
initialized.replica
- the replica to add.