Class AbstractAllocationDecision
java.lang.Object
org.elasticsearch.cluster.routing.allocation.AbstractAllocationDecision
- All Implemented Interfaces:
Writeable
,org.elasticsearch.xcontent.ToXContent
,org.elasticsearch.xcontent.ToXContentFragment
- Direct Known Subclasses:
AllocateUnassignedDecision
,MoveDecision
public abstract class AbstractAllocationDecision
extends Object
implements org.elasticsearch.xcontent.ToXContentFragment, Writeable
An abstract class for representing various types of allocation decisions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<NodeAllocationResult>
protected final DiscoveryNode
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractAllocationDecision
(DiscoveryNode targetNode, List<NodeAllocationResult> nodeDecisions) protected
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Returnstrue
if there is at least one node that returned aDecision.Type.YES
decision for allocating this shard.protected void
static org.elasticsearch.xcontent.XContentBuilder
discoveryNodeToXContent
(DiscoveryNode node, boolean outerObjectWritten, org.elasticsearch.xcontent.XContentBuilder builder) Generates X-Content for aDiscoveryNode
that leaves off some of the non-critical fields.boolean
abstract String
Gets the explanation for the decision.Gets the sorted list of individual node-level decisions that went into making the ultimate decision whether to allocate or move the shard.Get the node that the allocator will assign the shard to, returningnull
if there is no node to which the shard will be assigned or moved.int
hashCode()
abstract boolean
Returnstrue
if a decision was taken by the allocator,false
otherwise.org.elasticsearch.xcontent.XContentBuilder
nodeDecisionsToXContent
(List<NodeAllocationResult> nodeDecisions, org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) Generates X-Content for the node-level decisions, creating the outer "node_decisions" object in which they are serialized.sortNodeDecisions
(List<NodeAllocationResult> nodeDecisions) Sorts a list of node level decisions by the decision type, then by weight ranking, and finally by node id.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContent
toXContent
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
targetNode
-
nodeDecisions
-
-
Constructor Details
-
AbstractAllocationDecision
protected AbstractAllocationDecision(@Nullable DiscoveryNode targetNode, @Nullable List<NodeAllocationResult> nodeDecisions) -
AbstractAllocationDecision
- Throws:
IOException
-
-
Method Details
-
isDecisionTaken
public abstract boolean isDecisionTaken()Returnstrue
if a decision was taken by the allocator,false
otherwise. If no decision was taken, then the rest of the fields in this object cannot be accessed and will throw anIllegalStateException
. -
getTargetNode
Get the node that the allocator will assign the shard to, returningnull
if there is no node to which the shard will be assigned or moved. IfisDecisionTaken()
returnsfalse
, then invoking this method will throw anIllegalStateException
. -
getNodeDecisions
Gets the sorted list of individual node-level decisions that went into making the ultimate decision whether to allocate or move the shard. IfisDecisionTaken()
returnsfalse
, then invoking this method will throw anIllegalStateException
. -
getExplanation
Gets the explanation for the decision. IfisDecisionTaken()
returnsfalse
, then invoking this method will throw anIllegalStateException
. -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
checkDecisionState
protected void checkDecisionState() -
discoveryNodeToXContent
public static org.elasticsearch.xcontent.XContentBuilder discoveryNodeToXContent(DiscoveryNode node, boolean outerObjectWritten, org.elasticsearch.xcontent.XContentBuilder builder) throws IOException Generates X-Content for aDiscoveryNode
that leaves off some of the non-critical fields.- Throws:
IOException
-
sortNodeDecisions
Sorts a list of node level decisions by the decision type, then by weight ranking, and finally by node id. -
nodeDecisionsToXContent
public org.elasticsearch.xcontent.XContentBuilder nodeDecisionsToXContent(List<NodeAllocationResult> nodeDecisions, org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException Generates X-Content for the node-level decisions, creating the outer "node_decisions" object in which they are serialized.- Throws:
IOException
-
atLeastOneNodeWithYesDecision
protected boolean atLeastOneNodeWithYesDecision()Returnstrue
if there is at least one node that returned aDecision.Type.YES
decision for allocating this shard. -
equals
-
hashCode
public int hashCode()
-