worker

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context)

Handler is a worker's handling function.

type Job

type Job struct {
	Disabled    bool
	Immediately bool
	Timer       time.Duration
	Ticker      time.Duration
	Handler     Handler
}

Job groups the parameters of worker's job.

type Jobs

type Jobs map[string]Handler

Jobs is a map of worker names to handlers.

type Workers

type Workers interface {
	Start(context.Context)
	Stop()

	Add(Job Handler)
}

Workers is an interface of worker tool.

func New

func New() Workers

New is a constructor of workers.

Jump to

Keyboard shortcuts

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