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.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.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionCompatibilityVersions(TransportVersion transportVersion, Map<String, SystemIndexDescriptor.MappingsVersion> systemIndexMappingsVersion) Creates an instance of aCompatibilityVersionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidensureVersionsCompatibility(CompatibilityVersions candidate, Collection<CompatibilityVersions> existing) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static CompatibilityVersionsminimumVersions(Collection<CompatibilityVersions> compatibilityVersions) Constructs a VersionWrapper collecting all the minimum versions from the values of the map.static CompatibilityVersionsReturns the value of thesystemIndexMappingsVersionrecord component.final StringtoString()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 thetransportVersionrecord 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.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Constructor Details
-
CompatibilityVersions
public CompatibilityVersions(TransportVersion transportVersion, Map<String, SystemIndexDescriptor.MappingsVersion> systemIndexMappingsVersion) Creates an instance of aCompatibilityVersionsrecord class.- Parameters:
transportVersion- the value for thetransportVersionrecord componentsystemIndexMappingsVersion- the value for thesystemIndexMappingsVersionrecord 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:WriteableWrite this into the StreamOutput.- Specified by:
writeToin 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:
toXContentin 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 thetransportVersionrecord component.- Returns:
- the value of the
transportVersionrecord component
-
systemIndexMappingsVersion
Returns the value of thesystemIndexMappingsVersionrecord component.- Returns:
- the value of the
systemIndexMappingsVersionrecord component
-