utils

package
v0.0.0-...-4ad1eb6 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(elems []string, elem string) bool

func StripPointer

func StripPointer(i interface{}) interface{}

Types

type JobReporter

type JobReporter interface {
	Done() error
	Close() error
}

type JobTask

type JobTask interface {
	Execute() error
}

JobTask job object to be executed by pool

type Pool

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

Pool worker pool of specified size to process JobTask

func NewPool

func NewPool(size int) *Pool

NewPool create a worker pool of given size

func (*Pool) Add

func (p *Pool) Add(t JobTask)

Add another task to the pool

func (*Pool) AddBulk

func (p *Pool) AddBulk(tasks []JobTask)

func (*Pool) Close

func (p *Pool) Close()

Close the pool, wait for WaitGroup to complete

func (*Pool) SetJobReporter

func (p *Pool) SetJobReporter(reporter JobReporter)

func (*Pool) Start

func (p *Pool) Start()

Start the worker pool

Jump to

Keyboard shortcuts

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