guard_pool

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Running = iota
	Pending
	Over
	Idle
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseLimiter

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

type GoWorker

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

type GuardPool

type GuardPool struct {
	RunningSheet map[string]*GoWorker
	IdleSheet    map[string]*GoWorker
	RunningChan  chan *GoWorker
	IdleChan     chan *GoWorker
	StatusChan   chan *GoWorker
	TaskFuncChan chan TaskFunc
	// contains filtered or unexported fields
}

func NewPool

func NewPool(count int) *GuardPool

func (*GuardPool) AsyncSubmit

func (r *GuardPool) AsyncSubmit(task TaskFunc)

func (*GuardPool) GetRunningCount

func (r *GuardPool) GetRunningCount() int

func (*GuardPool) Pause

func (r *GuardPool) Pause()

func (*GuardPool) Recover

func (r *GuardPool) Recover()

func (*GuardPool) Release

func (r *GuardPool) Release()

func (*GuardPool) Start

func (r *GuardPool) Start()

func (*GuardPool) Submit

func (r *GuardPool) Submit(task TaskFunc)

type IntervalLimiter

type IntervalLimiter struct {
	BaseLimiter
	// contains filtered or unexported fields
}

func NewIntervalLimiter

func NewIntervalLimiter(interval time.Duration) *IntervalLimiter

type TaskFunc

type TaskFunc func()

type TempoLimiter

type TempoLimiter struct {
	Limit      int32
	SecondSpan int32

	BaseLimiter
	// contains filtered or unexported fields
}

func NewTempoLimit

func NewTempoLimit(limit, second int32) *TempoLimiter

func (*TempoLimiter) Hit

func (t *TempoLimiter) Hit() bool

Jump to

Keyboard shortcuts

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