limiter

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

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() (Updater, error)
}

func NewHillClimbing

func NewHillClimbing() Limiter

type Updater

type Updater interface {
	DoUpdate() error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL