Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartServer ¶
func StartServer(d *Dispatcher)
StartServer start an web server, which can be used to control the jobs
Types ¶
type Dispatcher ¶
type Dispatcher struct { // A pool of workers channels that are registered with the dispatcher WorkerPool chan chan Job MaxWorkers int Workers []Worker JobQueue chan Job // A buffered channel that we can send work requests on. // contains filtered or unexported fields }
Dispatcher Keeps the things together, a controller.
func NewDispatcher ¶
func NewDispatcher(maxWorkers, maxQueue int, p ProcessPayload) *Dispatcher
NewDispatcher Create a new instance
func (*Dispatcher) DispatchJob ¶
func (d *Dispatcher) DispatchJob(j *Job)
DispatchJob send a job to the workers
type Job ¶
type Job struct {
Payload Payload
}
Job represents the task/job to be run, with the payload
type Payload ¶
type Payload struct {
Magic string
}
Payload the data to be processed, in this example is a string
type ProcessPayload ¶
ProcessPayload what to do with it?
type Worker ¶
type Worker struct { WorkerPool chan chan Job JobChannel chan Job ID string //for debuging purposes // contains filtered or unexported fields }
Worker represents the worker that executes the job
func NewWorker ¶
func NewWorker(workerPool chan chan Job, p ProcessPayload) Worker
NewWorker workers are the foundation of our queue system
type WorkerUpdate ¶
WorkerUpdate worker status update msg to clients
Click to show internal directories.
Click to hide internal directories.