Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LimitManager ¶
type LimitManager struct {
// contains filtered or unexported fields
}
LimitManager tracks the configured limiters and redistributes capacity when individual limiters go in or out of active use.
func NewLimitManager ¶
func NewLimitManager(rate int64) *LimitManager
NewLimitManager constructs a LimitManager with the specified aggregate rate budget.
func (*LimitManager) NewLimiter ¶
func (m *LimitManager) NewLimiter(key string, r, burst int64) (*Limiter, error)
NewLimiter registers a limiter with the manager and returns it for use. The limiter is configured with the provided sustained rate and burst size.
func (*LimitManager) UpdateInUse ¶
func (m *LimitManager) UpdateInUse(l *Limiter, use bool)
UpdateInUse marks a limiter as being actively used and reapportions the available rate across the currently active limiters.
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter wraps a token bucket rate limiter and reports usage back to the LimitManager so the shared capacity can be rebalanced.
Click to show internal directories.
Click to hide internal directories.