RateWindow

One provider rate window: published calls per period, counted in fixed windows that start at multiples of period since the Unix epoch (UTC), so they meet the provider's own wall-clock boundaries. The budget enforces limit = published − margin. A hard window refuses until its boundary with no overdraft and is persisted write-ahead when the budget has a store (it guards a provider that bills per period). Build one with the factory RateWindow(name, published, period) { margin = …; hard = … }.

Stable Core. Equality is on every property; toString() prints them.

Types

Link copied to clipboard

Collects the optional properties of a RateWindow. Not thread-safe; use it only inside the factory's lambda.

Properties

Link copied to clipboard

Whether the window refuses until its boundary and is persisted write-ahead.

Link copied to clipboard
val limit: Int

The enforced limit: published minus margin.

Link copied to clipboard
val margin: Int

Calls held back below published. In 0 until published.

Link copied to clipboard

The window's name; readings are matched to it. Not blank; distinct within a budget.

Link copied to clipboard

The window's length: positive, finite, a whole number of milliseconds.

Link copied to clipboard

The calls per period the provider documents. At least 1.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two RateWindows are equal when their name, published, period, margin and hard are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code consistent with equals: it is computed from the same properties.

Link copied to clipboard
open override fun toString(): String

A diagnostic string for logs: name, published, period, margin and hard. Its format is not part of the API and may change.