task

package
v0.0.0-...-e53a3c9 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	// Name of the task, for logging purposes
	Name string
	// contains filtered or unexported fields
}

Common fields for task

func (*Task) IsRunning

func (t *Task) IsRunning() bool

IsRunning returns whether task is running or not

func (*Task) SetLoop

func (t *Task) SetLoop(loop func())

func (*Task) Start

func (t *Task) Start() error

Start starts task. If task is already running, or task loop is missing, task returns error

func (*Task) Stop

func (t *Task) Stop() error

Stop stops task. If task is not running, return error

func (*Task) StopChan

func (t *Task) StopChan() chan bool

StopChan returns stop channel that receives value when task stop is called

type Tasker

type Tasker interface {
	Start() error
	Stop() error
}

Tasker can be run on background

Source Files

  • task.go

Jump to

Keyboard shortcuts

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