lvyanquan commented on code in PR #27134:
URL: https://github.com/apache/flink/pull/27134#discussion_r2473357903


##########
flink-core/src/main/java/org/apache/flink/api/connector/source/util/ratelimit/RateLimiter.java:
##########
@@ -27,14 +27,25 @@
 /** The interface to rate limit execution of methods. */
 @NotThreadSafe
 @Experimental
-public interface RateLimiter {
+public interface RateLimiter<S> {
 
     /**
      * Returns a future that is completed once another event would not exceed 
the rate limit. For
      * correct functioning, the next invocation of this method should only 
happen after the
      * previously returned future has been completed.
      */
-    CompletionStage<Void> acquire();
+    default CompletionStage<Void> acquire() {
+        return acquire(1);
+    }
+
+    /**
+     * Returns a future that is completed once another event would not exceed 
the rate limit. For
+     * correct functioning, the next invocation of this method should only 
happen after the
+     * previously returned future has been completed.
+     *
+     * @param requestSize The size of requests.
+     */
+    CompletionStage<Void> acquire(int requestSize);

Review Comment:
   This method is the core method of the interface. Other methods, such as 
`notifyCheckpointComplete` and `notifyStatusChange`, are typically not required 
to be implemented in most scenarios.
   
   A no-op implementation is not particularly critical because we either do not 
use the interface at all or require a non-empty implementation solely to enable 
rate-limiting capabilities.



-- 
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]

Reply via email to