Adding version stamping/checking to SimpleIntentStore
Change-Id: I08c0bf5e0f5a89275a72fa0900e52ca996942b79
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
index 3eea0d5..0abfd12 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
@@ -56,10 +56,28 @@
return intent.key();
}
+ public Timestamp version() {
+ return version;
+ }
+
public void setState(IntentState newState) {
this.state = newState;
}
+ /**
+ * Sets the version for this intent data.
+ * <p>
+ * The store should call this method only once when the IntentData is
+ * first passed into the pending map. Ideally, an IntentData is timestamped
+ * on the same thread that the called used to submit the intents.
+ * </p>
+ *
+ * @param version the version/timestamp for this intent data
+ */
+ public void setVersion(Timestamp version) {
+ this.version = version;
+ }
+
public void setInstallables(List<Intent> installables) {
this.installables = ImmutableList.copyOf(installables);
}