workers

package
v0.11.11 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ErrMissingKey when config key for worker is missing
	ErrMissingKey = Error("missing worker key")

	// ErrRedisClientNil when redis client not provided
	ErrRedisClientNil = Error("gotten nil redis client for exclusive worker")
)

Variables

View Source
var Module = module.Module{
	{Constructor: NewWorkersGroup},
	{Constructor: NewWorkers},
}

Module of workers

Functions

func NewWorkersGroup

func NewWorkersGroup(wrks []*worker.Worker) *worker.Group

NewWorkersGroup returns workers group with injected workers

Types

type Error added in v0.11.9

type Error string

Error is constant error

func (Error) Error added in v0.11.9

func (e Error) Error() string

Error converts constant error from string

type Params

type Params struct {
	dig.In

	Config *viper.Viper
	Logger *zap.Logger
	Redis  *redis.Client `optional:"true"`
	Jobs   map[string]worker.Job
}

Params is dependencies for create workers slice

type Result

type Result struct {
	dig.Out
	Workers []*worker.Worker
}

Result returns wrapped workers group for di

func NewWorkers

func NewWorkers(p Params) (Result, error)

NewWorkers returns wrapped workers slice builded by config settings

Jump to

Keyboard shortcuts

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