task

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Overview

Package task provides an interface for distributed jobs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name string
	Func func() error
}

Command to be executed

func (Command) Execute

func (c Command) Execute() error

func (Command) String

func (c Command) String() string

type Option

type Option func(o *Options)

func WithPool

func WithPool(i int) Option

WithPool sets the pool size for concurrent work

type Options

type Options struct {
	// Pool size for workers
	Pool int
	// Alternative options
	Context context.Context
}

type Schedule

type Schedule struct {
	// When to start the schedule. Zero time means immediately
	Time time.Time
	// Non zero interval dictates an ongoing schedule
	Interval time.Duration
}

Schedule represents a time or interval at which a task should run

func (Schedule) Run

func (s Schedule) Run() <-chan time.Time

func (Schedule) String

func (s Schedule) String() string

type Task

type Task interface {
	// Run runs a command immediately until completion
	Run(Command) error
	// Status provides status of last execution
	Status() string
}

Task represents a distributed task

Directories

Path Synopsis
Package broker provides a distributed task manager built on the micro broker
Package broker provides a distributed task manager built on the micro broker
Package local provides a local task runner
Package local provides a local task runner

Jump to

Keyboard shortcuts

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