Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoopLimiter ¶ added in v0.12.1
type NoopLimiter struct { }
ServerLimiter provides interface to limit amount of requests
func (NoopLimiter) Capacity ¶ added in v0.12.1
func (l NoopLimiter) Capacity() int
type RealLimiter ¶ added in v0.12.1
type RealLimiter struct {
// contains filtered or unexported fields
}
ServerLimiter provides interface to limit amount of requests
func (RealLimiter) Capacity ¶ added in v0.12.1
func (sl RealLimiter) Capacity() int
type ServerLimiter ¶
type ServerLimiter interface { Capacity() int Enter(ctx context.Context, s string) error Leave(ctx context.Context, s string) }
func NewServerLimiter ¶
func NewServerLimiter(servers []string, l int) ServerLimiter
NewServerLimiter creates a limiter for specific servers list.
type SimpleLimiter ¶ added in v0.12.0
type SimpleLimiter chan struct{}
func NewSimpleLimiter ¶ added in v0.12.0
func NewSimpleLimiter(l int) SimpleLimiter
func (SimpleLimiter) Enter ¶ added in v0.12.0
func (l SimpleLimiter) Enter()
func (SimpleLimiter) Leave ¶ added in v0.12.0
func (l SimpleLimiter) Leave()
Click to show internal directories.
Click to hide internal directories.