Remove ABIVersion.MAGNESIUM
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / ABIVersion.java
index 84eb8f6c97f3222c91f9fab6037156c9cd42618e..119d477cc6e77df384c1807af1490094e084fb1a 100644 (file)
@@ -36,41 +36,16 @@ public enum ABIVersion implements WritableObject {
         }
     },
 
+    // BORON was 5
+    // NEON_SR2 was 6
+    // SODIUM_SR1 was 7
+    // MAGNESIUM was 8
+
     /**
-     * Initial ABI version, as shipped with Boron Simultaneous release.
-     */
-    // We seed the initial version to be the same as DataStoreVersions.BORON-VERSION for compatibility reasons.
-    BORON(5) {
-        @Override
-        public NormalizedNodeStreamVersion getStreamVersion() {
-            return NormalizedNodeStreamVersion.LITHIUM;
-        }
-    },
-    /**
-     * Revised ABI version. The messages remain the same as {@link #BORON}, but messages bearing QNames in any shape
-     * are using {@link NormalizedNodeStreamVersion#NEON_SR2}, which improves encoding.
-     */
-    NEON_SR2(6) {
-        @Override
-        public NormalizedNodeStreamVersion getStreamVersion() {
-            return NormalizedNodeStreamVersion.NEON_SR2;
-        }
-    },
-    /**
-     * Revised ABI version. The messages remain the same as {@link #BORON}, but messages bearing QNames in any shape
-     * are using {@link NormalizedNodeStreamVersion#SODIUM_SR1}, which improves encoding.
-     */
-    SODIUM_SR1(7) {
-        @Override
-        public NormalizedNodeStreamVersion getStreamVersion() {
-            return NormalizedNodeStreamVersion.SODIUM_SR1;
-        }
-    },
-    /**
-     * Revised ABI version. The messages remain the same as {@link #BORON}, but messages bearing QNames in any shape
-     * are using {@link NormalizedNodeStreamVersion#MAGNESIUM}, which improves encoding.
+     * Oldest ABI version we support. The messages remain the same as {@code MAGNESIUM}, the serialization proxies in
+     * use are flat objects without any superclasses.
      */
-    MAGNESIUM(8) {
+    CHLORINE_SR2(9) {
         @Override
         public NormalizedNodeStreamVersion getStreamVersion() {
             return NormalizedNodeStreamVersion.MAGNESIUM;
@@ -113,7 +88,7 @@ public enum ABIVersion implements WritableObject {
      * @return Current {@link ABIVersion}
      */
     public static @NonNull ABIVersion current() {
-        return MAGNESIUM;
+        return CHLORINE_SR2;
     }
 
     /**
@@ -127,15 +102,23 @@ public enum ABIVersion implements WritableObject {
      */
     public static @NonNull ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
         return switch (Short.toUnsignedInt(value)) {
-            case 0, 1, 2, 3, 4 -> throw new PastVersionException(value, BORON);
-            case 5 -> BORON;
-            case 6 -> NEON_SR2;
-            case 7 -> SODIUM_SR1;
-            case 8 -> MAGNESIUM;
-            default -> throw new FutureVersionException(value, MAGNESIUM);
+            case 0, 1, 2, 3, 4, 6, 7, 8 -> throw new PastVersionException(value, CHLORINE_SR2);
+            case 9 -> CHLORINE_SR2;
+            default -> throw new FutureVersionException(value, CHLORINE_SR2);
         };
     }
 
+    /**
+     * Return {@code true} if this version is earier than some {@code other} version.
+     *
+     * @param other Other {@link ABIVersion}
+     * @return {@code true} if {@code other is later}
+     * @throws NullPointerException if {@code other} is null
+     */
+    public boolean lt(final @NonNull ABIVersion other) {
+        return compareTo(other) < 0;
+    }
+
     @Override
     public void writeTo(final DataOutput out) throws IOException {
         out.writeShort(value);