Define PayloadVersion.SODIUM_SR1 02/84702/9
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 10:33:15 +0000 (12:33 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 25 Sep 2019 15:14:51 +0000 (15:14 +0000)
This adds the PayloadVersion which uses Sodium SR1 normalized node
stream.

JIRA: CONTROLLER-1919
Change-Id: I3dfa6ea053ea356bb68b458f3d6787904b2904c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/PayloadVersion.java

index 9e8c5f0..96ab0ca 100644 (file)
@@ -33,6 +33,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
             case BORON:
                 return new ShardSnapshotState(readSnapshot(in), true);
             case NEON_SR2:
+            case SODIUM_SR1:
                 return new ShardSnapshotState(readSnapshot(in), false);
             case TEST_FUTURE_VERSION:
             case TEST_PAST_VERSION:
@@ -76,7 +77,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
         switch (version) {
             case BORON:
             case NEON_SR2:
-                // Boron and Sodium snapshots use Java Serialization, but differ in stream format
+            case SODIUM_SR1:
+                // Boron, NeonSR2 and Sodium snapshots use Java Serialization, but differ in stream format
                 out.writeObject(this);
                 return;
             case TEST_FUTURE_VERSION:
index 819ede7..272cc7e 100644 (file)
@@ -71,6 +71,17 @@ public enum PayloadVersion implements WritableObject {
         }
     },
 
+    /**
+     * Revised payload version. Payloads remain the same as {@link #NEON_SR2}, 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.
      */
@@ -137,8 +148,10 @@ public enum PayloadVersion implements WritableObject {
                 return BORON;
             case 6:
                 return NEON_SR2;
+            case 7:
+                return SODIUM_SR1;
             default:
-                throw new FutureVersionException(version, NEON_SR2);
+                throw new FutureVersionException(version, SODIUM_SR1);
         }
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.