Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
Clock is the minimum necessary interface to instantiate a rate limiter with a clock or mock clock, compatible with clocks created using github.com/andres-erbsen/clock.
type Limiter ¶
type Limiter interface {
Take() time.Time // Take should block to make sure that the rate is met.
Rate() int
Duration() time.Duration
String() string
}
Limiter is used to rate-limit some process, possibly across goroutines. The process is expected to call Take() before every iteration, which may block to throttle the goroutine.
Click to show internal directories.
Click to hide internal directories.