Expand description
Pure token-bucket consume arithmetic.
Structs§
- Available
Tokens - Tokens currently sitting in the bucket, available to grant.
- Burst
Capacity - The burst cap: the maximum the bucket may hold after a refill.
- Granted
Tokens - Tokens actually granted by a consume call (
<= requested). - NewAvailable
- The bucket’s new
availablecount after a consume call commits. - Refill
Tokens - Tokens accrued since the last refill, to be added to
availablethis call. - Requested
Tokens - Tokens the caller is asking to consume.
Functions§
- plan_
consume - Caps a refill, grants at most the request, and returns the new balance.