selector

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeWR   = "wr"
	TypeWrr  = "wrr"
	TypeDwrr = "dwrr"
	TypeP2C  = "p2c"
	TypeICMP = "icmp"
)

Variables

This section is empty.

Functions

func ExtractAddress

func ExtractAddress(address string) (string, int)

func GenerateAddress

func GenerateAddress(host string, port int) string

Types

type HandleInfo

type HandleInfo struct {
	Node Node
	Err  error
}

type Meta

type Meta struct{}

type NewNodeFunc

type NewNodeFunc func(host string, port, weight int, meta Meta) Node

type Node

type Node interface {
	Address() string
	Weight() int
	Meta() Meta
	Statistics() Statistics
}

type Selector

type Selector interface {
	ServiceName() string
	AddNode(node Node) (err error)
	DeleteNode(host string, port int) (err error)
	GetNodes() (nodes []Node, err error)
	GetNode(host string, port int) (node Node, ok bool)
	Select() (node Node, err error)
	AfterHandle(address string, err error)
}

type Statistics

type Statistics struct {
	Success uint64
	Fail    uint64
}

Directories

Path Synopsis
dwrr is Dynamic Weighted Round Robin
dwrr is Dynamic Weighted Round Robin
icmp is load balance by ping rtt
icmp is load balance by ping rtt
p2c is reference https://exceting.github.io/2020/08/13/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1-P2C%E7%AE%97%E6%B3%95/
p2c is reference https://exceting.github.io/2020/08/13/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1-P2C%E7%AE%97%E6%B3%95/
wr is Weighted random
wr is Weighted random
wrr is Weighted Round Robin reference Nginx https://blog.csdn.net/zhangskd/article/details/50194069
wrr is Weighted Round Robin reference Nginx https://blog.csdn.net/zhangskd/article/details/50194069

Jump to

Keyboard shortcuts

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