jobserver

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IJob

type IJob interface {
	Run() error
}

type Job

type Job struct {
	sync.WaitGroup

	log.InvokeLog
	// contains filtered or unexported fields
}

job,负责单个任务的执行

func NewJob

func NewJob(name string, f func()) *Job

func (*Job) Name

func (j *Job) Name() string

func (*Job) Run

func (j *Job) Run() error

func (*Job) SetCoNum

func (j *Job) SetCoNum(num int64)

func (*Job) Stop

func (j *Job) Stop() error

type JobRunner

type JobRunner struct {
	sync.WaitGroup

	log.InvokeLog
	// contains filtered or unexported fields
}

JobRunner,负责并发处理某个任务

func NewJobRunner

func NewJobRunner(name string) *JobRunner

func (*JobRunner) AddExecute

func (rn *JobRunner) AddExecute(name string, f func())

func (*JobRunner) AddJob

func (rn *JobRunner) AddJob(j IJob)

func (*JobRunner) Name

func (rn *JobRunner) Name() string

func (*JobRunner) Run

func (rn *JobRunner) Run() error

func (*JobRunner) Stop added in v1.1.14

func (rn *JobRunner) Stop() error

type JobScheduler

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

func NewJobScheduler

func NewJobScheduler(name string, interval time.Duration, f IJob) *JobScheduler

func (*JobScheduler) Name

func (sch *JobScheduler) Name() string

func (*JobScheduler) Run

func (sch *JobScheduler) Run() error

func (*JobScheduler) Stop

func (sch *JobScheduler) Stop() error

type Task

type Task = func()

Jump to

Keyboard shortcuts

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