concurrency

package
v0.0.0-...-7e100c4 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher 调度器

func NewDispatcher

func NewDispatcher(pctx context.Context, maxWorkers int, maxJobQueue int) *Dispatcher

NewDispatcher 创建调度器

func (*Dispatcher) Close

func (d *Dispatcher) Close() error

Close 关闭调度器

func (*Dispatcher) Process

func (d *Dispatcher) Process(j Job)

Process 执行JOB

func (*Dispatcher) Run

func (d *Dispatcher) Run()

Run 执行调度器

type Job

type Job interface {
	Execute() error
}

Job 执行事情

type Worker

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

Worker 工作者

func NewWorker

func NewWorker(pctx context.Context, d *Dispatcher) *Worker

NewWorker 创建一个Worker

func (*Worker) Close

func (w *Worker) Close() error

Close 关闭工作者

func (*Worker) Process

func (w *Worker) Process(j Job)

Process 执行Job

func (*Worker) Run

func (w *Worker) Run()

Run 执行worker

Jump to

Keyboard shortcuts

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