ONOS-2133: Support for purging associated stores (ConsistentMap/DistributedSet) when the application is uninstalled
Change-Id: I5bf7678f50ff3ed2792313383ff738c356bef69f
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
index 50d829c..eb2583b 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentMapBuilder.java
@@ -1,5 +1,6 @@
package org.onosproject.store.service;
+import org.onosproject.core.ApplicationId;
/**
* Builder for consistent maps.
@@ -24,6 +25,18 @@
ConsistentMapBuilder<K, V> withName(String name);
/**
+ * Sets the owner applicationId for the map.
+ * <p>
+ * Note: If {@code purgeOnUninstall} option is enabled, applicationId
+ * must be specified.
+ * </p>
+ *
+ * @param id applicationId owning the consistent map
+ * @return this ConsistentMapBuilder
+ */
+ ConsistentMapBuilder<K, V> withApplicationId(ApplicationId id);
+
+ /**
* Sets a serializer that can be used to serialize
* both the keys and values inserted into the map. The serializer
* builder should be pre-populated with any classes that will be
@@ -65,6 +78,18 @@
ConsistentMapBuilder<K, V> withUpdatesDisabled();
/**
+ * Purges map contents when the application owning the map is uninstalled.
+ * <p>
+ * When this option is enabled, the caller must provide a applicationId via
+ * the {@code withAppliationId} builder method.
+ * <p>
+ * By default map entries will NOT be purged when owning application is uninstalled.
+ *
+ * @return this ConsistentMapBuilder
+ */
+ ConsistentMapBuilder<K, V> withPurgeOnUninstall();
+
+ /**
* Builds an consistent map based on the configuration options
* supplied to this builder.
*