dispatcher

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init initializes global parameters of dispatchers by configuration values.

Configuration keys prefixed by "dispatch_" are considered.

Types

type Config

type Config struct {
	MinBufferSize uint
	Kicker        kicker.Config
	Worker        worker.Config
}

Config contains information to create a dispatcher instance.

func (Config) Start

func (cfg Config) Start(q JobQueue, m *model.Queue) Dispatcher

Start creates and starts a new dispatcher instance with the current configuration.

The instance watches a queue specified by q in a way specified by m.

type Dispatcher

type Dispatcher interface {
	Stats() *Stats
	PollingInterval() uint
	MaxWorkers() uint
	MaxDispatchesPerSecond() float64
	MaxBurstSize() int
	Ping()
	Stop() <-chan struct{}
}

Dispatcher is an interface of dispatchers for some queue.

func Start

func Start(q JobQueue, m *model.Queue) Dispatcher

Start creates and starts a new dispatcher instance with the default configuration.

type JobQueue

type JobQueue interface {
	Pop(limit uint) ([]jobqueue.Job, error)
	Complete(job jobqueue.Job, res *jobqueue.Result)
	Name() string
}

JobQueue is an interface of a queue which can be watched by dispatchers.

type Stats

type Stats struct {
	OutstandingJobs int64 `json:"outstanding_jobs"`
	TotalWorkers    int64 `json:"total_workers"`
	IdleWorkers     int64 `json:"idle_workers"`
}

Stats contains statistics of a dispatcher.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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