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, tryConsumeAsMuchAsPossibleBucketConfiguration getConfiguration()
TimeMeter getTimeMeter()
SynchronizationStrategy getSynchronizationStrategy()
default byte[] toBinarySnapshot()
throws IOException
fromBinarySnapshot(byte[]) to restore bucket from snapshot.IOExceptionstatic LocalBucket fromBinarySnapshot(byte[] snapshot) throws IOException
snapshot - binary snapshotIOExceptiondefault Map<String,Object> toJsonCompatibleSnapshot() throws IOException
fromJsonCompatibleSnapshot(Map) to restore bucket from snapshot.IOExceptionstatic LocalBucket fromJsonCompatibleSnapshot(Map<String,Object> snapshot) throws IOException
snapshot - the snapshot Map that was deserialized from JSON via any JSON libraryIOExceptionCopyright © 2024. All rights reserved.