Documentation
¶
Index ¶
Constants ¶
View Source
const Lens scene.InfraName = "ratelimiter"
Variables ¶
View Source
var ( ErrInvalidLimit = errors.New("ratelimiter: limit must be greater than zero") ErrInvalidWindow = errors.New("ratelimiter: window must be greater than zero") ErrEmptyKey = errors.New("ratelimiter: key cannot be empty") ErrInvalidN = errors.New("ratelimiter: n must be greater than zero and less than or equal to limit") )
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Allowed bool
// Limit is the quota limit of the current policy.
Limit int
// Remaining is the estimated units left after this decision.
Remaining int
// RetryAfter indicates how long caller should wait before retrying.
// It is zero when Allowed is true.
RetryAfter time.Duration
}
Decision is the verbose result of a rate limit attempt.
Click to show internal directories.
Click to hide internal directories.