lb

package
v2.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LBS map loadBalance name and process function
	LBS = map[metapb.LoadBalance]func() LoadBalance{
		metapb.RoundRobin: NewRoundRobin,
	}
)

Functions

func GetSupportLBS

func GetSupportLBS() []metapb.LoadBalance

GetSupportLBS return supported loadBalances

Types

type LoadBalance

type LoadBalance interface {
	Select(req *fasthttp.Request, servers *list.List) int
}

LoadBalance loadBalance interface

func NewLoadBalance

func NewLoadBalance(name metapb.LoadBalance) LoadBalance

NewLoadBalance create a LoadBalance

func NewRoundRobin

func NewRoundRobin() LoadBalance

NewRoundRobin create a RoundRobin

type RoundRobin

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

RoundRobin round robin loadBalance impl

func (RoundRobin) Select

func (rr RoundRobin) Select(req *fasthttp.Request, servers *list.List) int

Select select a server from servers using RoundRobin

Jump to

Keyboard shortcuts

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