Fix multiple snapshots present after journal removal
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / NormalizedNodeDataInput.java
index 7d793b1f3c14602dfe368b5232346baa122ac876..37152f32e9c0c723251e78ea3b29f0a1f078f20c 100644 (file)
@@ -10,6 +10,9 @@ package org.opendaylight.controller.cluster.datastore.node.utils.stream;
 import com.google.common.annotations.Beta;
 import java.io.DataInput;
 import java.io.IOException;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -32,7 +35,21 @@ public interface NormalizedNodeDataInput extends DataInput {
 
     YangInstanceIdentifier readYangInstanceIdentifier() throws IOException;
 
+    @NonNull QName readQName() throws IOException;
+
     PathArgument readPathArgument() throws IOException;
 
     SchemaPath readSchemaPath() throws IOException;
+
+    /**
+     * Return the version of the underlying input stream.
+     *
+     * @return Stream version
+     * @throws IOException if the version cannot be ascertained
+     */
+    NormalizedNodeStreamVersion getVersion() throws IOException;
+
+    default Optional<NormalizedNode<?, ?>> readOptionalNormalizedNode() throws IOException {
+        return readBoolean() ? Optional.of(readNormalizedNode()) : Optional.empty();
+    }
 }