worker

package
v0.0.0-...-eaa370e Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Factories        = make(map[string]WorkerFactory)
	WORKER_NOT_EXIST = errors.New("worker: worker type does not exist")
)

Factories holds all of the WorkerFacories that will be loaded for the manager to use

Functions

func LoadWorker

func LoadWorker(w WorkerFactory)

LoadWorker loads a worker into the map of workers

Types

type Worker

type Worker interface {
	// Work will be called by the manager to start the worker
	Work(j job.Job) *job.JobStats

	// Recycle get the worker ready to take on more work
	Recycle()

	// Kill send the kill signal to the worker
	Kill() error

	config.Configer
}

Worker is used by a Manager to control the work being done by a sub-process

func Create

func Create(t string, c config.Config) (Worker, error)

Create given a config create a new worker

type WorkerFactory

type WorkerFactory func() Worker

WorkerFactory constructs and returns a new worker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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