Balancer

package
v0.0.0-...-432c02d Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2015 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

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

Balancer

func NewBalancer

func NewBalancer() *Balancer

func (*Balancer) Balance

func (b *Balancer) Balance(quit chan bool)

Рабочая функция балансировщика получает аргументом канал уведомлений от главного цикла

func (*Balancer) Init

func (b *Balancer) Init(in chan interface{}, fn JobFunc, workersCount, workersCap byte)

Инициализируем балансировщик. Аргументом получаем канал по которому приходят задания

type JobFunc

type JobFunc func(interface{})

type Pool

type Pool []*Worker

Heap

func (Pool) Len

func (p Pool) Len() int

Workers count in pool

func (Pool) Less

func (p Pool) Less(i, j int) bool

Less - mean worker with lowest jobs count

func (*Pool) Pop

func (p *Pool) Pop() interface{}

Pop Job

func (*Pool) Push

func (p *Pool) Push(x interface{})

Push Job

func (Pool) Swap

func (p Pool) Swap(i, j int)

Swap

type Worker

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

Jump to

Keyboard shortcuts

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