Interface ClusterState.FeatureAware

All Known Subinterfaces:
ClusterState.Custom, Metadata.Custom, Metadata.NonRestorableCustom, PersistentTaskParams
All Known Implementing Classes:
ComponentTemplateMetadata, ComposableIndexTemplateMetadata, DataStreamMetadata, ElasticsearchNodeCommand.UnknownMetadataCustom, FeatureMigrationResults, IndexGraveyard, IngestMetadata, NodesShutdownMetadata, PersistentTasksCustomMetadata, RepositoriesMetadata, RepositoryCleanupInProgress, RestoreInProgress, ScriptMetadata, SnapshotDeletionsInProgress, SnapshotsInProgress, SystemIndexMigrationTaskParams
Enclosing class:

public static interface ClusterState.FeatureAware
An interface that implementors use when a class requires a client to maybe have a feature.
  • Method Details

    • getRequiredFeature

      default Optional<String> getRequiredFeature()
      An optional feature that is required for the client to have.
      an empty optional if no feature is required otherwise a string representing the required feature
    • shouldSerialize

      static <T extends VersionedNamedWriteable & ClusterState.FeatureAware> boolean shouldSerialize(StreamOutput out, T custom)
      Tests whether or not the custom should be serialized. The criteria are:
      • the output stream must be at least the minimum supported version of the custom
      • the output stream must have the feature required by the custom (if any) or not be a transport client

      That is, we only serialize customs to clients than can understand the custom based on the version of the client and the features that the client has. For transport clients we can be lenient in requiring a feature in which case we do not send the custom but for connected nodes we always require that the node has the required feature.

      Type Parameters:
      T - the type of the custom
      out - the output stream
      custom - the custom to serialize
      true if the custom should be serialized and false otherwise