RateLimiter
A client-side utility that can limit the rate of transactions. This limiter is usually backed by some set of permits which refill over time. This kind of rate limiting is often used in conjunction with a retry algorithm, especially when it may be desirable to delay the initial attempt of a transaction (instead of just delaying subsequent attempts).
Callers should invoke acquire with the cost of their transaction prior to executing. If there are not enough permits available currently, the call may delay.
Once the transaction is completed, callers should invoke update and indicate the type of error (if any) the transaction yielded. The rate limiter may use this information to adjust the number of available permits or the rate of permit renewal.