workerpoolv2

package
v6.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandleWorkError

type HandleWorkError struct {
	ErrorMessage string
	WorkerID     int
	Data         []interface{}
}

func NewHandleWorkError

func NewHandleWorkError(errorMessage string, workerID int, data []interface{}) HandleWorkError

func (HandleWorkError) Error

func (hwe HandleWorkError) Error() string

type Pool

type Pool interface {
}

type WorkConfiguration

type WorkConfiguration struct {
	Handler    WorkHandler
	MaxRetries int
	Retriever  WorkRetriever
}

type WorkHandler

type WorkHandler interface {
	ProcessWork(workerID int, data []interface{}, limiter ratelimit.Limiter) error
}

type WorkItem

type WorkItem struct {
	Data    interface{}
	Handler WorkHandler
}

type WorkItemCollection

type WorkItemCollection []WorkItem

func (WorkItemCollection) Handle

func (wic WorkItemCollection) Handle(workerID int, limiter ratelimit.Limiter, handler WorkHandler) error

type WorkRetriever

type WorkRetriever interface {
	RetrieveWork(handler WorkHandler) ([]WorkItem, error)
}

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(config WorkerPoolConfig) *WorkerPool

func (*WorkerPool) AddWorkConfiguration

func (wp *WorkerPool) AddWorkConfiguration(config WorkConfiguration)

func (*WorkerPool) Run

func (wp *WorkerPool) Run(ctx context.Context)

type WorkerPoolConfig

type WorkerPoolConfig struct {
	Logger             *logrus.Entry
	NumWorkers         int
	RateLimitPerSecond int
	TickFrequency      time.Duration
}

Jump to

Keyboard shortcuts

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