pool

package
v0.0.0-...-1549436 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("worker already running")
	ErrNotYetRunning  = errors.New("worker not yet running")
)

Functions

This section is empty.

Types

type Pool

type Pool struct {
	Addr    string
	Datadir string
	Compat  bool
	// contains filtered or unexported fields
}

func New

func New(a, d string, ws []Worker) (*Pool, error)

func (*Pool) Register

func (p *Pool) Register(w Worker, s bool) error

func (*Pool) Run

func (p *Pool) Run(a bool) error

func (*Pool) Start

func (p *Pool) Start(n string) error

func (*Pool) Status

func (p *Pool) Status() []State

func (*Pool) Stop

func (p *Pool) Stop(n string) error

func (*Pool) Unregister

func (p *Pool) Unregister(n string) error

type State

type State struct {
	Id      string    `json:"worker"`
	Count   int       `json:"count"`
	Size    int       `json:"size"`
	Running bool      `json:"running"`
	Last    time.Time `json:"last"`
}

type Worker

type Worker interface {
	Run(string, string, bool) error
	Status() State
	io.Closer
	fmt.Stringer
}

Jump to

Keyboard shortcuts

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