Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicRateLimiter ¶
func (*BasicRateLimiter) GetRetrySeconds ¶
func (rl *BasicRateLimiter) GetRetrySeconds(rates map[string][]*command.Rate) (retrySeconds int, err error)
Checks whether any of the given rates
func (*BasicRateLimiter) UpdateStats ¶
type RateLimiter ¶
type RateLimiter interface { // This function checks if any of the rates is exceeded, in case if any of the rates is // exceeded, returns positive retry seconds specifying when it would make sense to retry. // Note that retry seconds does not guarantee that request will succeed after given seconds, // it just guarantiees that request would not succeed if tried before the given amount of seconds. // This is more a convenience for clients, so they can stop wasting excessive cycles. GetRetrySeconds(rates map[string][]*command.Rate) (retrySeconds int, err error) // Update stats within internal backend UpdateStats(requestBytes int64, rates map[string][]*command.Rate) error }
Limits the requests based on stats stored in the backend, updates the stats
Click to show internal directories.
Click to hide internal directories.