public abstract class AbstractAllocationDecision extends java.lang.Object implements ToXContentFragment, Writeable
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<NodeAllocationResult> |
nodeDecisions |
protected DiscoveryNode |
targetNode |
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
protected |
AbstractAllocationDecision(DiscoveryNode targetNode,
java.util.List<NodeAllocationResult> nodeDecisions) |
protected |
AbstractAllocationDecision(StreamInput in) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
atLeastOneNodeWithYesDecision()
Returns
true if there is at least one node that returned a Decision.Type.YES decision for allocating this shard. |
protected void |
checkDecisionState() |
static XContentBuilder |
discoveryNodeToXContent(DiscoveryNode node,
boolean outerObjectWritten,
XContentBuilder builder)
Generates X-Content for a
DiscoveryNode that leaves off some of the non-critical fields. |
boolean |
equals(java.lang.Object other) |
abstract java.lang.String |
getExplanation()
Gets the explanation for the decision.
|
java.util.List<NodeAllocationResult> |
getNodeDecisions()
Gets the sorted list of individual node-level decisions that went into making the ultimate decision whether
to allocate or move the shard.
|
DiscoveryNode |
getTargetNode()
Get the node that the allocator will assign the shard to, returning
null if there is no node to
which the shard will be assigned or moved. |
int |
hashCode() |
abstract boolean |
isDecisionTaken()
Returns
true if a decision was taken by the allocator, false otherwise. |
XContentBuilder |
nodeDecisionsToXContent(java.util.List<NodeAllocationResult> nodeDecisions,
XContentBuilder builder,
ToXContent.Params params)
Generates X-Content for the node-level decisions, creating the outer "node_decisions" object
in which they are serialized.
|
java.util.List<NodeAllocationResult> |
sortNodeDecisions(java.util.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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFragment
toXContent
@Nullable protected final DiscoveryNode targetNode
@Nullable protected final java.util.List<NodeAllocationResult> nodeDecisions
protected AbstractAllocationDecision(@Nullable DiscoveryNode targetNode, @Nullable java.util.List<NodeAllocationResult> nodeDecisions)
protected AbstractAllocationDecision(StreamInput in) throws java.io.IOException
java.io.IOException
public abstract boolean isDecisionTaken()
true
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 an IllegalStateException
.@Nullable public DiscoveryNode getTargetNode()
null
if there is no node to
which the shard will be assigned or moved. If isDecisionTaken()
returns false
, then
invoking this method will throw an IllegalStateException
.@Nullable public java.util.List<NodeAllocationResult> getNodeDecisions()
isDecisionTaken()
returns false
, then
invoking this method will throw an IllegalStateException
.public abstract java.lang.String getExplanation()
isDecisionTaken()
returns false
, then invoking
this method will throw an IllegalStateException
.public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
protected void checkDecisionState()
public static XContentBuilder discoveryNodeToXContent(DiscoveryNode node, boolean outerObjectWritten, XContentBuilder builder) throws java.io.IOException
DiscoveryNode
that leaves off some of the non-critical fields.java.io.IOException
public java.util.List<NodeAllocationResult> sortNodeDecisions(java.util.List<NodeAllocationResult> nodeDecisions)
public XContentBuilder nodeDecisionsToXContent(java.util.List<NodeAllocationResult> nodeDecisions, XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
protected boolean atLeastOneNodeWithYesDecision()
true
if there is at least one node that returned a Decision.Type.YES
decision for allocating this shard.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object