Documentation ¶
Index ¶
- func Setup(conf *config.RedisConf, logger *logrus.Logger) error
- type Limiter
- type Throttler
- func (t *Throttler) Add(pool, namespace, token string, limiter *Limiter) error
- func (t *Throttler) Delete(pool, namespace, token string) error
- func (t *Throttler) Get(pool, namespace, token string) *Limiter
- func (t *Throttler) GetAll(forceUpdate bool) []TokenLimiter
- func (t *Throttler) IsReachRateLimit(pool, namespace, token string, isRead bool) (bool, error)
- func (t *Throttler) RemedyLimiter(pool, namespace, token string, isRead bool) error
- func (t *Throttler) Set(pool, namespace, token string, limiter *Limiter) error
- func (t *Throttler) Shutdown()
- type TokenLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Limiter ¶
type Limiter struct { Read int64 `json:"read"` Write int64 `json:"write"` Interval int64 `json:"interval"` }
Limiter is the detail limit of the token
type Throttler ¶
type Throttler struct {
// contains filtered or unexported fields
}
Throttler is the QPS throttler for publish/consume
func (*Throttler) Add ¶
Add adds the token into the throttler, returns error if the token has already existed
func (*Throttler) GetAll ¶
func (t *Throttler) GetAll(forceUpdate bool) []TokenLimiter
GetAll returns all limiters
func (*Throttler) IsReachRateLimit ¶
IsReachRateLimit checks whether the read or write op reached limit
func (*Throttler) RemedyLimiter ¶
RemedyLimiter would remedy the limiter when consume/produce go wrong
type TokenLimiter ¶
type TokenLimiter struct { Namespace string `json:"namespace"` Token string `json:"token"` Limiter Limiter `json:"limiter"` }
TokenLimiter is limit of the token
Click to show internal directories.
Click to hide internal directories.