Documentation ¶
Index ¶
Constants ¶
View Source
const (
HillClimbingLimiter = iota
)
Variables ¶
View Source
var ErrReachLimitation = fmt.Errorf("reach limitation")
View Source
var (
Verbose = false
)
Functions ¶
func VerboseDebugf ¶
func VerboseDebugf(msg string, args ...interface{})
Types ¶
type HillClimbing ¶
type HillClimbing struct {
// contains filtered or unexported fields
}
HillClimbing is a limiter using HillClimbing algorithm
func (*HillClimbing) Acquire ¶
func (l *HillClimbing) Acquire() (Updater, error)
func (*HillClimbing) Inflight ¶
func (l *HillClimbing) Inflight() uint64
func (*HillClimbing) Remaining ¶
func (l *HillClimbing) Remaining() uint64
type HillClimbingOption ¶
type HillClimbingOption int64
const ( HillClimbingOptionShrinkPlus HillClimbingOption = -2 HillClimbingOptionShrink HillClimbingOption = -1 HillClimbingOptionDoNothing HillClimbingOption = 0 HillClimbingOptionExtend HillClimbingOption = 1 HillClimbingOptionExtendPlus HillClimbingOption = 2 )
type HillClimbingUpdater ¶
type HillClimbingUpdater struct {
// contains filtered or unexported fields
}
func NewHillClimbingUpdater ¶
func NewHillClimbingUpdater(limiter *HillClimbing) *HillClimbingUpdater
func (*HillClimbingUpdater) DoUpdate ¶
func (u *HillClimbingUpdater) DoUpdate() error
type Limiter ¶
type Limiter interface { Inflight() uint64 Remaining() uint64 // Acquire inspects the current status of the system: // - if reaches the limitation, reject the request immediately. // - if not, grant this request and return an Updater defined below. Acquire() (Updater, error) }
func NewHillClimbing ¶
func NewHillClimbing() Limiter
Click to show internal directories.
Click to hide internal directories.