Class ClusterState

java.lang.Object
com.yahoo.vdslib.state.ClusterState
All Implemented Interfaces:
Cloneable

public final class ClusterState extends Object implements Cloneable
Be careful about changing this class, as it mirrors the ClusterState in C++. Please update both if you need to change anything.
  • Constructor Details

  • Method Details

    • stateFromString

      public static ClusterState stateFromString(String stateStr)
      Parse a given cluster state string into a returned ClusterState instance, wrapping any parse exceptions in a RuntimeException.
    • emptyState

      public static ClusterState emptyState()
    • clone

      public ClusterState clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • similarTo

      public boolean similarTo(Object o)
    • similarToIgnoringInitProgress

      public boolean similarToIgnoringInitProgress(ClusterState other)
    • getTextualDifference

      public String getTextualDifference(ClusterState other)
    • getHtmlDifference

      public String getHtmlDifference(ClusterState other)
    • getVersion

      public int getVersion()
    • setVersion

      public void setVersion(int version)
    • getDistributionBitCount

      public int getDistributionBitCount()
    • setDistributionBits

      public void setDistributionBits(int bits)
    • getClusterState

      public State getClusterState()
      Returns the state of this cluster state. In particular, it does not return the cluster state, no matter what the function name says.
    • setClusterState

      public void setClusterState(State s)
      Sets the state of this cluster state. In particular, it does not set the cluster state, no matter what the function name says.
    • getNodeCount

      public int getNodeCount(NodeType type)
      Take the distributor nodes as an example. Let X be the highest index of the distributor nodes added through setNodeState(). Let Y be the number of suffix nodes for which the state is down and without description. E.g. if node X is down and without description, but nodex X-1 is up, then Y is 1. The node count for distributors is then X + 1 - Y.
    • getNodeState

      public NodeState getNodeState(Node node)
      Returns the state of a node. If the node is not known this returns a node in the state UP (never null) if it has lower index than the max and DOWN otherwise.
    • setNodeState

      public void setNodeState(Node node, NodeState newState)
      Set the node state of the given node. Automatically adjusts number of nodes of that given type if out of range of current nodes seen.
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • toString

      public String toString()
      Returns the serialized form of this cluster state
      Overrides:
      toString in class Object
    • toString

      public String toString(boolean verbose)