Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultWaitTimeout = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PondWorkerPool ¶
type PondWorkerPool struct {
// contains filtered or unexported fields
}
PondWorkerPool implements a worker pool based on https://github.com/alitto/pond
func (*PondWorkerPool) Submit ¶
func (wp *PondWorkerPool) Submit(workFunc func() error)
func (*PondWorkerPool) WaitForComplete ¶
func (wp *PondWorkerPool) WaitForComplete() error
type WorkerPool ¶
type WorkerPool interface { // Submit sends a work item to the worker pool to be processed. Submit(workFunc func() error) // Start starts the worker pool and returns a derived context which is canceled the first time // a function submitted to the group returns a non-nil error or the first time Wait returns, // whichever occurs first. Start(parent context.Context) (context.Context, error) // WaitForComplete blocks until either all the tasks submitted to this group have completed, // one of them returned a non-nil error or the context associated to this group was canceled. WaitForComplete() error }
WorkerPool provides a worker pool for parallelised processing tasks.
func PoolFactory ¶
func PoolFactory(size int, capacity int) (WorkerPool, error)
PoolFactory creates a new worker pool instance from the provided config.
Click to show internal directories.
Click to hide internal directories.