- All Known Implementing Classes:
BucketState64BitsInteger
public interface BucketState
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTokens(long tokensToAdd) longcalculateDelayNanosAfterWillBePossibleToConsume(long tokensToConsume, long currentTimeNanos, boolean checkTokensToConsumeShouldBeLessThenCapacity) longcalculateFullRefillingTime(long currentTimeNanos) voidconsume(long toConsume) copy()voidcopyStateFrom(BucketState sourceState) static BucketStatecreateInitialState(BucketConfiguration configuration, MathType mathType, long currentTimeNanos) static <S> BucketStatedeserialize(DeserializationAdapter<S> adapter, S input) voidforceAddTokens(long tokensToAdd) static BucketStatefromJsonCompatibleSnapshot(Map<String, Object> snapshot) longlonggetCurrentSize(int bandwidth) longgetRoundingError(int bandwidth) voidrefillAllBandwidth(long currentTimeNanos) replaceConfiguration(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy, long currentTimeNanos) voidreset()static <O> voidserialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion, Scope scope) voidsetConfiguration(BucketConfiguration configuration) static ObjecttoJsonCompatibleSnapshot(BucketState state, Version backwardCompatibilityVersion, Scope scope)
-
Method Details
-
copy
BucketState copy() -
getConfiguration
BucketConfiguration getConfiguration() -
setConfiguration
-
replaceConfiguration
BucketState replaceConfiguration(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy, long currentTimeNanos) -
copyStateFrom
-
getAvailableTokens
long getAvailableTokens() -
consume
void consume(long toConsume) -
calculateDelayNanosAfterWillBePossibleToConsume
long calculateDelayNanosAfterWillBePossibleToConsume(long tokensToConsume, long currentTimeNanos, boolean checkTokensToConsumeShouldBeLessThenCapacity) -
calculateFullRefillingTime
long calculateFullRefillingTime(long currentTimeNanos) -
refillAllBandwidth
void refillAllBandwidth(long currentTimeNanos) -
addTokens
void addTokens(long tokensToAdd) -
reset
void reset() -
forceAddTokens
void forceAddTokens(long tokensToAdd) -
getCurrentSize
long getCurrentSize(int bandwidth) -
getRoundingError
long getRoundingError(int bandwidth) -
getMathType
MathType getMathType() -
createInitialState
static BucketState createInitialState(BucketConfiguration configuration, MathType mathType, long currentTimeNanos) -
deserialize
- Throws:
IOException
-
serialize
static <O> void serialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion, Scope scope) throws IOException - Throws:
IOException
-
fromJsonCompatibleSnapshot
- Throws:
IOException
-
toJsonCompatibleSnapshot
static Object toJsonCompatibleSnapshot(BucketState state, Version backwardCompatibilityVersion, Scope scope) throws IOException - Throws:
IOException
-