Class NodeAllocationResult
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.NodeAllocationResult
-
- All Implemented Interfaces:
java.lang.Comparable<NodeAllocationResult>
,Writeable
,ToXContent
,ToXContentObject
public class NodeAllocationResult extends java.lang.Object implements ToXContentObject, Writeable, java.lang.Comparable<NodeAllocationResult>
This class represents the shard allocation decision and its explanation for a single node.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NodeAllocationResult.ShardStoreInfo
A class that captures metadata about a shard store on a node.-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description NodeAllocationResult(DiscoveryNode node, AllocationDecision nodeDecision, Decision canAllocate, int weightRanking)
NodeAllocationResult(DiscoveryNode node, Decision decision, int weightRanking)
NodeAllocationResult(DiscoveryNode node, NodeAllocationResult.ShardStoreInfo shardStoreInfo, Decision decision)
NodeAllocationResult(StreamInput in)
-
Method Summary
Modifier and Type Method Description int
compareTo(NodeAllocationResult other)
Decision
getCanAllocateDecision()
The decision details for allocating to this node.DiscoveryNode
getNode()
Get the node that this decision is for.AllocationDecision
getNodeDecision()
Gets theAllocationDecision
for allocating to this node.NodeAllocationResult.ShardStoreInfo
getShardStoreInfo()
Get the shard store information for the node, if it exists.int
getWeightRanking()
The weight ranking for allocating a shard to the node.boolean
isWeightRanked()
Is the weight assigned for the node?XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Constructor Detail
-
NodeAllocationResult
public NodeAllocationResult(DiscoveryNode node, NodeAllocationResult.ShardStoreInfo shardStoreInfo, @Nullable Decision decision)
-
NodeAllocationResult
public NodeAllocationResult(DiscoveryNode node, AllocationDecision nodeDecision, Decision canAllocate, int weightRanking)
-
NodeAllocationResult
public NodeAllocationResult(DiscoveryNode node, Decision decision, int weightRanking)
-
NodeAllocationResult
public NodeAllocationResult(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
getNode
public DiscoveryNode getNode()
Get the node that this decision is for.
-
getShardStoreInfo
@Nullable public NodeAllocationResult.ShardStoreInfo getShardStoreInfo()
Get the shard store information for the node, if it exists.
-
getCanAllocateDecision
@Nullable public Decision getCanAllocateDecision()
The decision details for allocating to this node. Returnsnull
if no allocation decision was taken on the node; in this case,getNodeDecision()
will returnAllocationDecision.NO
.
-
isWeightRanked
public boolean isWeightRanked()
Is the weight assigned for the node?
-
getWeightRanking
public int getWeightRanking()
The weight ranking for allocating a shard to the node. Each node will have a unique weight ranking that is relative to the other nodes against which the deciders ran. For example, suppose there are 3 nodes which the allocation deciders decided upon: node1, node2, and node3. If node2 had the best weight for holding the shard, followed by node3, followed by node1, then node2's weight will be 1, node3's weight will be 2, and node1's weight will be 1. A value of 0 means the weight was not calculated or factored into the decision.
-
getNodeDecision
public AllocationDecision getNodeDecision()
Gets theAllocationDecision
for allocating to this node.
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
compareTo
public int compareTo(NodeAllocationResult other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<NodeAllocationResult>
-
-