batchworkerpool

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_OPTIONS = &Options{
	WorkerCount:            2 * runtime.NumCPU(),
	QueueSize:              2 * runtime.NumCPU() * 64,
	BatchSize:              64,
	BatchCollectionTimeout: 15 * time.Millisecond,
}

Functions

This section is empty.

Types

type BatchWorkerPool

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

func New

func New(workerFnc func([]Task), optionalOptions ...Option) (result *BatchWorkerPool)

func (*BatchWorkerPool) GetBatchSize

func (wp *BatchWorkerPool) GetBatchSize() int

func (*BatchWorkerPool) GetPendingQueueSize

func (wp *BatchWorkerPool) GetPendingQueueSize() int

func (*BatchWorkerPool) GetWorkerCount

func (wp *BatchWorkerPool) GetWorkerCount() int

func (*BatchWorkerPool) Run

func (wp *BatchWorkerPool) Run()

func (*BatchWorkerPool) Start

func (wp *BatchWorkerPool) Start()

func (*BatchWorkerPool) Stop

func (wp *BatchWorkerPool) Stop()

func (*BatchWorkerPool) StopAndWait

func (wp *BatchWorkerPool) StopAndWait()

func (*BatchWorkerPool) Submit

func (wp *BatchWorkerPool) Submit(params ...interface{}) (result chan interface{})

type Option

type Option func(*Options)

func BatchCollectionTimeout

func BatchCollectionTimeout(batchCollectionTimeout time.Duration) Option

func BatchSize

func BatchSize(batchSize int) Option

func QueueSize

func QueueSize(queueSize int) Option

func WorkerCount

func WorkerCount(workerCount int) Option

type Options

type Options struct {
	WorkerCount            int
	QueueSize              int
	BatchSize              int
	BatchCollectionTimeout time.Duration
}

func (Options) Override

func (options Options) Override(optionalOptions ...Option) *Options

type Task

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

func (*Task) Param

func (task *Task) Param(index int) interface{}

func (*Task) Return

func (task *Task) Return(result interface{})

Jump to

Keyboard shortcuts

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