Define PayloadVersion.MAGNESIUM 05/84705/10
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 10:45:18 +0000 (12:45 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 15:40:19 +0000 (17:40 +0200)
This adds the PayloadVersion which uses Magnesium normalized node
stream.

JIRA: CONTROLLER-1919
Change-Id: Ie43e9932a19bd19c92f14890da13646bf56e2f6f
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 96ab0ca..9e6402c 100644 (file)
@@ -34,6 +34,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
                 return new ShardSnapshotState(readSnapshot(in), true);
             case NEON_SR2:
             case SODIUM_SR1:
+            case MAGNESIUM:
                 return new ShardSnapshotState(readSnapshot(in), false);
             case TEST_FUTURE_VERSION:
             case TEST_PAST_VERSION:
@@ -78,7 +79,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
             case BORON:
             case NEON_SR2:
             case SODIUM_SR1:
-                // Boron, NeonSR2 and Sodium snapshots use Java Serialization, but differ in stream format
+            case MAGNESIUM:
+                // Boron, NeonSR2, Sodium and Magnesium snapshots use Java Serialization, but differ in stream format
                 out.writeObject(this);
                 return;
             case TEST_FUTURE_VERSION:
index 272cc7e..921c9fc 100644 (file)
@@ -82,6 +82,17 @@ public enum PayloadVersion implements WritableObject {
         }
     },
 
+    /**
+     * Revised payload version. Payloads remain the same as {@link #SODIUM_SR1}, but messages bearing QNames in any
+     * shape are using {@link NormalizedNodeStreamVersion#MAGNESIUM}, which improves encoding.
+     */
+    MAGNESIUM(8) {
+        @Override
+        public NormalizedNodeStreamVersion getStreamVersion() {
+            return NormalizedNodeStreamVersion.MAGNESIUM;
+        }
+    },
+
     /**
      * Version which is newer than any other version. This version exists purely for testing purposes.
      */
@@ -150,8 +161,10 @@ public enum PayloadVersion implements WritableObject {
                 return NEON_SR2;
             case 7:
                 return SODIUM_SR1;
+            case 8:
+                return MAGNESIUM;
             default:
-                throw new FutureVersionException(version, SODIUM_SR1);
+                throw new FutureVersionException(version, MAGNESIUM);
         }
     }
 

©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.