duty

package
v0.0.0-...-eef338d Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AssignID = ""
View Source
var Default = Options{}

Functions

This section is empty.

Types

type Duty

type Duty struct {
	Storage        storage.Storage
	WorkPool       pool.Pool
	StateKeeper    StateKeeper
	ResultCallback func(pool.ScheduledTaskResult)
}

func New

func New(storage storage.Storage, opt Options) Duty

func (Duty) Close

func (m Duty) Close()

func (Duty) Enqueue

func (m Duty) Enqueue(t task.Task) (task.ScheduledTask, error)

func (Duty) EnqueueWithID

func (m Duty) EnqueueWithID(id string, t task.Task) (task.ScheduledTask, error)

func (Duty) Execute

func (m Duty) Execute(t task.Task) (pool.ScheduledTaskResult, error)

func (Duty) Get

func (m Duty) Get(id string) (task.ScheduledTask, error)

func (Duty) Init

func (m Duty) Init() error

func (Duty) Tasks

func (m Duty) Tasks(id string) ([]task.ScheduledTask, error)

type Options

type Options struct {
	ResultCallback func(pool.ScheduledTaskResult)
	Workers        int
	QueueSize      int
}

type StateKeeper

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

func NewStateKeeper

func NewStateKeeper() StateKeeper

func (*StateKeeper) AddRunningTask

func (sk *StateKeeper) AddRunningTask(task task.ScheduledTask)

func (*StateKeeper) IsRunning

func (sk *StateKeeper) IsRunning(id string) bool

func (*StateKeeper) RemoveRunningTask

func (sk *StateKeeper) RemoveRunningTask(task task.ScheduledTask)

func (*StateKeeper) RunningTasks

func (sk *StateKeeper) RunningTasks() []task.ScheduledTask

Jump to

Keyboard shortcuts

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