Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
class PercentageSampler(samplePercentage: Int, random: () -> Int) : Sampler
Link copied to clipboard
class RateLimiter @JvmOverloads constructor(var permitsPerSecond: Long, ticker: Ticker = Ticker.DEFAULT, sleeper: Sleeper = Sleeper.DEFAULT)

A deterministic testable rate limiter that uses two variables:

Link copied to clipboard
Link copied to clipboard
interface Sampler

A Sampler is used to "sample" whether an action is allowed to occur or not.

Link copied to clipboard
interface Sleeper

Abstraction for Thread.sleep() that allows for testing.

Link copied to clipboard
interface Ticker

Abstraction for System.nanoTime() that allows for testing.