Class ReservedComposableIndexTemplateAction

java.lang.Object
org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction
All Implemented Interfaces:
ReservedClusterStateHandler<org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables>

public class ReservedComposableIndexTemplateAction extends Object implements ReservedClusterStateHandler<org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables>
This ReservedClusterStateHandler is responsible for reserved state CRUD operations on composable index templates and component templates, e.g. file based settings.

Internally it uses MetadataIndexTemplateService to add, update and delete both composable index templates and component templates. The reserved state handler is implemented as a joint handler for both component templates and composable index templates, because of the inherent interdependencies of the two separate types. For example, one cannot create composable index templates without first the component definitions being in the cluster state, however, the opposite is true when deleting. This circular dependency makes it impossible for separation of the two handlers.

  • Field Details

  • Constructor Details

  • Method Details

    • name

      public String name()
      Description copied from interface: ReservedClusterStateHandler
      Unique identifier for the handler.

      The handler name is a unique identifier that is matched to a section in a cluster state update content. The reserved cluster state updates are done as a single cluster state update and the cluster state is typically supplied as a combined content, unlike the REST handlers. This name must match a desired content key name in the combined cluster state update, e.g. "ilm" or "cluster_settings" (for persistent cluster settings update).

      Specified by:
      name in interface ReservedClusterStateHandler<org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables>
      Returns:
      a String with the handler name, e.g "ilm".
    • reservedComponentName

      public static String reservedComponentName(String name)
      Prefixes the component template name with a prefix for storage in the cluster state
      Parameters:
      name - component template name
      Returns:
      prefixed component template name for storage in the reserved cluster state
    • componentNameFromReservedName

      public static String componentNameFromReservedName(String name)
      Removes the reserved cluster state prefix from the component template name

      Once the prefix is removed we can use the name for conflict validation in TransportPutComponentTemplateAction and TransportDeleteComponentTemplateAction

      Parameters:
      name - the prefixed reserved component template name
      Returns:
      the un-prefixed component template name used for conflict validation at REST
    • reservedComposableIndexName

      public static String reservedComposableIndexName(String name)
      Prefixes the composable index template name with a prefix for storage in the cluster state
      Parameters:
      name - composable index template name
      Returns:
      prefixed composable index template name for storage in the reserved cluster state
    • composableIndexNameFromReservedName

      public static String composableIndexNameFromReservedName(String name)
      Removes the reserved cluster state prefix from the composable index template name

      Once the prefix is removed we can use the name for conflict validation in TransportPutComposableIndexTemplateAction and TransportDeleteComposableIndexTemplateAction

      Parameters:
      name - the prefixed reserved composable index template name
      Returns:
      the un-prefixed composable index template name used for conflict validation at REST
    • transform

      public TransformState transform(Object source, TransformState prevState) throws Exception
      Description copied from interface: ReservedClusterStateHandler
      The transformation method implemented by the handler.

      The transform method of the handler should apply the necessary changes to the cluster state as it normally would in a REST handler. One difference is that the transform method in an reserved state handler must perform all CRUD operations of the cluster state in one go. For that reason, we supply a wrapper class to the cluster state called TransformState, which contains the current cluster state as well as any previous keys set by this handler on prior invocation.

      Specified by:
      transform in interface ReservedClusterStateHandler<org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables>
      Parameters:
      source - The parsed information specific to this handler from the combined cluster state content
      prevState - The previous cluster state and keys set by this handler (if any)
      Returns:
      The modified state and the current keys set by this handler
      Throws:
      Exception
    • fromXContent

      public org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables fromXContent(XContentParser parser) throws IOException
      Description copied from interface: ReservedClusterStateHandler
      The parse content method which is called during parsing of file based content.

      The immutable state can be provided as XContent, which means that each handler needs to implement a method to convert an XContent to an object it can consume later in transform

      Specified by:
      fromXContent in interface ReservedClusterStateHandler<org.elasticsearch.action.admin.indices.template.reservedstate.ReservedComposableIndexTemplateAction.ComponentsAndComposables>
      Parameters:
      parser - the XContent parser we are parsing from
      Returns:
      Throws:
      IOException