Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveOption ¶
type AdaptiveOption func(*adaptiveOptions)
AdaptiveOption configures an adaptive rate limiter.
func Window ¶
func Window(w time.Duration) AdaptiveOption
Window configures how often statistics about capacity usage are collected. A shorter value gives you a quicker reaction time, but at the cost of increasing the risk of oscillations. The default value is 10 seconds.
type AdaptiveQPS ¶
type AdaptiveQPS struct {
// contains filtered or unexported fields
}
AdaptiveQPS is a rate limiter that will try to guess what is the optional capacity to request. It will try to fo as fast as possible, but it will release some capacity if the client cannot keep up with the capacity it received.
func (*AdaptiveQPS) Close ¶
func (arl *AdaptiveQPS) Close()
Close closes the adjustible rate limiter. It should be called only once.
type RateLimiter ¶
type RateLimiter interface { // Wait blocks until the appropriate operation runs or an error occurs. Wait(ctx context.Context) error // Close closes the rate limiter. Close() }
RateLimiter is a rate limiter that works with Doorman resources.
func NewAdaptiveQPS ¶
func NewAdaptiveQPS(res doorman.Resource, options ...AdaptiveOption) RateLimiter
NewAdaptiveQPS creates a rate limiter connected to the resource.
func NewQPS ¶
func NewQPS(res doorman.Resource) RateLimiter
NewQPS creates a rate limiter connected to the resourse.