public interface BucketState
| Modifier and Type | Method and Description |
|---|---|
void |
addTokens(long tokensToAdd) |
long |
calculateDelayNanosAfterWillBePossibleToConsume(long tokensToConsume,
long currentTimeNanos,
boolean checkTokensToConsumeShouldBeLessThenCapacity) |
long |
calculateFullRefillingTime(long currentTimeNanos) |
void |
consume(long toConsume) |
BucketState |
copy() |
void |
copyStateFrom(BucketState sourceState) |
static BucketState |
createInitialState(BucketConfiguration configuration,
MathType mathType,
long currentTimeNanos) |
static <S> BucketState |
deserialize(DeserializationAdapter<S> adapter,
S input) |
void |
forceAddTokens(long tokensToAdd) |
static BucketState |
fromJsonCompatibleSnapshot(Map<String,Object> snapshot) |
long |
getAvailableTokens() |
BucketConfiguration |
getConfiguration() |
long |
getCurrentSize(int bandwidth) |
MathType |
getMathType() |
long |
getRoundingError(int bandwidth) |
void |
refillAllBandwidth(long currentTimeNanos) |
BucketState |
replaceConfiguration(BucketConfiguration newConfiguration,
TokensInheritanceStrategy tokensInheritanceStrategy,
long currentTimeNanos) |
void |
reset() |
static <O> void |
serialize(SerializationAdapter<O> adapter,
O output,
BucketState state,
Version backwardCompatibilityVersion,
Scope scope) |
void |
setConfiguration(BucketConfiguration configuration) |
static Object |
toJsonCompatibleSnapshot(BucketState state,
Version backwardCompatibilityVersion,
Scope scope) |
BucketState copy()
BucketConfiguration getConfiguration()
void setConfiguration(BucketConfiguration configuration)
BucketState replaceConfiguration(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy, long currentTimeNanos)
void copyStateFrom(BucketState sourceState)
long getAvailableTokens()
void consume(long toConsume)
long calculateDelayNanosAfterWillBePossibleToConsume(long tokensToConsume,
long currentTimeNanos,
boolean checkTokensToConsumeShouldBeLessThenCapacity)
long calculateFullRefillingTime(long currentTimeNanos)
void refillAllBandwidth(long currentTimeNanos)
void addTokens(long tokensToAdd)
void reset()
void forceAddTokens(long tokensToAdd)
long getCurrentSize(int bandwidth)
long getRoundingError(int bandwidth)
MathType getMathType()
static BucketState createInitialState(BucketConfiguration configuration, MathType mathType, long currentTimeNanos)
static <S> BucketState deserialize(DeserializationAdapter<S> adapter, S input) throws IOException
IOExceptionstatic <O> void serialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion, Scope scope) throws IOException
IOExceptionstatic BucketState fromJsonCompatibleSnapshot(Map<String,Object> snapshot) throws IOException
IOExceptionstatic Object toJsonCompatibleSnapshot(BucketState state, Version backwardCompatibilityVersion, Scope scope) throws IOException
IOExceptionCopyright © 2022. All rights reserved.