taskq

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 5 Imported by: 1

README

TaskQ

Go Report GoDoc Build Status Codecov

Goroutine manager.


Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRetryTask = errors.New("error occurred during task execution. retry task")

Functions

This section is empty.

Types

type RetryableTask

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

func (*RetryableTask) Do

func (t *RetryableTask) Do(ctx context.Context) error

type Status

type Status byte
const (
	None Status = iota
	Pending
	InProgress
	Done
	Failed
)

func TaskStatus

func TaskStatus(task Task) Status

type Task

type Task interface {
	Do(ctx context.Context) error
}

Task for TaskQ

func NewRetryableTask

func NewRetryableTask(task Task, maxRetries int) Task

type TaskFunc

type TaskFunc func(ctx context.Context) error

func (TaskFunc) Do

func (t TaskFunc) Do(ctx context.Context) error

type TaskManager

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

func NewTaskManger

func NewTaskManger(taskQ *TaskQ) *TaskManager

func (*TaskManager) Close

func (m *TaskManager) Close() error

func (*TaskManager) Enqueue

func (m *TaskManager) Enqueue(task Task) int64

func (*TaskManager) Start

func (m *TaskManager) Start() error

func (*TaskManager) Task

func (m *TaskManager) Task(id int64) Task

type TaskQ

type TaskQ struct {
	TaskDone   func(int64, Task)
	TaskFailed func(int64, Task, error)
	// contains filtered or unexported fields
}

func New

func New(size int) *TaskQ

func (*TaskQ) Close

func (t *TaskQ) Close() error

func (*TaskQ) Enqueue

func (t *TaskQ) Enqueue(task Task) int64

func (*TaskQ) Start

func (t *TaskQ) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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