-
- All Known Implementing Classes:
BucketState64BitsInteger,BucketStateIEEE754
public interface BucketState
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddTokens(long tokensToAdd)longcalculateDelayNanosAfterWillBePossibleToConsume(long tokensToConsume, long currentTimeNanos, boolean checkTokensToConsumeShouldBeLessThenCapacity)longcalculateFullRefillingTime(long currentTimeNanos)voidconsume(long toConsume)BucketStatecopy()voidcopyStateFrom(BucketState sourceState)static BucketStatecreateInitialState(BucketConfiguration configuration, MathType mathType, long currentTimeNanos)static <S> BucketStatedeserialize(DeserializationAdapter<S> adapter, S input, Version backwardCompatibilityVersion)voidforceAddTokens(long tokensToAdd)static BucketStatefromJsonCompatibleSnapshot(Map<String,Object> snapshot, Version backwardCompatibilityVersion)longgetAvailableTokens()BucketConfigurationgetConfiguration()longgetCurrentSize(int bandwidth)MathTypegetMathType()longgetRoundingError(int bandwidth)voidrefillAllBandwidth(long currentTimeNanos)BucketStatereplaceConfiguration(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy, long currentTimeNanos)voidreset()static <O> voidserialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion)voidsetConfiguration(BucketConfiguration configuration)static ObjecttoJsonCompatibleSnapshot(BucketState state, Version backwardCompatibilityVersion)
-
-
-
Method Detail
-
copy
BucketState copy()
-
getConfiguration
BucketConfiguration getConfiguration()
-
setConfiguration
void setConfiguration(BucketConfiguration configuration)
-
replaceConfiguration
BucketState replaceConfiguration(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy, long currentTimeNanos)
-
copyStateFrom
void copyStateFrom(BucketState sourceState)
-
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
static <S> BucketState deserialize(DeserializationAdapter<S> adapter, S input, Version backwardCompatibilityVersion) throws IOException
- Throws:
IOException
-
serialize
static <O> void serialize(SerializationAdapter<O> adapter, O output, BucketState state, Version backwardCompatibilityVersion) throws IOException
- Throws:
IOException
-
fromJsonCompatibleSnapshot
static BucketState fromJsonCompatibleSnapshot(Map<String,Object> snapshot, Version backwardCompatibilityVersion) throws IOException
- Throws:
IOException
-
toJsonCompatibleSnapshot
static Object toJsonCompatibleSnapshot(BucketState state, Version backwardCompatibilityVersion) throws IOException
- Throws:
IOException
-
-