task

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status string

Status represents current status of a task.

const (
	TaskNotStarted Status = "not-started"
	TaskRunning    Status = "running"
	TaskPaused     Status = "paused"
	TaskTerminated Status = "terminated"
	TaskGotError   Status = "got-error"
	TaskFinished   Status = "finished"
)

Various possible task status.

type Task

type Task struct {
	ID       string
	FilePath string
	State    Status
	Err      error
	// contains filtered or unexported fields
}

Task represents a processing task in our system.

func NewTask

func NewTask(id, path string) *Task

NewTask returns an initialized instance of task.

func (*Task) Pause

func (t *Task) Pause()

Pause function pauses a running task. If task is not running it doesn't have any effect.

func (*Task) Resume

func (t *Task) Resume()

Resume function resumes a paused task. If task is not paused it doesn't have any effect.

func (*Task) Run

func (t *Task) Run()

Run is used to start the task. No effect if task is not in not started status.

func (*Task) Terminate

func (t *Task) Terminate()

Terminate will kill the running/paused task. Doesn't have any effect on already finished/terminated tasks.

Jump to

Keyboard shortcuts

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