slaves

package
v0.0.0-...-a5c5f28 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPoolOpened occurs when pool have been opened
	// twice
	ErrPoolOpened = errors.New("pool have been opened")
)

Functions

This section is empty.

Types

type SlavePool

type SlavePool struct {
	Slaves []*slave.Slave
}

SlavePool object

func MakePool

func MakePool(num uint, work func(interface{}) interface{},
	after func(interface{})) SlavePool

MakePool creates a pool and initialise Slaves num is the number of Slaves work is the function to execute in the Slaves after the function to execute after execution of work

func (*SlavePool) Close

func (sp *SlavePool) Close()

Close closes the pool waiting the end of all jobs

func (*SlavePool) Len

func (sp *SlavePool) Len() int

Len Gets the length of the slave array

func (*SlavePool) Open

func (sp *SlavePool) Open() error

Open open all Slaves

func (*SlavePool) SendWork

func (sp *SlavePool) SendWork(job interface{})

SendWork Send work to the pool. This function get the slave with less number of works and send him the job

func (*SlavePool) WorkQueueLen

func (sp *SlavePool) WorkQueueLen() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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