balancer

package
v0.2.1-0...-0bb5118 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: GPL-3.0-or-later Imports: 5 Imported by: 0

Documentation

Overview

Package balancer implements a capacity based load balancer where each entity periodically reports its actual processing capacity and the balancer issues requests based on those numbers.

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
}

The load balancer for a single topic.

func New

func New() *Balancer

Creates a new - empty - load balancer.

func (*Balancer) Balance

func (b *Balancer) Balance(ex *big.Int) (*big.Int, error)

Returns an id to which to send the next message to. The optional ex (can be nil) is used to exclude an entity from balancing to (if it's the only one available then this guarantee will be forfeit).

func (*Balancer) Capacity

func (b *Balancer) Capacity(ex *big.Int) int

Returns the total capacity that the balancer can handle, optionally with ex excluded from the count.

func (*Balancer) Register

func (b *Balancer) Register(id *big.Int)

Registers an entity to load balance to (no duplicate checks are done).

func (*Balancer) Unregister

func (b *Balancer) Unregister(id *big.Int)

Unregisters an entity from the possible balancing destinations.

func (*Balancer) Update

func (b *Balancer) Update(id *big.Int, cap int) error

Updates an entry's capacity to cap.

Jump to

Keyboard shortcuts

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