balance

package
v0.0.0-...-8f0e436 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	// Add 新增负载对象
	Add(interface{})
	// Weight 设置负载对象权重
	Weight(interface{}, int)
	// Remove 移除负载对象
	Remove(interface{})
	// Class 获取负载均衡分类
	Class() Class
	// Acquire 执行负载均衡算法得到期望对象
	Acquire() (interface{}, error)
}

Balancer 负载均衡器

func NewBalance

func NewBalance(c Class) Balancer

NewBalance 新建负载均衡器

type Class

type Class int

Class 负载均衡分类

const (
	// Round 轮询加权负载
	Round Class = iota
	// Random 随机加权负载
	Random
	// Hash hash加权负载
	Hash
	// Smooth 平滑加权负载
	Smooth
)

Jump to

Keyboard shortcuts

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