1010package org .elasticsearch .cluster .project ;
1111
1212import org .elasticsearch .TransportVersion ;
13+ import org .elasticsearch .TransportVersionSet ;
1314import org .elasticsearch .TransportVersions ;
1415import org .elasticsearch .cluster .AbstractNamedDiffable ;
1516import org .elasticsearch .cluster .ClusterState ;
@@ -38,6 +39,10 @@ public class ProjectStateRegistry extends AbstractNamedDiffable<ClusterState.Cus
3839 public static final String TYPE = "projects_registry" ;
3940 public static final ProjectStateRegistry EMPTY = new ProjectStateRegistry (Collections .emptyMap (), Collections .emptySet (), 0 );
4041
42+ public static final TransportVersionSet PROJECT_STATE_REGISTRY_RECORDS_DELETIONS = TransportVersionSet .get (
43+ "project-state-registry-records-deletions"
44+ );
45+
4146 private final Map <ProjectId , Settings > projectsSettings ;
4247 // Projects that have been marked for deletion based on their file-based setting
4348 private final Set <ProjectId > projectsMarkedForDeletion ;
@@ -46,7 +51,7 @@ public class ProjectStateRegistry extends AbstractNamedDiffable<ClusterState.Cus
4651
4752 public ProjectStateRegistry (StreamInput in ) throws IOException {
4853 projectsSettings = in .readMap (ProjectId ::readFrom , Settings ::readSettingsFromStream );
49- if (in .getTransportVersion (). onOrAfter ( TransportVersions . PROJECT_STATE_REGISTRY_RECORDS_DELETIONS )) {
54+ if (PROJECT_STATE_REGISTRY_RECORDS_DELETIONS . isCompatible ( in .getTransportVersion ())) {
5055 projectsMarkedForDeletion = in .readCollectionAsImmutableSet (ProjectId ::readFrom );
5156 projectsMarkedForDeletionGeneration = in .readVLong ();
5257 } else {
@@ -118,7 +123,7 @@ public TransportVersion getMinimalSupportedVersion() {
118123 @ Override
119124 public void writeTo (StreamOutput out ) throws IOException {
120125 out .writeMap (projectsSettings );
121- if (out .getTransportVersion (). onOrAfter ( TransportVersions . PROJECT_STATE_REGISTRY_RECORDS_DELETIONS )) {
126+ if (PROJECT_STATE_REGISTRY_RECORDS_DELETIONS . isCompatible ( out .getTransportVersion ())) {
122127 out .writeCollection (projectsMarkedForDeletion );
123128 out .writeVLong (projectsMarkedForDeletionGeneration );
124129 } else {
0 commit comments