lb

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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