Documentation ¶
Index ¶
- Constants
- type HandleT
- func (throttler *HandleT) CheckLimitReached(destID, userID string, currentTime time.Time) bool
- func (throttler *HandleT) Dec(destID, userID string, count int64, currentTime time.Time, atLevel string)
- func (throttler *HandleT) Inc(destID, userID string, currentTime time.Time)
- func (throttler *HandleT) IsDestLevelEnabled() bool
- func (throttler *HandleT) IsEnabled() bool
- func (throttler *HandleT) IsUserLevelEnabled() bool
- func (throttler *HandleT) SetUp(destName string)
- type Limiter
- type Settings
- type Throttler
Constants ¶
View Source
const ( DESTINATION_LEVEL = "destination" USER_LEVEL = "user" ALL_LEVELS = "all" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleT ¶
type HandleT struct {
// contains filtered or unexported fields
}
HandleT is a Handle for event limiter
func (*HandleT) CheckLimitReached ¶
LimitReached returns true if number of events in the rolling window is less than the max events allowed, else false
func (*HandleT) Dec ¶
func (throttler *HandleT) Dec(destID, userID string, count int64, currentTime time.Time, atLevel string)
Dec decrements the destLimiter and userLimiter counters by count passed If destID or userID passed is empty, we don't decrement the counters.
func (*HandleT) Inc ¶
Inc increases the destLimiter and userLimiter counters. If destID or userID passed is empty, we don't increment the counters.
func (*HandleT) IsDestLevelEnabled ¶
func (*HandleT) IsUserLevelEnabled ¶
type Throttler ¶
type Throttler interface { CheckLimitReached(destID, userID string, currentTime time.Time) bool Inc(destID, userID string, currentTime time.Time) Dec(destID, userID string, count int64, currentTime time.Time, atLevel string) IsEnabled() bool IsUserLevelEnabled() bool IsDestLevelEnabled() bool }
Throttler is an interface for throttling functions
Click to show internal directories.
Click to hide internal directories.