worker

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, log logger.Log) *worker

Types

type Config

type Config struct {
	Rc      int           // push retries
	Name    string        // worker's name
	Timeout time.Duration // process time limit
}

type Message

type Message struct {
	Msg     []string
	Rch     chan []string
	Timeout time.Duration
}

type Worker

type Worker interface {
	Run()
	Stop()
	SendChannel() chan<- *Message // channel should close after Stop by caller
	RecvChannel() <-chan *Message // channel will automatically close after stop
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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