Documentation
¶
Index ¶
Constants ¶
View Source
const ( Idle int32 = iota Active = 1 Closing = 2 Closed = 3 )
Variables ¶
View Source
var (
DefaultPool = NewWorkerPool(context.Background(), 0, 0)
)
Functions ¶
This section is empty.
Types ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Maintains a cached goroutine that can process one job at a time and is returned back to a sync.Pool
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶
func NewWorkerPool(ctx context.Context, min, max int) *WorkerPool
func (*WorkerPool) Dispatch ¶
func (w *WorkerPool) Dispatch(job WorkerJob) bool
func (*WorkerPool) Get ¶
func (w *WorkerPool) Get() *Worker
func (*WorkerPool) Name ¶
func (w *WorkerPool) Name() string
func (*WorkerPool) PrintStats ¶
func (w *WorkerPool) PrintStats()
func (*WorkerPool) Put ¶
func (w *WorkerPool) Put(worker *Worker)
func (*WorkerPool) Register ¶
func (w *WorkerPool) Register(registry metrics.Registry)
func (*WorkerPool) Stop ¶
func (w *WorkerPool) Stop()
Click to show internal directories.
Click to hide internal directories.