Module org.elasticsearch.server
Record Class ReservedStateMetadata
java.lang.Object
java.lang.Record
org.elasticsearch.cluster.metadata.ReservedStateMetadata
- All Implemented Interfaces:
Diffable<ReservedStateMetadata>,SimpleDiffable<ReservedStateMetadata>,Writeable,ToXContent,ToXContentFragment
public record ReservedStateMetadata(String namespace, Long version, Map<String,ReservedStateHandlerMetadata> handlers, ReservedStateErrorMetadata errorMetadata)
extends Record
implements SimpleDiffable<ReservedStateMetadata>, ToXContentFragment
Metadata class that contains information about reserved cluster state set
through file based settings or by modules/plugins.
These types of cluster settings/entities can be read through the REST API, but can only be modified through a versioned 'operator mode' update, e.g. file based settings or module/plugin upgrade.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.cluster.SimpleDiffable
SimpleDiffable.CompleteDiff<T extends Diffable<T>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTYFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionReservedStateMetadata(String namespace, Long version, Map<String, ReservedStateHandlerMetadata> handlers, ReservedStateErrorMetadata errorMetadata) ReservedStateMetadata contains information about reserved cluster settings. -
Method Summary
Modifier and TypeMethodDescriptionConvenience method for creating aReservedStateMetadata.BuilderforReservedStateMetadatabuilder(String namespace, ReservedStateMetadata metadata) Convenience method for creating aReservedStateMetadata.BuilderforReservedStateMetadataCreates a set intersection between cluster state keys set by a givenReservedClusterStateHandlerand the input set.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMetadatarecord component.static ReservedStateMetadatafromXContent(XContentParser parser) ReadsReservedStateMetadatafromXContentParserhandlers()Returns the value of thehandlersrecord component.final inthashCode()Returns a hash code value for this object.Get the reserved keys for the handler nameReturns the value of thenamespacerecord component.static Diff<ReservedStateMetadata> static ReservedStateMetadatareadFrom(StreamInput in) Reads anReservedStateMetadatafrom aStreamInputfinal StringtoString()Returns a string representation of this record class.toXContent(XContentBuilder builder, ToXContent.Params params) version()Returns the value of theversionrecord component.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diffMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NO_VERSION
-
EMPTY_VERSION
-
RESTORED_VERSION
-
-
Constructor Details
-
ReservedStateMetadata
public ReservedStateMetadata(String namespace, Long version, Map<String, ReservedStateHandlerMetadata> handlers, ReservedStateErrorMetadata errorMetadata) ReservedStateMetadata contains information about reserved cluster settings.These settings cannot be updated by the end user and are set outside of the REST layer, e.g. through file based settings or by plugin/modules.
- Parameters:
namespace- The namespace of the setting creator, e.g. file_settings, security plugin, etc.version- The update version, must increase with each updatehandlers- Per state update handler information on key set in by this update. These keys are validated at REST time.errorMetadata- If the update failed for some reason, this is where we store the error information metadata.
-
-
Method Details
-
conflicts
Creates a set intersection between cluster state keys set by a givenReservedClusterStateHandlerand the input set.This method is to be used to check if a REST action handler is allowed to modify certain cluster state.
- Parameters:
handlerName- the name of the reserved state handler we need to check for keysmodified- a set of keys we want to see if we can modify.- Returns:
-
keys
Get the reserved keys for the handler name- Parameters:
handlerName- handler name to get keys for- Returns:
- set of keys for that handler
-
readFrom
Reads anReservedStateMetadatafrom aStreamInput- Parameters:
in- theStreamInputto read from- Returns:
ReservedStateMetadata- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
readDiffFrom
- Parameters:
in- theStreamInputto read the diff from- Returns:
- a
DiffofReservedStateMetadata - Throws:
IOException
-
builder
Convenience method for creating aReservedStateMetadata.BuilderforReservedStateMetadata- Parameters:
namespace- the namespace under which we'll store theReservedStateMetadata- Returns:
ReservedStateMetadata.Builder
-
builder
public static ReservedStateMetadata.Builder builder(String namespace, ReservedStateMetadata metadata) Convenience method for creating aReservedStateMetadata.BuilderforReservedStateMetadata- Parameters:
namespace- the namespace under which we'll store theReservedStateMetadatametadata- an existingReservedStateMetadata- Returns:
ReservedStateMetadata.Builder
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
fromXContent
ReadsReservedStateMetadatafromXContentParser- Parameters:
parser-XContentParser- Returns:
ReservedStateMetadata- Throws:
IOException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
namespace
Returns the value of thenamespacerecord component.- Returns:
- the value of the
namespacerecord component
-
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
handlers
Returns the value of thehandlersrecord component.- Returns:
- the value of the
handlersrecord component
-
errorMetadata
Returns the value of theerrorMetadatarecord component.- Returns:
- the value of the
errorMetadatarecord component
-