merlimat commented on a change in pull request #10391:
URL: https://github.com/apache/pulsar/pull/10391#discussion_r623332055
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataCache.java
##########
@@ -118,6 +118,19 @@
*/
CompletableFuture<Void> create(String path, T value);
+ /**
+ * Create or update an object in the metadata store.
+ * <p>
+ * This operation will make sure to keep the cache consistent.
+ *
+ * @param path
+ * the path of the object in the metadata store
+ * @param value
+ * the object to insert in metadata store
+ * @return a future to track the completion of the operation
+ */
+ CompletableFuture<Void> updateOrCreate(String path, T value);
Review comment:
Good point. the usage here is slightly different in that we're not
caring for the existing value, but we can avoid adding a new method just for
that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]