diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/-suspending-bucket-configuration.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/-suspending-bucket-configuration.html index 8be77ac..25766db 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/-suspending-bucket-configuration.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/-suspending-bucket-configuration.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

SuspendingBucket
constructor(timeMeter: TimeMeter = TimeMeter.SYSTEM_MILLISECONDS, mutableLimits: MutableList<Bandwidth> = mutableListOf())(source)

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/add-limit.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/add-limit.html index d3587b9..787a96f 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/add-limit.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/add-limit.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

addLimit

fun addLimit(bandwidth: Bandwidth)(source)

Adds a bandwidth limit to the bucket. See the Bucket4j documentation on Bandwidths for more information.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/index.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/index.html index 254f806..57efc89 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/index.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -124,7 +124,7 @@

Properties

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/time-meter.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/time-meter.html index c4542bf..b50e962 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/time-meter.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-configuration/time-meter.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

timeMeter
var timeMeter: TimeMeter(source)

Set's the TimeMeter to be used by the underlying Bucket4j objects. By default, you may choose either TimeMeter.SYSTEM_MILLISECONDS or TimeMeter.SYSTEM_NANOSECONDS. Caution: see Bucket4j's documentation about using nanoseconds before choosing that option.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/-suspending-bucket-test.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/-suspending-bucket-test.html index 54c3396..7cf6934 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/-suspending-bucket-test.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/-suspending-bucket-test.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

SuspendingBucket
constructor()(source)

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/index.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/index.html index 66d6739..520d313 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/index.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket-test/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -86,7 +86,7 @@

Constructors

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/build.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/build.html index 09c88d2..9c48412 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/build.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/build.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

build

A type-safe builder for constructing SuspendingBucket objects.

Return

A SuspendingBucket, constructed with the specified configuration.

Parameters

configure

A function literal with receiver, used for specifying SuspendingBucket configuration.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/index.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/index.html index 7e3987b..d60b73f 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/index.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/-companion/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -86,7 +86,7 @@

Functions

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/add-tokens.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/add-tokens.html index 0746211..db3b82e 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/add-tokens.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/add-tokens.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

addTokens
fun addTokens(tokensToAdd: Long)(source)

Adds the specified number of tokensToAdd to the bucket, not exceeding the capacity of the bucket. Delegates directly to the underlying LockFreeBucket's addTokens implementation.

Parameters

tokensToAdd

The number of tokens to add to the bucket.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/available-tokens.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/available-tokens.html index 3e8c0e0..9a2a3c4 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/available-tokens.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/available-tokens.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

availableTokens

Returns the number of currently available tokens. Delegates directly to the underlying LockFreeBucket's getAvailableTokens implementation.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/configuration.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/configuration.html index f303c29..a0b693f 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/configuration.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/configuration.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

configuration

val configuration: BucketConfiguration(source)

Returns the Bucket4j BucketConfiguration of the underlying LockFreeBucket. Delegates directly to the underlying LockFreeBucket's getConfiguration implementation.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/consume.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/consume.html index 94928cf..edc7e39 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/consume.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/consume.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

consume

suspend fun consume(tokensToConsume: Long)(source)

Consumes the specified number of tokensToConsume, suspending as long as necessary to accumulate the requisite number of tokens. This algorithm is a direct copy of Bucket4j BlockingBucket's consume, except it suspends the calling coroutine's execution while waiting for available tokens, rather than blocking the thread. See the Bucket4j consume documentation for more details.

Parameters

tokensToConsume

The number of tokens to try and consume from the bucket. Must be a positive value.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/force-add-tokens.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/force-add-tokens.html index 508b23f..6502cbc 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/force-add-tokens.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/force-add-tokens.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

forceAdd
fun forceAddTokens(tokensToAdd: Long)(source)

Adds the specified number of tokensToAdd to the bucket, even if it would result in the bucket containing more than its specified capacity. Delegates directly to the underlying LockFreeBucket's forceAddTokens implementation.

Parameters

tokensToAdd

The number of tokens to add to the bucket.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/index.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/index.html index ace6721..ab61e87 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/index.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -229,7 +229,7 @@

Properties

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/replace-configuration.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/replace-configuration.html index 5d6380f..aa59cc6 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/replace-configuration.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/replace-configuration.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

replaceConfiguration
fun replaceConfiguration(newConfiguration: BucketConfiguration, tokensInheritanceStrategy: TokensInheritanceStrategy)(source)

Replaces the bucket's configuration. This delegates directly to the underlying LockFreeBucket's replaceConfiguration implementation.

The inheritance strategy is complex enough that I'm not going to summarize the algorithm here, see Bucket4j's documentation for more information.

Parameters

newConfiguration

The new BucketConfiguration to use.

tokensInheritanceStrategy

Configuration for the strategy to use for token inheritance.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/reset.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/reset.html index d1f4a16..b8421b8 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/reset.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/reset.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

reset

fun reset()(source)

Resets all tokens to max capacity. Delegates directly to the underlying LockFreeBucket's reset implementation.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/to-string.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/to-string.html index 46b81c6..56094a6 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/to-string.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/to-string.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

toString

open override fun toString(): String(source)

Delegates directly to the underlying LockFreeBucket's toString implementation.

diff --git a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/try-consume.html b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/try-consume.html index 4171355..ede62c4 100644 --- a/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/try-consume.html +++ b/bucket4k/com.sletmoe.bucket4k/-suspending-bucket/try-consume.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -62,7 +62,7 @@

tryConsume
fun tryConsume(tokensToConsume: Long): Boolean(source)

Tries to consume the specified number of tokensToConsume. Delegates directly to the underlying LockFreeBucket's tryConsume implementation.

Return

true if the tokens were consumed, false otherwise.

Parameters

tokensToConsume

The number of tokens to try and consume from the bucket. Must be a positive value.


suspend fun tryConsume(tokensToConsume: Long, maxWaitTime: Duration): Boolean(source)

Tries to consume the specified number of tokensToConsume, suspending up to maxWaitTime if necessary in order to accumulate enough tokens to consume the specified amount.

The (slightly simplified) logic is as follows:

  • if tokensToConsume tokens are available, consume them and return true immediately

  • else if enough tokens will be made available to satisfy tokensToConsume within maxWaitTime, the function will delay until the requisite number of tokens are available, consume them, and return true.

  • else, will immediately return false.

It should also be noted that this function is fair: If invoked twice without enough tokens for the first request to succeed, the first request will be serviced before subsequent requests.

This algorithm is a direct copy of Bucket4j BlockingBucket's tryConsume, except it suspends the calling coroutine's execution while waiting for available tokens, rather than blocking the thread. See the Bucket4j tryConsume documentation for more details.

Return

true if the tokens were consumed, false otherwise.

Parameters

tokensToConsume

The number of tokens to try and consume from the bucket. Must be a positive value.

maxWaitTime

The maximum amount of time to wait for the bucket to refill enough tokens such that the requested tokensToConsume can be consumed.

diff --git a/bucket4k/com.sletmoe.bucket4k/index.html b/bucket4k/com.sletmoe.bucket4k/index.html index 05a6f72..d502196 100644 --- a/bucket4k/com.sletmoe.bucket4k/index.html +++ b/bucket4k/com.sletmoe.bucket4k/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -115,7 +115,7 @@

Types

diff --git a/index.html b/index.html index 7dc4754..d1b04ed 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,7 @@
-1.0.0.40-SNAPSHOT
+1.0.0.41-SNAPSHOT
@@ -81,7 +81,7 @@

Packages