Class AbstractAllocationDecision

org.elasticsearch.cluster.routing.allocation.AbstractAllocationDecision
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment
Direct Known Subclasses:
AllocateUnassignedDecision, MoveDecision

public abstract class AbstractAllocationDecision extends implements org.elasticsearch.common.xcontent.ToXContentFragment, Writeable
An abstract class for representing various types of allocation decisions.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected DiscoveryNode
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    Returns true if there is at least one node that returned a Decision.Type.YES decision for allocating this shard.
    protected void
     
    static org.elasticsearch.common.xcontent.XContentBuilder
    discoveryNodeToXContent​(DiscoveryNode node, boolean outerObjectWritten, org.elasticsearch.common.xcontent.XContentBuilder builder)
    Generates X-Content for a DiscoveryNode that leaves off some of the non-critical fields.
    boolean
     other)
     
    abstract
    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, returning null if there is no node to which the shard will be assigned or moved.
    int
     
    abstract boolean
    Returns true if a decision was taken by the allocator, false otherwise.
    org.elasticsearch.common.xcontent.XContentBuilder
    <NodeAllocationResult> nodeDecisions, org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
    Generates X-Content for the node-level decisions, creating the outer "node_decisions" object in which they are serialized.
    <NodeAllocationResult> nodeDecisions)
    Sorts a list of node level decisions by the decision type, then by weight ranking, and finally by node id.
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.

    , , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent

    toXContent

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

  • Constructor Details

    • AbstractAllocationDecision

      protected AbstractAllocationDecision(@Nullable DiscoveryNode targetNode, @Nullable <NodeAllocationResult> nodeDecisions)
    • AbstractAllocationDecision

      protected AbstractAllocationDecision(StreamInput in) throws
      Throws:
  • Method Details

    • isDecisionTaken

      public abstract boolean isDecisionTaken()
      Returns 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.
    • getTargetNode

      @Nullable public 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. If isDecisionTaken() returns false, then invoking this method will throw an IllegalStateException.
    • getNodeDecisions

      @Nullable public <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. If isDecisionTaken() returns false, then invoking this method will throw an IllegalStateException.
    • getExplanation

      public abstract  getExplanation()
      Gets the explanation for the decision. If isDecisionTaken() returns false, then invoking this method will throw an IllegalStateException.
    • writeTo

      public void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
    • checkDecisionState

      protected void checkDecisionState()
    • discoveryNodeToXContent

      public static org.elasticsearch.common.xcontent.XContentBuilder discoveryNodeToXContent(DiscoveryNode node, boolean outerObjectWritten, org.elasticsearch.common.xcontent.XContentBuilder builder) throws
      Generates X-Content for a DiscoveryNode that leaves off some of the non-critical fields.
      Throws:
    • sortNodeDecisions

      public <<NodeAllocationResult> nodeDecisions)
      Sorts a list of node level decisions by the decision type, then by weight ranking, and finally by node id.
    • nodeDecisionsToXContent

      public org.elasticsearch.common.xcontent.XContentBuilder nodeDecisionsToXContent(<NodeAllocationResult> nodeDecisions, org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Generates X-Content for the node-level decisions, creating the outer "node_decisions" object in which they are serialized.
      Throws:
    • atLeastOneNodeWithYesDecision

      protected boolean atLeastOneNodeWithYesDecision()
      Returns true if there is at least one node that returned a Decision.Type.YES decision for allocating this shard.
    • equals

      public boolean equals( other)
      Overrides:
       in class 
    • hashCode

      public int hashCode()
      Overrides:
       in class