merlimat commented on code in PR #16491:
URL: https://github.com/apache/pulsar/pull/16491#discussion_r917273451
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/coordination/CoordinationService.java:
##########
@@ -56,4 +56,21 @@ <T> LeaderElection<T> getLeaderElection(Class<T> clazz,
String path,
* if there's a failure in incrementing the counter
*/
CompletableFuture<Long> getNextCounterValue(String path);
+
+ /**
+ * Increment a counter identified by the specified path and return the
current value.
+ * The counter value will be guaranteed to be unique within the context of
the path.
+ * It will retry when {@link
org.apache.pulsar.metadata.api.MetadataStoreException} happened.
+ *
+ * If the maximum number of retries is reached and still failed,
+ * the feature will complete with exception {@link
org.apache.pulsar.metadata.api.MetadataStoreException}.
+ *
+ * @param path
+ * The path that identifies a particular counter
+ * @param count
+ * The retry count.
+ * @return
+ * A future that will track the completion of the operation
+ */
+ CompletableFuture<Long> getNextCounterValueWithRetry(String path, int
count);
Review Comment:
I wouldn't add a new method in the API, rather just doing that internally in
the existing API method.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]