Documentation ¶
Overview ¶
Package rate provides rate limiting which supports a hierarchy of limiters, each capped by their parent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter interface { // New returns a new limiter that is subordinate to this limiter, meaning that its cap rate is also capped by its // parent. New(capacity int) Limiter // Cap returns the capacity per time period. Cap(applyParentCaps bool) int // SetCap sets the capacity. SetCap(capacity int) // LastUsed returns the capacity used in the last time period. LastUsed() int // Use returns a channel that will return nil when the request is successful, or an error if the request cannot be // fulfilled. Use(amount int) <-chan error // Closed returns true if the limiter is closed. Closed() bool // Close this limiter and any children it may have. Close() }
Limiter provides a rate limiter.
Click to show internal directories.
Click to hide internal directories.