request_limitation

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Count

type Count struct {
	// contains filtered or unexported fields
}

a simple increase and decrease request limitation.

func NewCount

func NewCount(max uint, canNotIncreaseErr error) *Count

func (*Count) Close

func (c *Count) Close() error

func (*Count) Count

func (c *Count) Count() uint

get current count of request limitation

func (*Count) Decrease

func (c *Count) Decrease()

func (*Count) Increase

func (c *Count) Increase() error

type CountThrottling

type CountThrottling struct {
	// contains filtered or unexported fields
}

count throttling provide the combined functionality of throttling and count. It will have a count of current jobs that must be decreased AND the throttling based on time

func NewCountThrottling

func NewCountThrottling(concurrency uint, coolDown time.Duration, maxQueue uint, queueFullError error) *CountThrottling

create new throttling request limitation

func (*CountThrottling) Close

func (t *CountThrottling) Close() error

func (*CountThrottling) Current

func (t *CountThrottling) Current() uint

func (*CountThrottling) Decrease

func (t *CountThrottling) Decrease()

func (*CountThrottling) Exec

func (t *CountThrottling) Exec(cb func(dec chan struct{})) error

type Throttling

type Throttling struct {
	// contains filtered or unexported fields
}

func NewThrottling

func NewThrottling(concurrency uint, coolDown time.Duration, maxQueue uint, queueFullError error) *Throttling

create new throttling request limitation

func (*Throttling) Close

func (t *Throttling) Close() error

func (*Throttling) Exec

func (t *Throttling) Exec(cb func()) error

Jump to

Keyboard shortcuts

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