Durable smart-engine limiter reservations backed by Postgres state.
Summary
Functions
Pure token-bucket reservation decision with zero side effects.
Functions
@spec compute_reservation( ObanPowertools.Limits.State.t(), ObanPowertools.Limits.Resource.t(), non_neg_integer(), DateTime.t() ) :: {:reserved, tokens_used_after :: non_neg_integer()} | {:blocked, code :: String.t(), retry_at :: DateTime.t() | nil, details :: map()}
Pure token-bucket reservation decision with zero side effects.
Takes a limiter state, resource config, request weight, and current time. Returns a verdict tuple without touching the database, telemetry, or history.
This is the single source of truth for the token-bucket decision logic,
callable from both reserve/3 (which adds side effects) and
mix oban_powertools.limiter.simulate (which needs zero side effects).