- /**
- * Serialize this snapshot into a byte array for persistence.
- *
- * @return Serialized snapshot
- * @throws IOException when a serialization problem occurs
- */
- public abstract @Nonnull byte[] serialize() throws IOException;
-
- private static boolean isLegacyStream(final byte[] bytes) {
- if (bytes.length < 2) {
- // Versioned streams have at least two bytes
- return true;
- }
-
- /*
- * The stream could potentially be a versioned stream. Here we rely on the signature marker available
- * in org.opendaylight.controller.cluster.datastore.node.utils.stream.TokenTypes.
- *
- * For an old stream to be this long, the first byte has to be non-zero and the second byte has to be 0xAB.
- *
- * For a versioned stream, that translates to at least version 427 -- giving us at least 421 further versions
- * before this check breaks.
- */
- return bytes[0] != 0 && bytes[1] == (byte)0xAB;
- }
-
- @Deprecated
- private static ShardDataTreeSnapshot deserializeLegacy(final byte[] bytes) {
- return new PreBoronShardDataTreeSnapshot(SerializationUtils.deserializeNormalizedNode(bytes));
- }