queue

package
v0.0.0-...-d31e6af Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue - A queue for enqueueing tasks to be processed

func NewQueue

func NewQueue(nW int) *Queue

NewQueue - Creates a new Queue

func (*Queue) Start

func (q *Queue) Start()

Start - Starts the worker and dispatcher go routines

func (*Queue) Stop

func (q *Queue) Stop()

Stop - Stopes Queue

func (*Queue) Submit

func (q *Queue) Submit(Task Task)

Submit - Adds a new Task to be processed

type Task

type Task interface {
	Run()
	CheckHeartbeat()
}

Task - Task interface

type Worker

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

Worker - Worker that procresses tasks

func NewWorker

func NewWorker(readyPool chan chan Task, done sync.WaitGroup) *Worker

NewWorker - Creates a new worker

func (*Worker) Start

func (w *Worker) Start()

Start - Begins processing worker's task

func (*Worker) Stop

func (w *Worker) Stop()

Stop - Stops the worker

Jump to

Keyboard shortcuts

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