job

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DispatchStatus

type DispatchStatus struct {
	Type   string
	ID     uint64
	Status string
}

type Dispatcher

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

func CreateNewDispatcher

func CreateNewDispatcher() *Dispatcher

func (*Dispatcher) AddJob

func (d *Dispatcher) AddJob(je JobExecutable, repeat bool, repeatCount int, repeatCounter int)

func (*Dispatcher) Finished

func (d *Dispatcher) Finished() bool

func (*Dispatcher) Start

func (d *Dispatcher) Start(numWorkers uint64)

type Job

type Job struct {
	ID            uint64 `json:"id"`
	IsRepeatable  bool
	RepeatCount   int
	RepeatCounter int
	F             func() error
}

type JobExecutable

type JobExecutable func() error

type Worker

type Worker struct {
	ID uint64

	Quit       chan bool
	Dispatcher *Dispatcher
	// contains filtered or unexported fields
}

func CreateNewWorker

func CreateNewWorker(d *Dispatcher, id uint64, workerQueue chan *Worker, jobQueue chan *Job, dStatus chan *DispatchStatus) *Worker

func (*Worker) Start

func (w *Worker) Start()

Jump to

Keyboard shortcuts

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