worker

package
v0.7.8-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoWorkersEnabled = errors.New("no workers enabled")

Functions

This section is empty.

Types

type DecorateFunction added in v0.5.0

type DecorateFunction func(fx.Hook) fx.Hook

type Decorator added in v0.5.0

type Decorator struct {
	Key      string
	Decorate DecorateFunction
}

type Registry

type Registry interface {
	Workers() []Worker
	Enable(names ...string) error
	Disable(names ...string) error
	EnableAll()
	DisableAll()
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	// contains filtered or unexported methods
}

type RegistryParams

type RegistryParams struct {
	fx.In
	fx.Shutdowner
	Workers    []Worker    `group:"workers"`
	Decorators []Decorator `group:"worker_decorators"`
	Logger     *zap.SugaredLogger
}

type RegistryResult

type RegistryResult struct {
	fx.Out
	Registry Registry
}

func NewRegistry

func NewRegistry(p RegistryParams) (RegistryResult, error)

type Worker

type Worker interface {
	Key() string
	Enabled() bool
	Started() bool
	// contains filtered or unexported methods
}

func NewWorker

func NewWorker(key string, hook fx.Hook) Worker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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