balance

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Random     = "random"
	Poll       = "poll"
	WeightPoll = "weight_poll"
)

Variables

This section is empty.

Functions

func Register

func Register(name string, b Balancer)

Register 注册负载均衡器.

Types

type Balancer

type Balancer interface {
	Get(*selector.ServiceNodes) *selector.Node
}

func Get

func Get(name string) Balancer

type Options

type Options struct {
	BalancerName string `yaml:"name"`
}

type Picker

type Picker interface {
	// contains filtered or unexported methods
}

type PollBalancer

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

PollBalancer 轮询负载均衡器.

func (*PollBalancer) Get

Get 选择合适的选择器来进行选择.

type RandomBalancer

type RandomBalancer struct {
}

RandomBalancer 获取随机结点的负载均衡.

func (*RandomBalancer) Get

Get 通过时间戳随机生成一个随机数,

type WeightPollBalancer

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

func (*WeightPollBalancer) Get

Get 获取具体选择器再通过选择器pick到具体结点.

Jump to

Keyboard shortcuts

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