Builder
Collects the properties of a WindowedCallBudget. Not thread-safe; use it only inside the factory's lambda. Stable Core.
Properties
A grant within this of a boundary is charged to both adjacent windows. 1 s by default; not negative; at most a quarter of the shortest period; truncated to whole milliseconds.
Each lane's share of every window as a held-back floor (never lent), ceil to units, at least 1 per positive share. Each in (0, 1]; the reserved units must fit every window. Interactive 0.2 by default — set emptyMap() for a window of limit 1.
A snapshot stamped further ahead than this has its stamp and pause ignored (its counts are kept). 5 minutes by default; not negative.
Receives every event. BudgetObserver.None by default.
A hard window is saved write-ahead in blocks of this many grants. 10 by default; at least 1 (1 saves every grant). While saves succeed, a crash never under-counts the grants made and over-counts by at most persistAhead - 1 plus any units written ahead and then given back; while the store is failing, grants run unsaved and a crash loses them (the budget's class KDoc states the exceptions).
Where hard windows and the pause survive a restart. An InMemoryBudgetStore by default (survives nothing).
After a failed restore or a failed write-ahead save, the next attempt waits this long. 30 s by default; not negative.
Bounds each store call. 2 s by default; positive. A blocking store cannot be interrupted: see BudgetStore.
The clock of every wait and duration; one mark is taken at construction. TimeSource.Monotonic by default.
The clock that decides window indices and boundaries. WallClock.System by default; its reading may step.