Package com.linkedin.venice.throttle
Interface VeniceRateLimiter
- All Known Implementing Classes:
EventThrottler,GuavaRateLimiter,TokenBucket,VeniceAdaptiveIngestionThrottler
public interface VeniceRateLimiter
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidacquirePermit(int units) Acquire a permit, blocking until one is available.longgetQuota()voidsetQuota(long quota) The following methods are used only when checking if the new quota requests are different from the existing quota.booleantryAcquirePermit(int units) Try to acquire permit for the given rcu.
-
Method Details
-
tryAcquirePermit
boolean tryAcquirePermit(int units) Try to acquire permit for the given rcu. Will not block if permit is not available.- Parameters:
units- Number of units to acquire.- Returns:
- true if permit is acquired, false otherwise.
-
acquirePermit
default void acquirePermit(int units) Acquire a permit, blocking until one is available. Default implementation pollstryAcquirePermit(int)with a 10ms sleep. Implementations with native blocking (e.g. Guava RateLimiter) should override for precision. -
setQuota
void setQuota(long quota) The following methods are used only when checking if the new quota requests are different from the existing quota. -
getQuota
long getQuota()
-