common

package
v0.4.28 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIgnorableError

func IsIgnorableError(err error) bool

func NewIgnorableError

func NewIgnorableError(err error) error

Types

type IgnorableError

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

func (*IgnorableError) Error

func (i *IgnorableError) Error() string

type Int64Tuple

type Int64Tuple struct {
	Key, Value int64
}

type Job

type Job func(ctx context.Context) error

type JobWithId

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

type WorkerPool

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

WorkerPool a pool that can control the total amount and rate of concurrency

func NewWorkerPool

func NewWorkerPool(ctx context.Context, workerNum int, rps int32) (*WorkerPool, error)

NewWorkerPool build a worker pool, rps 0 is unlimited

func (*WorkerPool) Done

func (p *WorkerPool) Done()

func (*WorkerPool) JobNum

func (p *WorkerPool) JobNum() int32

func (*WorkerPool) Start

func (p *WorkerPool) Start()

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(job Job)

func (*WorkerPool) SubmitWithId

func (p *WorkerPool) SubmitWithId(job Job) int64

func (*WorkerPool) Wait

func (p *WorkerPool) Wait() error

func (*WorkerPool) WaitJobs

func (p *WorkerPool) WaitJobs(jobIds []int64) error

Jump to

Keyboard shortcuts

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