worker

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 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 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
}

type RegistryParams

type RegistryParams struct {
	fx.In
	fx.Shutdowner
	Workers []Worker `group:"workers"`
	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