groupworkpool

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group interface {
	// Enqueue queues a work function to be executed by the group. It does not
	// block and the WorkFunc should be assumed to execute in another goroutine.
	Enqueue(WorkFunc)
}

Group is a group of workers that can execute work.

type GroupWorkPool

type GroupWorkPool interface {
	// AddGroup adds a new group to the pool. Cancellation of the provided
	// context will cause the group to be removed from the pool.
	AddGroup(context.Context) Group
	// Start starts the pool. Cancellation of the provided context will cause
	// the pool to stop.
	Start(context.Context)
	// Stop stops the pool. Will have the same effect as cancelling the context
	// passed to Start.
	Stop()
}

GroupWorkPool is a worker pool with a fixed number of workers. The pool executes work in groups. Each group has a fixed maximum number of workers it can use.

func New

func New(totalWorkers, workersPerGroup int) GroupWorkPool

New creates a new GroupWorkPool with the given number of total workers and total workers per group.

type WorkFunc

type WorkFunc func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL