tasks

package
v0.0.0-...-6397e43 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package tasks implements a basic task queue.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTaskExecuter = NewTaskExecuter(time.Hour * 24)

DefaultTaskExecuter is an instance of a NewTaskExecuter with a 24-hour expiration.

Functions

This section is empty.

Types

type Status

type Status int

Status is the status of the task.

const (
	INPROGRESS Status = iota
	SUCCESS
	FAILURE
	NOTFOUND
)

These are some enumerated Status constants. INPROGRESS: Task is still in progress. SUCCESS: Task finished successfully. FAILURE: Task finished unsuccessfully. NOTFOUND: Task could not be found.

func (Status) String

func (s Status) String() string

type TaskExecuter

type TaskExecuter interface {
	QueueTask(task func(string) error, onFailure func(string, string)) string
	GetTaskStatus(id string) Status
	// contains filtered or unexported methods
}

TaskExecuter executes a series of task functions.

func NewTaskExecuter

func NewTaskExecuter(expiration time.Duration) TaskExecuter

NewTaskExecuter returns a TaskExecuter ready to execute. Information for a task is deleted after expiration.

Jump to

Keyboard shortcuts

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