Concepts

Decisions

Trypema returns decisions that tell you whether to proceed, reject, or shed load.

Admission calls (inc and absolute is_allowed) return RateLimitDecision. Provider changes where state lives, but decision model stays same.

A comparison gate branches into a replacement history stack and an ordered history-preservation path.
Conditional writes change state only after a comparator matches, then replace history or preserve one side of it.

Allowed

Allowed means the request should proceed.

You will see this:

  • below the limit in absolute mode
  • below the limit in suppressed mode
  • sometimes above the nominal limit in suppressed mode when the probabilistic check still admits the request

Rejected

Rejected is used by the absolute strategy.

It means the limiter hit a hard boundary and the request should not proceed. The decision can also include best-effort hints such as:

  • window_size: WindowSize: configured duration of sliding window.
  • retry_after: Duration: standard-library duration until oldest live bucket expires.
  • remaining_after_waiting: u64: capacity released when that bucket expires.

retry_after is time until oldest live bucket expires. remaining_after_waiting is capacity that bucket releases, not usage remaining afterward. These are operational hints, not exact future admission promises.

For example, if oldest bucket contains 3 and next bucket contains 7, remaining_after_waiting is 3. See Configuration Types for WindowSize and other validated settings.

Suppressed

Suppressed is used by the suppressed strategy. It carries:

  • is_allowed
  • suppression_factor

The important rule is simple: always check is_allowed.

If is_allowed is true, the request may proceed. If it is false, the request should be dropped or degraded.

When each decision shape appears

StrategyDecision shapes
AbsoluteAllowed, Rejected
SuppressedAllowed, Suppressed { is_allowed, suppression_factor }

RateLimitDecision variants are exhaustive. Fields inside Rejected and Suppressed are non-exhaustive, so match them with { .. }.

What this means for application code

  • Absolute mode is easiest when your app wants a hard yes/no answer.
  • Suppressed mode is better when your app wants controlled load shedding instead of a cliff-edge cutoff.