balancer

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInputNotSlice   = errors.New("Input value is not silice")
	ErrNoAvaliableNode = errors.New("No nodes avaliable")
)

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	NextPeer(nodes interface{}) (error, interface{})
}

func NewBalancer

func NewBalancer(strategy string) Balancer

NewBalancer 根据策略标识返回新的负载均衡器

type RoundRobin

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

func (*RoundRobin) NextIndex

func (r *RoundRobin) NextIndex(total int) int

NextIndex 返回下一个节点下标

func (*RoundRobin) NextPeer

func (r *RoundRobin) NextPeer(nodes interface{}) (error, interface{})

NextPeer 返回轮盘的下一节点

Jump to

Keyboard shortcuts

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