Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SlidingWindow ¶
type SlidingWindow struct { *slidingwindow.Limiter // contains filtered or unexported fields }
SlidingWindow is a rate limiter using a sliding window for limiting the records.
func NewSlidingWindowRateLimiter ¶
func NewSlidingWindowRateLimiter(windowSize time.Duration, limit int64, blockCounter prometheus.Counter) *SlidingWindow
NewSlidingWindowRateLimiter creates a rate limiter which uses a sliding window.
func (*SlidingWindow) Allow ¶
func (sw *SlidingWindow) Allow(n int64) bool
Allow checks if n records can be allowed by the sliding window rate limiter. It increases the number of blocking readers when denies the records.
Click to show internal directories.
Click to hide internal directories.