Package-level declarations

Types

Link copied to clipboard
typealias DelayFunction = (index: Int) -> Duration
Link copied to clipboard
interface DelayStrategy

Represents a strategy for computing delay times based on an index.

Properties

Link copied to clipboard

A property extension that converts the Duration to a DelayStrategy with a constant delay.

Link copied to clipboard

A property extension that converts a DelayFunction to a DelayStrategy.

Link copied to clipboard

A property extension that converts the Duration to a Fibonacci-based DelayStrategy.

Link copied to clipboard

A DelayStrategy that always yields zero delay.

Link copied to clipboard

A property extension that converts a list of Durations to a sequential DelayStrategy.

Functions

Link copied to clipboard
fun constantDelay(delayMillis: Long): DelayStrategy

Creates a DelayStrategy that always returns the same delay duration.

Creates a DelayStrategy that always returns the same delay duration.

Link copied to clipboard

Creates a DelayStrategy using a custom delay function.

Link copied to clipboard

An infix function to create a fibonacci backoff DelayStrategy.

Link copied to clipboard

An infix function to create a linear backoff DelayStrategy.

Link copied to clipboard

An infix function to create an exponential backoff DelayStrategy.

Link copied to clipboard

Creates a DelayStrategy with exponentially increasing delay durations.

Link copied to clipboard
fun fibonacciBackoffDelay(baseDelay: Duration, start: Pair<Int, Int> = 0 to 1): DelayStrategy

Creates a DelayStrategy with delays that increase by the Fibonacci sequence multiplied by the baseDelay.

Link copied to clipboard
fun linearBackoffDelay(initialDelay: Duration, increment: Duration): DelayStrategy

Creates a DelayStrategy with a linearly increasing delay duration based on the given initial delay and increment.

Link copied to clipboard
fun maxOf(first: DelayStrategy, vararg others: DelayStrategy): DelayStrategy

Returns a DelayStrategy that yields the largest delay duration for each index when compared among the provided strategies.

Link copied to clipboard
fun minOf(first: DelayStrategy, vararg others: DelayStrategy): DelayStrategy

Returns a DelayStrategy that yields the smallest delay duration for each index when compared among the provided strategies.

Link copied to clipboard
fun sequentialDelay(vararg delayMillis: Long): DelayStrategy

Creates a DelayStrategy that returns a list of delays in sequence, defined in milliseconds. Once the list is exhausted, it will keep returning the last delay.

Creates a DelayStrategy that returns a list of delays in sequence. Once the list is exhausted, it will keep returning the last delay.

Link copied to clipboard
operator fun Double.times(delayStrategy: DelayStrategy): DelayStrategy

Multiplies a Double with the delay durations of a DelayStrategy.

operator fun Int.times(delayStrategy: DelayStrategy): DelayStrategy

Multiplies an Int with the delay durations of a DelayStrategy.