lazyWorker

package
v0.0.0-...-256bcdb Latest Latest
Warning

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

Go to latest
Published: Aug 26, 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
	Serialization bool // 是否串行化执行, 默认true,保持数据处理的顺序
	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) Debug

func (this *Worker) Debug() *Worker

func (*Worker) Push

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

func (*Worker) Run

func (this *Worker) Run()

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) WithQueueSize

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

func (*Worker) WithSerialization

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

Jump to

Keyboard shortcuts

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