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,
Version backwardCompatibilityVersion) |
void |
forceAddTokens(long tokensToAdd) |
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) |
static <O> void |
serialize(SerializationAdapter<O> adapter,
O output,
BucketState state,
Version backwardCompatibilityVersion) |
void |
setConfiguration(BucketConfiguration configuration) |
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 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, Version backwardCompatibilityVersion) throws IOException
IOException
static <O> void serialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion) throws IOException
IOException
Copyright © 2022. All rights reserved.