Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
ServeJob(v interface{})
}
Handler represents the worker handler function
type WorkerPool ¶
WorkerPool holds the pool of worker
func New ¶
func New(worker Handler, options ...WorkerPoolOptionSetterFunc) (*WorkerPool, error)
New returns the worker pool by options
func (*WorkerPool) Serve ¶
func (wp *WorkerPool) Serve(v interface{}) bool
Serve dispatchs the worker to worker
func (*WorkerPool) Start ¶
func (wp *WorkerPool) Start()
Start starts the number of workers to wait workers
type WorkerPoolOptionSetterFunc ¶
type WorkerPoolOptionSetterFunc func(*WorkerPool)
func WithWorkerPoolMaxIdleWorkerDuration ¶
func WithWorkerPoolMaxIdleWorkerDuration(m time.Duration) WorkerPoolOptionSetterFunc
func WithWorkerPoolMaxWorkersCount ¶
func WithWorkerPoolMaxWorkersCount(m int) WorkerPoolOptionSetterFunc
func WithWorkerPoolMustStop ¶
func WithWorkerPoolMustStop() WorkerPoolOptionSetterFunc
Click to show internal directories.
Click to hide internal directories.