Class DiscoveryNodeRole

java.lang.Object
org.elasticsearch.cluster.node.DiscoveryNodeRole
All Implemented Interfaces:
Comparable<DiscoveryNodeRole>

public class DiscoveryNodeRole extends Object implements Comparable<DiscoveryNodeRole>
Represents a node role.
  • Field Details

    • DATA_ROLE

      public static final DiscoveryNodeRole DATA_ROLE
      Represents the role for a data node.
    • DATA_CONTENT_NODE_ROLE

      public static DiscoveryNodeRole DATA_CONTENT_NODE_ROLE
      Represents the role for a content node.
    • DATA_HOT_NODE_ROLE

      public static DiscoveryNodeRole DATA_HOT_NODE_ROLE
      Represents the role for a hot node.
    • DATA_WARM_NODE_ROLE

      public static DiscoveryNodeRole DATA_WARM_NODE_ROLE
      Represents the role for a warm node.
    • DATA_COLD_NODE_ROLE

      public static DiscoveryNodeRole DATA_COLD_NODE_ROLE
      Represents the role for a cold node.
    • DATA_FROZEN_NODE_ROLE

      public static DiscoveryNodeRole DATA_FROZEN_NODE_ROLE
      Represents the role for a frozen node.
    • INGEST_ROLE

      public static final DiscoveryNodeRole INGEST_ROLE
      Represents the role for an ingest node.
    • MASTER_ROLE

      public static final DiscoveryNodeRole MASTER_ROLE
      Represents the role for a master-eligible node.
    • VOTING_ONLY_NODE_ROLE

      public static final DiscoveryNodeRole VOTING_ONLY_NODE_ROLE
      Represents the role for a voting-only node.
    • REMOTE_CLUSTER_CLIENT_ROLE

      public static final DiscoveryNodeRole REMOTE_CLUSTER_CLIENT_ROLE
      Represents the role for a node that can be a remote cluster client.
    • ML_ROLE

      public static final DiscoveryNodeRole ML_ROLE
      Represents the role for a machine learning node.
    • TRANSFORM_ROLE

      public static final DiscoveryNodeRole TRANSFORM_ROLE
      Represents the role for a transform node.
  • Constructor Details

    • DiscoveryNodeRole

      protected DiscoveryNodeRole(String roleName, String roleNameAbbreviation)
    • DiscoveryNodeRole

      protected DiscoveryNodeRole(String roleName, String roleNameAbbreviation, boolean canContainData)
  • Method Details

    • roleName

      public final String roleName()
      The name of the role.
      Returns:
      the role name
    • roleNameAbbreviation

      public final String roleNameAbbreviation()
      The abbreviation of the name of the role. This is used in the cat nodes API to display an abbreviated version of the name of the role.
      Returns:
      the role name abbreviation
    • canContainData

      public final boolean canContainData()
      Indicates whether a node with this role can contain data.
      Returns:
      true if a node with this role can contain data, otherwise false
    • isEnabledByDefault

      public boolean isEnabledByDefault(Settings settings)
      Whether or not the role is enabled by default given the specified settings
      Parameters:
      settings - the settings instance
      Returns:
      true if the role is enabled by default given the specified settings, otherwise false
    • validateRoles

      public void validateRoles(List<DiscoveryNodeRole> roles)
      Validate this role against all configured roles. Implementors are expected to throw an IllegalArgumentException when the combination of configured roles is invalid with this role.
      Parameters:
      roles - the complete set of configured roles
    • equals

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

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public final int compareTo(DiscoveryNodeRole o)
      Specified by:
      compareTo in interface Comparable<DiscoveryNodeRole>
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • roles

      public static SortedSet<DiscoveryNodeRole> roles()
      The possible node roles.
      Returns:
      an ordered, immutable set of possible roles
    • roleNames

      public static SortedSet<String> roleNames()
      The set of possible role names.
      Returns:
      an ordered, immutable set of possible role names
    • maybeGetRoleFromRoleName

      public static Optional<DiscoveryNodeRole> maybeGetRoleFromRoleName(String roleName)
      Get an optional representing the role with the given role name, if such a role exists.
      Parameters:
      roleName - the role name to get the associated role representation for
      Returns:
      an optional node role
    • getRoleFromRoleName

      public static DiscoveryNodeRole getRoleFromRoleName(String roleName)
      Get a representation of the role with the given role name, if such a role exists, otherwise an exception is thrown.
      Parameters:
      roleName - the role name to get the associated role representation for
      Returns:
      a node role
      Throws:
      IllegalArgumentException - if no node role with the given role name exists