task

package
v0.0.0-...-06fc2c1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownJobProvider = fmt.Errorf("unknown job provider")

Functions

func Listen

func Listen(ctx global.Context)

Types

type RmqResult

type RmqResult struct {
	JobID   string     `json:"job_id"`
	Success bool       `json:"success"`
	Files   []job.File `json:"files"`
	Error   string     `json:"error"`
}

type Task

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

func New

func New(ctx context.Context, job job.Job) *Task

func (*Task) Completed

func (t *Task) Completed() bool

func (*Task) Done

func (t *Task) Done() <-chan struct{}

func (*Task) Events

func (t *Task) Events() <-chan TaskEvent

func (*Task) Failed

func (t *Task) Failed() error

func (*Task) Files

func (t *Task) Files() []job.File

func (*Task) ID

func (t *Task) ID() uuid.UUID

func (*Task) Job

func (t *Task) Job() job.Job

func (*Task) Start

func (t *Task) Start(ctx global.Context)

func (*Task) Started

func (t *Task) Started() bool

func (*Task) Stop

func (t *Task) Stop()

func (*Task) Stopped

func (t *Task) Stopped() bool

type TaskEvent

type TaskEvent struct {
	JobID     string
	Type      TaskEventType
	Timestamp time.Time
}

type TaskEventType

type TaskEventType string
const (
	Started            TaskEventType = "started"
	Downloaed          TaskEventType = "downloaded"
	Failed             TaskEventType = "failed"
	Completed          TaskEventType = "completed"
	Stopped            TaskEventType = "stopped"
	Cleaned            TaskEventType = "cleaned"
	StageOne           TaskEventType = "stage-one"
	StageOneComplete   TaskEventType = "stage-one-complete"
	StageTwo           TaskEventType = "stage-two"
	StageTwoComplete   TaskEventType = "stage-two-complete"
	StageThree         TaskEventType = "stage-three"
	StageThreeComplete TaskEventType = "stage-three-complete"
)

Jump to

Keyboard shortcuts

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