worker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRootPath = errors.New("bad root_path")
View Source
var ErrWorkerIndexOutOfBonds = errors.New("worker index out of bounds")
View Source
var ErrWorkerManagerNotStarted = errors.New("worker cannot be restarted without an existing context")

Functions

This section is empty.

Types

type ChainTrackerServicer

type ChainTrackerServicer interface {
	ChainTrackerService() *chaintracker.Service
}

type Config

type Config struct {
	Workers []*Worker `json:"workers"`
}

func (*Config) Length

func (c *Config) Length() int

type ConfigServicer

type ConfigServicer interface {
	ConfigService() *config.Service
}

type GolinksServicer

type GolinksServicer interface {
	GolinksService() *golinks.Service
}

type Service

type Service struct {
	WorkerConfig *Config
	// contains filtered or unexported fields
}

func New

func New(servicer Servicer) (*Service, error)

func (*Service) AddWorker

func (w *Service) AddWorker(rootPath string, generationPeriod int, ignorePaths []string) error

func (*Service) DeleteWorkerByIndex

func (w *Service) DeleteWorkerByIndex(index int) error

func (*Service) Execute

func (w *Service) Execute(ctx context.Context) error

func (*Service) GetWorkerByIndex

func (w *Service) GetWorkerByIndex(index int) (*Worker, error)

func (*Service) ScheduleWork

func (w *Service) ScheduleWork(workerID string, task func() error) error

type Worker

type Worker struct {
	RootPath         string   `json:"root_path"`
	GenerationPeriod int      `json:"generation_period"`
	IgnorePaths      []string `json:"ignore_paths"`
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(servicer Servicer, rootPath string, generationPeriod int, ignorePaths []string) (*Worker, error)

func (*Worker) AddCancelFunc

func (w *Worker) AddCancelFunc(cancelFunc func())

func (*Worker) Execute

func (w *Worker) Execute(ctx context.Context) error

type WorkerServicer

type WorkerServicer interface {
	WorkerService() *Service
}

type WorkerTask

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

func (*WorkerTask) ID

func (wt *WorkerTask) ID() string

func (*WorkerTask) Work

func (wt *WorkerTask) Work() func() error

Jump to

Keyboard shortcuts

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