tasks

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

TODO check pool load on add TODO ignore to frequent progress updates TODO context TODO gracefully stop pool TODO give get status a timeout

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

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

func NewHub

func NewHub() *Hub

func (*Hub) Add

func (h *Hub) Add(id string, fn func(Task) error)

func (*Hub) Status

func (h *Hub) Status(id string) Status

type Progress

type Progress struct {
	Numerator, Denominator int
}

func (Progress) Percent

func (p Progress) Percent() int

type State

type State int
const (
	Waiting State = iota
	Running
	Done
	Failed
)

type Status

type Status struct {
	State     State
	Progress  Progress
	Error     error
	StartTime time.Time
	EndTime   time.Time
}

func (Status) Done

func (s Status) Done() bool

func (Status) Failed

func (s Status) Failed() bool

func (Status) Running

func (s Status) Running() bool

func (Status) Waiting

func (s Status) Waiting() bool

type Task

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

func (Task) Progress

func (t Task) Progress(num int, denom int)

Jump to

Keyboard shortcuts

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