Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Work ¶
Work is an interface to allow the abstraction of Work and Return, enabling generic Workers doing blind Work
type WorkError ¶
type WorkError struct {
Messages string
}
WorkError is sent to Work.Return() if the Work generates a panic
type WorkerPool ¶
type WorkerPool struct {
// WorkChan is where the work goes
WorkChan chan Work
// Stop permanently stops the pool after current work is done.
// WorkChan is not closed, to prevent errant reads
Stop func()
Metrics metrics.Meter
// contains filtered or unexported fields
}
WorkerPool is a simple mechanation to manage and accomplish Work.
func NewSimpleWorkerPool ¶ added in v1.6.0
func NewSimpleWorkerPool(WorkChan chan Work) *WorkerPool
NewSimpleWorkerPool returns a functioning WorkerPool bound to WorkChan, that does not try keep Workers running. It is strongly recommended that WorkChan be unbounded unless you demonstrably need to bound it.
func (*WorkerPool) AddWork ¶ added in v1.6.0
func (p *WorkerPool) AddWork(work Work)
AddWork adds Work and updates metrics. Will panic if WorkChan is closed.
func (*WorkerPool) Work ¶
func (p *WorkerPool) Work() int
Work returns the quantity of Work in the work channel
Click to show internal directories.
Click to hide internal directories.