balancer

package
v0.0.0-...-d5b31fc Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 2 Imported by: 0

README

Balancer

a generic balancer by RR or Weighted

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	Next([]Item) Item
}

Balancer is a generic balancer

func NewRR

func NewRR() Balancer

NewRR is exported

func NewWeight

func NewWeight() Balancer

NewWeight is exported

type Item

type Item interface {
	WeightN() int
}

Item is a generic item to be selected

note: the Weight is no use for rrBalancer, only used for weightBalancer and any negative weight value will be treated as positive. the weight value 0 means the item was disabled, if all of iteams weight equals 0, Next() return nil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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