Skip to main content

Module rate

Module rate 

Source
Expand description

Per-op rate limiter. Independent of the activity-level rate limiter and of every other op’s per-op limiter — each OpRateWrapper instance owns its own RateLimiter and acquires from it on every dispatch.

Typical use: pacing a while: loop on a daemon op so the loop iterates at a controlled rate without coupling to the activity’s ops-per-second ceiling or to sibling daemons’ loops. See SRD-79 (forthcoming) for the design rationale.

Composition: sits inner of while: so the rate limiter acquire happens once per loop iteration. Sits outer of result/metrics/traverse so the inner adapter call lands inside the rate budget.

Spec format (parsed in parse_rate_spec):

  • "<N>/s" — N ops per second
  • "<N>/m" — N ops per minute (= N/60 per second)
  • "<N>/h" — N ops per hour (= N/3600 per second)
  • "<N>" — bare numeric, interpreted as ops per second

The numeric portion may be integer or floating-point; any valid Rust f64 literal works.

Structs§

OpRateWrapper
Wraps an inner OpDispenser with an independent per-op rate limiter.

Constants§

NAME
Wrapper name.

Functions§

parse_rate_spec
Parse a rate: spec string into an ops-per-second f64. See module docs for the accepted formats.