Class ReservedClusterStateService

java.lang.Object
org.elasticsearch.reservedstate.service.ReservedClusterStateService

public class ReservedClusterStateService extends Object
Controller class for storing and reserving a portion of the ClusterState

This class contains the logic about validation, ordering and applying of the cluster state specified in a file or through plugins/modules. Reserved cluster state cannot be modified through the REST APIs, only through this controller class.

  • Field Details

    • STATE_FIELD

      public static final ParseField STATE_FIELD
    • METADATA_FIELD

      public static final ParseField METADATA_FIELD
  • Constructor Details

    • ReservedClusterStateService

      public ReservedClusterStateService(ClusterService clusterService, RerouteService rerouteService, List<ReservedClusterStateHandler<?>> handlerList)
      Controller class for saving and reserving ClusterState.
      Parameters:
      clusterService - for fetching and saving the modified state
      handlerList - a list of reserved state handlers, which we use to transform the state
  • Method Details

    • process

      public void process(String namespace, XContentParser parser, Consumer<Exception> errorListener)
      Saves and reserves a chunk of the cluster state under a given 'namespace' from XContentParser
      Parameters:
      namespace - the namespace under which we'll store the reserved keys in the cluster state metadata
      parser - the XContentParser to process
      errorListener - a consumer called with IllegalStateException if the content has errors and the cluster state cannot be correctly applied, null if successful or state couldn't be applied because of incompatible version.
    • process

      public void process(String namespace, ReservedStateChunk reservedStateChunk, Consumer<Exception> errorListener)
      Saves and reserves a chunk of the cluster state under a given 'namespace' from XContentParser
      Parameters:
      namespace - the namespace under which we'll store the reserved keys in the cluster state metadata
      reservedStateChunk - a ReservedStateChunk composite state object to process
      errorListener - a consumer called with IllegalStateException if the content has errors and the cluster state cannot be correctly applied, null if successful or the state failed to apply because of incompatible version.
    • installStateHandler

      public void installStateHandler(ReservedClusterStateHandler<?> handler)
      Adds additional ReservedClusterStateHandler to the handler registry
      Parameters:
      handler - an additional reserved state handler to be added