loadbalance

package
v0.0.0-...-33372f1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterLbAlgo

func RegisterLbAlgo(name string, lb LoadBalance)

Types

type Instance

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

func DoLB

func DoLB(name string, insts []*Instance, key ...string) (inst *Instance, err error)

func NewInstance

func NewInstance(host string, port int) *Instance

func (*Instance) GetHost

func (p *Instance) GetHost() string

func (*Instance) GetPort

func (p *Instance) GetPort() int

type LbManager

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

type LoadBalance

type LoadBalance interface {
	DoBalance([]*Instance, ...string) (inst *Instance, err error)
}

type RandomBalance

type RandomBalance struct {
}

func (*RandomBalance) DoBalance

func (sp *RandomBalance) DoBalance(insts []*Instance, key ...string) (inst *Instance, err error)

type RoundRobinBalance

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

func (*RoundRobinBalance) DoBalance

func (sp *RoundRobinBalance) DoBalance(insts []*Instance, key ...string) (inst *Instance, err error)

Jump to

Keyboard shortcuts

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