jobs

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const BootstrappedDispatcher = "BootstrappedDispatcher"

BootstrappedDispatcher is a key to access dispatcher

Variables

This section is empty.

Functions

This section is empty.

Types

type Base added in v1.3.0

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

Base can be embeded to implement base interface functions.

func NewBase added in v1.3.0

func NewBase(tasks map[string]Task) Base

NewBase returns a new base with given tasks

func (Base) Next added in v1.3.0

func (b Base) Next(task string) (next string, ok bool)

Next returns the next task, if there is any, after the given task

func (Base) RunnerFunc added in v1.3.0

func (b Base) RunnerFunc(task string) gocelery.RunnerFunc

RunnerFunc returns runner func associated with the task

type Bootstrapper added in v1.3.0

type Bootstrapper struct{}

Bootstrapper implements bootstrap.Bootstrapper.

func (Bootstrapper) Bootstrap added in v1.3.0

func (b Bootstrapper) Bootstrap(ctx map[string]interface{}) error

Bootstrap adds transaction.Repository into context.

type Dispatcher added in v1.3.0

type Dispatcher interface {
	Name() string
	Start(ctx context.Context, wg *sync.WaitGroup, startupErr chan<- error)
	RegisterRunner(name string, runner gocelery.Runner) bool
	RegisterRunnerFunc(name string, runnerFunc gocelery.RunnerFunc) bool
	Dispatch(acc identity.DID, job *gocelery.Job) (Result, error)
	Job(acc identity.DID, jobID gocelery.JobID) (*gocelery.Job, error)
	Result(acc identity.DID, jobID gocelery.JobID) (Result, error)
}

Dispatcher is a task dispatcher

func NewDispatcher added in v1.3.0

func NewDispatcher(db *leveldb.DB, workerCount int, requeueTimeout time.Duration) (Dispatcher, error)

NewDispatcher returns a new dispatcher with levelDB storage

type Result added in v1.3.0

type Result interface {
	// Await blocks until job is finished to return its results.
	Await(ctx context.Context) (res interface{}, err error)
}

Result represents a future result of a job

type Task added in v1.3.0

type Task struct {
	RunnerFunc gocelery.RunnerFunc
	Next       string
}

Task represents a single task and if chained, next task name

Jump to

Keyboard shortcuts

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