async

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// RegisterJob registers a new Job with the async engine
	RegisterJob(name string, fn JobFn) error
	// SubmitTask submits an idempotent task to the async engine for reliable,
	// asynchronous completion
	SubmitTask(Task) error
	// Run causes the async engine to carry out all of its functions. It blocks
	// until a fatal error is encountered or the context passed to it has been
	// canceled. Run always returns a non-nil error.
	Run(context.Context) error
}

Engine is an interface for a broker-specifc framework for submitting and asynchronously completing provisioning and deprovisioning tasks.

type JobFn added in v0.10.0

type JobFn func(ctx context.Context, task Task) ([]Task, error)

JobFn is the signature for functions that workers can call to asynchronously execute a job

type Task added in v0.10.0

type Task interface {
	GetID() string
	GetJobName() string
	GetArgs() map[string]string
	GetWorkerRejectionCount() int
	IncrementWorkerRejectionCount() int
	ToJSON() ([]byte, error)
	GetExecuteTime() *time.Time
}

Task is an interface to be implemented by types that represent a single asynchronous task

func NewDelayedTask added in v0.10.0

func NewDelayedTask(
	jobName string,
	args map[string]string,
	delay time.Duration,
) Task

NewDelayedTask returns a new task that will fire after a specified duration

func NewScheduledTask added in v0.10.0

func NewScheduledTask(
	jobName string,
	args map[string]string,
	time time.Time,
) Task

NewScheduledTask returns a new task that will fire after a specified time

func NewTask added in v0.10.0

func NewTask(jobName string, args map[string]string) Task

NewTask returns a new task

func NewTaskFromJSON added in v0.10.0

func NewTaskFromJSON(jsonBytes []byte) (Task, error)

NewTaskFromJSON returns a new Task unmarshalled from the provided []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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