Add cds-access-api SODIUM_SR1 version 99/84699/4
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 10:18:29 +0000 (12:18 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 10:52:34 +0000 (12:52 +0200)
This adds a new ABI version, which uses SodiumSR1 normalized node
stream.

JIRA: CONTROLLER-1919
Change-Id: I457c2fcc7e10f4ba2021ce6ddb4fbc2adbfdd596
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/ABIVersion.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/Message.java

index e523cca75a1e2cdefaac8676225fd2cadbedcfa6..4d3cbc477beb33dec9e885b2ed4dffba65389ef0 100644 (file)
@@ -50,7 +50,6 @@ public enum ABIVersion implements WritableObject {
             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.
@@ -61,6 +60,16 @@ public enum ABIVersion implements WritableObject {
             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;
+        }
+    },
 
     /**
      * Version which is newer than any other version. This version exists purely for testing purposes.
@@ -98,7 +107,7 @@ public enum ABIVersion implements WritableObject {
      * @return Current {@link ABIVersion}
      */
     public static @NonNull ABIVersion current() {
-        return NEON_SR2;
+        return SODIUM_SR1;
     }
 
     /**
@@ -122,8 +131,10 @@ public enum ABIVersion implements WritableObject {
                 return BORON;
             case 6:
                 return NEON_SR2;
+            case 7:
+                return SODIUM_SR1;
             default:
-                throw new FutureVersionException(value, NEON_SR2);
+                throw new FutureVersionException(value, SODIUM_SR1);
         }
     }
 
index ed9d6c61459d130bff14f04127666413020d211c..1d198fc8a9c9f8039b9f5cc6955e3a37230f0d98 100644 (file)
@@ -113,15 +113,13 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
         switch (toVersion) {
             case BORON:
             case NEON_SR2:
+            case SODIUM_SR1:
                 return verifyNotNull(cloneAsVersion(toVersion));
             case TEST_PAST_VERSION:
             case TEST_FUTURE_VERSION:
             default:
-                // Fall-through to throw
-                break;
+                throw new IllegalArgumentException("Unhandled ABI version " + toVersion);
         }
-
-        throw new IllegalArgumentException("Unhandled ABI version " + toVersion);
     }
 
     /**