asyncjob

package
v0.0.0-...-d64eb31 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGroup

func NewGroup(isConcurrent bool, jobs ...Job) *group

func NewJob

func NewJob(handler JobHandler) *job

func NewQueryJob

func NewQueryJob(handler JobHandler) *job

Types

type Job

type Job interface {
	Execute(ctx context.Context) error
	Retry(ctx context.Context) error
	State() JobState
	SetRetryDurations(times []time.Duration)
}

type JobHandler

type JobHandler func(ctx context.Context) error

type JobState

type JobState int
const (
	StateInit JobState = iota
	StateRunning
	StateFailed
	StateTimeout
	StateCompleted
	StateRetryFailed
)

func (JobState) String

func (js JobState) String() string

Jump to

Keyboard shortcuts

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