task

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerClosed = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status uint8
const (
	Unknown Status = iota
	Wait
	InProgress
	Done
)

noinspection GoUnusedConst

type StatusManager

type StatusManager interface {
	Save(taskID string, status uint8) error
	Error(taskID string, err error) error
	Get(taskID string) (status uint8, err error)
}

func NewImMemStatusManager

func NewImMemStatusManager() StatusManager

type Worker

type Worker interface {
	Schedule(exec func() error, timeAfter time.Duration) (taskID string, err error)
	Status(taskID string) (status uint8, err error)
	Close()
}

func NewWorker

func NewWorker(ctx context.Context, maxGoroutines int, sm StatusManager) Worker

Jump to

Keyboard shortcuts

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