workerpool

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkerCount = runtime.NumCPU()

Functions

This section is empty.

Types

type Action

type Action func(task *Task) error

type SimpleAction added in v0.0.2

type SimpleAction func() error

type SimplePool added in v0.0.2

type SimplePool struct {
	// contains filtered or unexported fields
}

func NewSimple added in v0.0.2

func NewSimple(n int) *SimplePool

func (*SimplePool) Run added in v0.0.2

func (s *SimplePool) Run(f SimpleAction)

func (*SimplePool) Wait added in v0.0.2

func (s *SimplePool) Wait() error

type Task

type Task struct {
	Message string
	Value   interface{}

	Action Action

	Tracker *progress.Tracker
	// contains filtered or unexported fields
}

func (*Task) SetMessage

func (t *Task) SetMessage(msg string, args ...interface{})

type Workerpool

type Workerpool struct {
	// contains filtered or unexported fields
}

func New

func New(name string, tasks []*Task, action Action) *Workerpool

func (*Workerpool) Run

func (wp *Workerpool) Run() error

func (*Workerpool) SerialRun

func (wp *Workerpool) SerialRun() error

func (*Workerpool) SetProgressBuilder

func (wp *Workerpool) SetProgressBuilder(f func(tasks []*Task) progress.Writer)

Jump to

Keyboard shortcuts

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