balance

package
v0.0.0-...-2bf1368 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintHello

func PrintHello()

func RegisterBalancer

func RegisterBalancer(name string, b Balancer)

Types

type BalanceMgr

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

type Balancer

type Balancer interface {
	DoBalance([]*Instance, ...string) (*Instance, error)
}

type Instance

type Instance struct {
	Host string
	Port int
}

func DoBalance

func DoBalance(name string, insts []*Instance) (inst *Instance, err error)

func (*Instance) GetHost

func (p *Instance) GetHost() string

func (*Instance) GetPost

func (p *Instance) GetPost() int

func (*Instance) NewInstance

func (p *Instance) NewInstance(host string, port int)

func (*Instance) String

func (p *Instance) String() string

type RandomBalance

type RandomBalance struct {
}

func (*RandomBalance) DoBalance

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

type RoundRobinBalance

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

func (*RoundRobinBalance) DoBalance

func (p *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