public interface LocalBucket extends Bucket
Modifier and Type | Method and Description |
---|---|
static LocalBucket |
fromBinarySnapshot(byte[] snapshot)
Reconstructs a bucket from binary snapshot.
|
static LocalBucket |
fromJsonCompatibleSnapshot(Map<String,Object> snapshot)
Reconstructs a bucket from JSON snapshot.
|
BucketConfiguration |
getConfiguration()
Returns configuration of this bucket.
|
SynchronizationStrategy |
getSynchronizationStrategy()
Returns the synchronization strategy that is used by this bucket
|
TimeMeter |
getTimeMeter()
Returns the clock that is used by this bucket
|
default byte[] |
toBinarySnapshot()
Takes the binary snapshot of this bucket that later can be used as parameter for
fromBinarySnapshot(byte[]) to restore bucket from snapshot. |
default Map<String,Object> |
toJsonCompatibleSnapshot()
Takes the JSON snapshot of this bucket that later can be used as parameter for
fromJsonCompatibleSnapshot(Map) to restore bucket from snapshot. |
addTokens, asBlocking, asScheduler, asVerbose, builder, consumeIgnoringRateLimits, estimateAbilityToConsume, forceAddTokens, getAvailableTokens, replaceConfiguration, reset, toListenable, tryConsume, tryConsumeAndReturnRemaining, tryConsumeAsMuchAsPossible, tryConsumeAsMuchAsPossible
BucketConfiguration getConfiguration()
TimeMeter getTimeMeter()
SynchronizationStrategy getSynchronizationStrategy()
default byte[] toBinarySnapshot() throws IOException
fromBinarySnapshot(byte[])
to restore bucket from snapshot.IOException
static LocalBucket fromBinarySnapshot(byte[] snapshot) throws IOException
snapshot
- binary snapshotIOException
default Map<String,Object> toJsonCompatibleSnapshot() throws IOException
fromJsonCompatibleSnapshot(Map)
to restore bucket from snapshot.IOException
static LocalBucket fromJsonCompatibleSnapshot(Map<String,Object> snapshot) throws IOException
snapshot
- the snapshot Map that was deserialized from JSON via any JSON libraryIOException
Copyright © 2022. All rights reserved.