public class SortedReplicas
extends java.lang.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.
|
java.util.function.Function<Replica,java.lang.Integer> |
priorityFunction() |
java.util.List<Replica> |
reverselySortedReplicas()
Get a list of replicas in the descending order of their priority and score.
|
java.util.function.Function<Replica,java.lang.Double> |
scoreFunction() |
java.util.function.Function<Replica,java.lang.Boolean> |
selectionFunction() |
java.util.List<Replica> |
sortedReplicas()
Get the sorted replicas in the ascending order of their priority and score.
|
java.util.NavigableSet<ReplicaWrapper> |
sortedReplicaWrappers()
Get the sorted replica wrappers in the ascending order of their priority and score.
|
public java.util.NavigableSet<ReplicaWrapper> sortedReplicaWrappers()
public java.util.List<Replica> sortedReplicas()
public java.util.List<Replica> reverselySortedReplicas()
public java.util.function.Function<Replica,java.lang.Boolean> selectionFunction()
SortedReplicas
public java.util.function.Function<Replica,java.lang.Integer> priorityFunction()
SortedReplicas
public java.util.function.Function<Replica,java.lang.Double> scoreFunction()
SortedReplicas
public void add(Replica replica)
SortedReplicas
has not been
initialized.replica
- the replica to add.