workers

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

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

	// ErrEmptyConfig when viper not passed to params
	ErrEmptyConfig = internal.Error("empty config")

	// ErrEmptyWorkers when workers not passed to params
	ErrEmptyWorkers = internal.Error("empty workers")

	// ErrEmptyLocker when locker required,
	// but not passed to params
	ErrEmptyLocker = internal.Error("empty locker")

	// ErrEmptyJob when worker job is nil
	ErrEmptyJob = internal.Error("empty job")
)

Variables

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

Module of workers

Functions

func NewWorkers

func NewWorkers(p Params) ([]*worker.Worker, error)

NewWorkers returns wrapped workers slice created by config settings

func NewWorkersGroup

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

NewWorkersGroup returns workers group with injected workers

Types

type LockerSettings added in v0.12.0

type LockerSettings interface {
	Apply(key string, v *viper.Viper) (worker.Locker, error)
}

LockerSettings creates copy of locker and applies settings

type Params

type Params struct {
	dig.In

	Config *viper.Viper
	Jobs   map[string]worker.Job
	Locker worker.Locker `optional:"true"`
}

Params is dependencies for create workers slice

Jump to

Keyboard shortcuts

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