Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface { // JobName returns the name of the job. JobName() string // Run executes the job. Run() // GetDoneCh returns the channel, which when closed, indicates that the job was finished. GetDoneCh() <-chan struct{} }
Job is a runnable interface to queue jobs on a WorkerPool
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool object representation
func NewWorkerPool ¶
func NewWorkerPool(nWorkers int) *WorkerPool
NewWorkerPool creates a new work group. If nWorkers is 0, will poll goMaxProcs to get the number of routines to spawn. Reminder: routines are never pinned to system threads, it's up to the go scheduler to decide when and where these will be scheduled.
func (*WorkerPool) AddJob ¶
func (wp *WorkerPool) AddJob(job Job) <-chan struct{}
AddJob posts the job on a worker queue Uses Hash underneath to choose worker to post the job to
func (*WorkerPool) GetWorkerNumber ¶
func (wp *WorkerPool) GetWorkerNumber() int
GetWorkerNumber get number of queues/workers
Click to show internal directories.
Click to hide internal directories.