Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyConcurrency ¶
func VerifyConcurrency(cm ConcurrencyManager, p Params, task func()) error
VerifyConcurrency verifies that the worker pool runs tasks at the expected concurrency. The task must have a non-zero runtime to ensure that we test the concurrency limit of the worker pool.
Types ¶
type ChannelPool ¶
type ChannelPool struct {
// contains filtered or unexported fields
}
ChannelPool is a worker pool that limits concurrency using a fixed-size buffered channel.
func NewChannelPool ¶
func NewChannelPool(workerCount int) ChannelPool
func (ChannelPool) Submit ¶
func (p ChannelPool) Submit(f func())
func (ChannelPool) Wait ¶
func (p ChannelPool) Wait()
type ConcurrencyManager ¶
type ConcurrencyManager interface { // Submit submits a work item to the worker pool. Submit(func()) // Wait blocks until all work items have been completed. Wait() }
ConcurrencyManager represents a worker pool.
type SemaphorePool ¶
type SemaphorePool struct {
// contains filtered or unexported fields
}
SemaphorePool is a worker pool that limits concurrency using a semaphore.
func NewSemaphorePool ¶
func NewSemaphorePool(concurrency int64) *SemaphorePool
func (SemaphorePool) Submit ¶
func (s SemaphorePool) Submit(f func())
func (SemaphorePool) Wait ¶
func (s SemaphorePool) Wait()
type WorkerPoolWrapper ¶
type WorkerPoolWrapper struct {
*workerpool.WorkerPool
}
WorkerPoolWrapper is a worker pool that limits concurrency using the gammazero/workerpool package.
func NewWorkerPool ¶
func NewWorkerPool(workerCount int) *WorkerPoolWrapper
func (*WorkerPoolWrapper) Submit ¶
func (w *WorkerPoolWrapper) Submit(f func())
func (*WorkerPoolWrapper) Wait ¶
func (w *WorkerPoolWrapper) Wait()
Click to show internal directories.
Click to hide internal directories.