DocumentTreeNode: add support for a version
Change-Id: Ib07503beda17b904ce6b6f52d7bf9d3622085a24
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java b/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
index 46a334b..ea7b014 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
@@ -72,6 +72,28 @@
boolean createNode(DocumentPath path, V value);
/**
+ * Conditionally updates a tree node if the current version matches a specified version.
+ *
+ * @param path path for the node to create
+ * @param newValue the non-null value to be associated with the key
+ * @param version current version of the value for update to occur
+ * @return returns {@code true} if the update was made, {@code false} otherwise
+ * @throws NoSuchDocumentPathException if the parent node (for the node to create) does not exist
+ */
+ boolean replace(DocumentPath path, V newValue, long version);
+
+ /**
+ * Conditionally updates a tree node if the current value matches a specified value.
+ *
+ * @param path path for the node to create
+ * @param newValue the non-null value to be associated with the key
+ * @param currentValue current value for update to occur
+ * @return returns {@code true} if the update was made, {@code false} otherwise
+ * @throws NoSuchDocumentPathException if the parent node (for the node to create) does not exist
+ */
+ boolean replace(DocumentPath path, V newValue, V currentValue);
+
+ /**
* Removes the node with the specified path.
*
* is not a leaf node i.e has one or more children