Documentation ¶
Index ¶
- type LazySyncRateLimiter
- func (lsl *LazySyncRateLimiter) Close() error
- func (lsl *LazySyncRateLimiter) GetPassThrough() bool
- func (lsl *LazySyncRateLimiter) Name() string
- func (lsl *LazySyncRateLimiter) Return(label string, n float64) (float64, float64)
- func (lsl *LazySyncRateLimiter) SetPassThrough(passThrough bool)
- func (lsl *LazySyncRateLimiter) Take(label string, n float64) (bool, time.Duration, float64, float64)
- func (lsl *LazySyncRateLimiter) TakeIfAvailable(label string, n float64) (bool, float64, float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LazySyncRateLimiter ¶
type LazySyncRateLimiter struct {
// contains filtered or unexported fields
}
LazySyncRateLimiter is a limiter that syncs its state lazily with another limiter.
func NewLazySyncRateLimiter ¶
func NewLazySyncRateLimiter(limiter ratelimiter.RateLimiter, interval time.Duration, numSync uint32, jobGroup *jobs.JobGroup, ) (*LazySyncRateLimiter, error)
NewLazySyncRateLimiter creates a new LazySyncLimiter.
func (*LazySyncRateLimiter) Close ¶
func (lsl *LazySyncRateLimiter) Close() error
Close closes the limiter.
func (*LazySyncRateLimiter) GetPassThrough ¶
func (lsl *LazySyncRateLimiter) GetPassThrough() bool
GetPassThrough returns whether the limiter should pass through requests when it is not initialized.
func (*LazySyncRateLimiter) Name ¶
func (lsl *LazySyncRateLimiter) Name() string
Name returns the name of the limiter.
func (*LazySyncRateLimiter) Return ¶
func (lsl *LazySyncRateLimiter) Return(label string, n float64) (float64, float64)
Return returns n tokens to the limiter.
func (*LazySyncRateLimiter) SetPassThrough ¶
func (lsl *LazySyncRateLimiter) SetPassThrough(passThrough bool)
SetPassThrough sets whether the limiter should pass through requests when it is not initialized.
func (*LazySyncRateLimiter) Take ¶
func (lsl *LazySyncRateLimiter) Take(label string, n float64) (bool, time.Duration, float64, float64)
Take takes n tokens from the limiter.
func (*LazySyncRateLimiter) TakeIfAvailable ¶
TakeIfAvailable takes n tokens from the limiter if they are available.
Click to show internal directories.
Click to hide internal directories.