Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTimeout = errors.New("limiter acquire timeout") ErrClosed = errors.New("limiter closed") )
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter support update limit number dynamically
func NewLimiter ¶
func (*Limiter) Acquire ¶
Acquire will wait for an available resource. timeout eq 0 means no timeout limit. Return ErrTimeout if no resource available after timeout duration. Return ErrClosed if this Limiter is closed.
func (*Limiter) RunningNum ¶
func (*Limiter) WaitingNum ¶
Click to show internal directories.
Click to hide internal directories.