Module org.elasticsearch.server
Record Class CompatibilityVersions
java.lang.Object
java.lang.Record
org.elasticsearch.cluster.version.CompatibilityVersions
- Record Components:
transportVersion
- A transport version, usually a minimum compatible one for a node.systemIndexMappingsVersion
- A map of system index names to versions for their mappings.
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
public record CompatibilityVersions(TransportVersion transportVersion, Map<String,SystemIndexDescriptor.MappingsVersion> systemIndexMappingsVersion)
extends Record
implements Writeable, ToXContentFragment
Wraps component version numbers for cluster state
Cluster state will need to carry version information for different independently versioned components.
This wrapper lets us wrap these versions one level below ClusterState
. It's similar to
VersionInformation
, but this class is meant to be constructed during node startup and hold values
from plugins as well.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionCompatibilityVersions
(TransportVersion transportVersion, Map<String, SystemIndexDescriptor.MappingsVersion> systemIndexMappingsVersion) Creates an instance of aCompatibilityVersions
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
ensureVersionsCompatibility
(CompatibilityVersions candidate, Collection<CompatibilityVersions> existing) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static CompatibilityVersions
minimumVersions
(Collection<CompatibilityVersions> compatibilityVersions) Constructs a VersionWrapper collecting all the minimum versions from the values of the map.static CompatibilityVersions
Returns the value of thesystemIndexMappingsVersion
record component.final String
toString()
Returns a string representation of this record class.toXContent
(XContentBuilder builder, ToXContent.Params params) Adds fields to the builder without starting an object.Returns the value of thetransportVersion
record component.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
CompatibilityVersions
public CompatibilityVersions(TransportVersion transportVersion, Map<String, SystemIndexDescriptor.MappingsVersion> systemIndexMappingsVersion) Creates an instance of aCompatibilityVersions
record class.- Parameters:
transportVersion
- the value for thetransportVersion
record componentsystemIndexMappingsVersion
- the value for thesystemIndexMappingsVersion
record component
-
-
Method Details
-
minimumVersions
public static CompatibilityVersions minimumVersions(Collection<CompatibilityVersions> compatibilityVersions) Constructs a VersionWrapper collecting all the minimum versions from the values of the map.- Parameters:
compatibilityVersions
- A map of strings (typically node identifiers) and versions wrappers- Returns:
- Minimum versions for the cluster
-
ensureVersionsCompatibility
public static void ensureVersionsCompatibility(CompatibilityVersions candidate, Collection<CompatibilityVersions> existing) -
readVersion
- Throws:
IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException Adds fields to the builder without starting an object. We expect this method to be called within an object that may already have a nodeId field.- Specified by:
toXContent
in interfaceToXContent
- Parameters:
builder
- The builder for the XContentparams
- Ignored here.- Returns:
- The builder with fields for versions added
- Throws:
IOException
- if the builder can't accept what we try to add
-
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)
. -
transportVersion
Returns the value of thetransportVersion
record component.- Returns:
- the value of the
transportVersion
record component
-
systemIndexMappingsVersion
Returns the value of thesystemIndexMappingsVersion
record component.- Returns:
- the value of the
systemIndexMappingsVersion
record component
-