Versions in this module Expand all Collapse all v0 v0.1.1 Jul 23, 2026 v0.1.0 May 20, 2026 Changes in this version + var ErrClientRejection = errors.New("rejected without sending: backend is unhealthy") + var ErrRejected = errors.New("rejected") + func AcceptedError(err error) error + func WithAdaptiveThrottle[T any](at *AdaptiveThrottle, p Priority, f func() (T, error)) (T, error) + type AdaptiveThrottle struct + func NewAdaptiveThrottle(priorities int, options ...AdaptiveThrottleOption) *AdaptiveThrottle + func (at *AdaptiveThrottle) Accepted(p Priority) + func (at *AdaptiveThrottle) Attempt(p Priority) bool + func (at *AdaptiveThrottle) Rejected(p Priority) + type AdaptiveThrottleOption struct + func AdaptiveThrottleMinimumRate(x float64) AdaptiveThrottleOption + func AdaptiveThrottleRatio(k float64) AdaptiveThrottleOption + func AdaptiveThrottleWindow(d time.Duration) AdaptiveThrottleOption + type Priority int + type RateLimiter struct + func NewRateLimiter(priorities int, rate float64, burst float64, options ...RateLimiterOption) *RateLimiter + func (rl *RateLimiter) Close() + func (rl *RateLimiter) SetRate(rate float64, burst float64) + func (rl *RateLimiter) Wait(ctx context.Context, p Priority, tokens float64) error + type RateLimiterOption struct + func RateLimiterDebtDecayInterval(d time.Duration) RateLimiterOption + func RateLimiterDebtForgivePerSuccess(x float64) RateLimiterOption + func RateLimiterLongTimeout(d time.Duration) RateLimiterOption + func RateLimiterShortTimeout(d time.Duration) RateLimiterOption + type Semaphore struct + func NewSemaphore(priorities int, capacity int, options ...SemaphoreOption) *Semaphore + func (s *Semaphore) Acquire(ctx context.Context, p Priority, tokens int) error + func (s *Semaphore) Close() + func (s *Semaphore) Release(tokens int) + func (s *Semaphore) SetCapacity(capacity int) + type SemaphoreOption struct + func SemaphoreDebtDecayInterval(x time.Duration) SemaphoreOption + func SemaphoreDebtForgivePerSuccess(x float64) SemaphoreOption + func SemaphoreLongTimeout(d time.Duration) SemaphoreOption + func SemaphoreShortTimeout(d time.Duration) SemaphoreOption