Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// A pool of workers channels that are registered with the goworker
WorkerPool chan chan GoJob
Workers chan *Worker
// contains filtered or unexported fields
}
Dispatcher starts workers and route jobs for it
func NewDispatcher ¶
func NewDispatcher(maxWorkers int, jobsQueueSize uint) *Dispatcher
NewDispatcher construct new Dispatcher
func (*Dispatcher) AddJob ¶
func (d *Dispatcher) AddJob(job GoJob)
AddJob adds new job to dispatcher
func (*Dispatcher) CleanUnperformedJobs ¶
func (d *Dispatcher) CleanUnperformedJobs()
CleanUnperformedJobs remove unperformedJobs
func (*Dispatcher) CountJobs ¶
func (d *Dispatcher) CountJobs() int
func (*Dispatcher) GetUnperformedJobs ¶
func (d *Dispatcher) GetUnperformedJobs() []GoJob
GetUnperformedJobs method returns a chan of GoJobs that have not been done before Stop() executed
type Worker ¶
type Worker struct {
WorkerPool chan chan GoJob
JobChannel chan GoJob
// contains filtered or unexported fields
}
Worker represents the worker that executes the job
Click to show internal directories.
Click to hide internal directories.