Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JobQueue chan JobRequest
JobQueue : All jobs get queued here
View Source
var WorkerQueue chan chan JobRequest
WorkerQueue is a buffered channel of these channel type Each Worker/Job has an unbuffered channel to listen on
Functions ¶
func InitDispatcher ¶
InitDispatcher initializes the dispatcher
Types ¶
type JobRequest ¶
type JobRequest struct { JobID int64 // contains filtered or unexported fields }
JobRequest hold the Job
type Worker ¶
type Worker struct { WorkerID int JobChan chan JobRequest ExitChan chan bool WorkerQueue chan chan JobRequest Callback Callback }
Worker holds worker object
func CreateWorker ¶
func CreateWorker(id int, workerQueue chan chan JobRequest, callback Callback) Worker
CreateWorker creates a New Worker - Create a JobRequest Channel to listen on - Create an ExitChan to terminate - Add self to the WorkerQueue so we get JobRequests
Click to show internal directories.
Click to hide internal directories.