K - type of the table keyV - type of the table recordpublic class TableRateLimiter<K,V>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TableRateLimiter.CreditFunction<K,V>
Function interface for providing rate limiting credits for each table record.
|
| Constructor and Description |
|---|
TableRateLimiter(java.lang.String tableId,
RateLimiter rateLimiter,
TableRateLimiter.CreditFunction<K,V> creditFn,
java.lang.String tag) |
| Modifier and Type | Method and Description |
|---|---|
void |
setTimerMetric(Timer timer)
Set up waitTimeMetric metric for latency reporting due to throttling.
|
void |
throttle(java.util.Collection<K> keys)
Throttle a request with a collection of keys as the argument if necessary.
|
void |
throttle(K key)
Throttle a request with a key argument if necessary.
|
void |
throttle(K key,
V value)
Throttle a request with both the key and value arguments if necessary.
|
void |
throttleRecords(java.util.Collection<Entry<K,V>> records)
Throttle a request with a collection of table records as the argument if necessary.
|
public TableRateLimiter(java.lang.String tableId,
RateLimiter rateLimiter,
TableRateLimiter.CreditFunction<K,V> creditFn,
java.lang.String tag)
tableId - table id of the table to be rate limitedrateLimiter - actual rate limiter instance to be usedcreditFn - function for deriving the credits for each requesttag - tag to be used with the rate limiterpublic void setTimerMetric(Timer timer)
timer - waitTimeMetric metricpublic void throttle(K key)
key - key used for the table requestpublic void throttle(K key, V value)
key - key used for the table requestvalue - value used for the table requestpublic void throttle(java.util.Collection<K> keys)
keys - collection of keys used for the table request