lazyWorker

package
v0.0.0-...-e50112c Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	QueueSize    int
	LazySize     int
	LazyInterval time.Duration
	Parallel     bool
	Logger       logs.Logger
	// contains filtered or unexported fields
}

func DefaultOptions

func DefaultOptions() *Options

type State

type State int32
const (
	StateCreated  State // created
	StateRunning        // running
	StateStopping       // stopping
	StateStopped        // stopped
)

func (State) String

func (i State) String() string

type Worker

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

func New

func New(name string, handler func(jobs []interface{}), opts ...*Options) *Worker

func (*Worker) CmpAndSwapState

func (this *Worker) CmpAndSwapState(old, new State) bool

func (*Worker) Debug

func (this *Worker) Debug() *Worker

func (*Worker) Push

func (this *Worker) Push(job interface{})

func (*Worker) Run

func (this *Worker) Run()

func (*Worker) SetState

func (this *Worker) SetState(state State)

func (*Worker) State

func (this *Worker) State() State

func (*Worker) Stop

func (this *Worker) Stop()

func (*Worker) WithLazyInterval

func (this *Worker) WithLazyInterval(d time.Duration) *Worker

func (*Worker) WithLazySize

func (this *Worker) WithLazySize(size int) *Worker

func (*Worker) WithLogger

func (this *Worker) WithLogger(logger logs.Logger) *Worker

func (*Worker) WithParallel

func (this *Worker) WithParallel(enable bool) *Worker

func (*Worker) WithQueueSize

func (this *Worker) WithQueueSize(size int) *Worker

Jump to

Keyboard shortcuts

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