queue

package
v0.0.0-...-9e59f10 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JobQueue chan Queuable

JobQueue ... a buffered channel that we can send work requests on.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	WorkerPool chan chan Queuable
	Workers    []Worker
	// contains filtered or unexported fields
}

Dispatcher ... worker dispatcher

func NewDispatcher

func NewDispatcher(maxWorkers int) *Dispatcher

NewDispatcher ... creates new queue dispatcher

func (*Dispatcher) Run

func (d *Dispatcher) Run()

Run ... starts work of dispatcher and creates the workers

type Queuable

type Queuable interface {
	Handle() error
}

Queuable ... interface of Queuable Job

type Worker

type Worker struct {
	Name       string
	WorkerPool chan chan Queuable
	JobChannel chan Queuable
	// contains filtered or unexported fields
}

Worker … simple worker that handles queueable tasks

func NewWorker

func NewWorker(workerPool chan chan Queuable) Worker

NewWorker --

func (Worker) Start

func (w Worker) Start()

Start ... initiate worker to start listening for upcoming queueable jobs

Jump to

Keyboard shortcuts

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