Module org.elasticsearch.server
Class BalancedShardsAllocator.NodeSorter
java.lang.Object
org.apache.lucene.util.Sorter
org.apache.lucene.util.IntroSorter
org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.NodeSorter
- Enclosing class:
BalancedShardsAllocator
public static final class BalancedShardsAllocator.NodeSorter
extends org.apache.lucene.util.IntroSorter
A NodeSorter sorts the set of nodes for a single partition using the
WeightFunction
for that partition. In partitioned cluster topologies there will be one for each partition
(e.g. search/indexing in stateless). By default, there is a single partition containing
a single weight function that applies to all nodes and shards.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNodeSorter(BalancedShardsAllocator.ModelNode[] modelNodes, WeightFunction function, BalancedShardsAllocator.Balancer balancer) -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompare(int i, int j) protected intcomparePivot(int j) floatdelta()floatvoidreset(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index) voidreset(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index, int from, int to) Resets the sorter, recalculates the weights per node and sorts the nodes by weight, with minimal weight first.protected voidsetPivot(int i) protected voidswap(int i, int j) floatMethods inherited from class org.apache.lucene.util.IntroSorter
sort
-
Constructor Details
-
NodeSorter
public NodeSorter(BalancedShardsAllocator.ModelNode[] modelNodes, WeightFunction function, BalancedShardsAllocator.Balancer balancer)
-
-
Method Details
-
reset
public void reset(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index, int from, int to) Resets the sorter, recalculates the weights per node and sorts the nodes by weight, with minimal weight first. -
reset
public void reset(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index) -
weight
-
minWeightDelta
public float minWeightDelta() -
swap
protected void swap(int i, int j) - Specified by:
swapin classorg.apache.lucene.util.Sorter
-
compare
protected int compare(int i, int j) - Overrides:
comparein classorg.apache.lucene.util.IntroSorter
-
setPivot
protected void setPivot(int i) - Specified by:
setPivotin classorg.apache.lucene.util.IntroSorter
-
comparePivot
protected int comparePivot(int j) - Specified by:
comparePivotin classorg.apache.lucene.util.IntroSorter
-
delta
public float delta() -
getWeightFunction
-