bal_slb

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WrrSimple = 0
	WrrSmooth = 1
	WrrSticky = 2
	WlcSimple = 3
	WlcSmooth = 4
)

implementation versions of weighted round-robin algorithm

Variables

This section is empty.

Functions

func GetHash

func GetHash(value []byte, base uint) int

Types

type BackendList

type BackendList []*BackendRR

func (*BackendList) ResetWeight

func (bl *BackendList) ResetWeight()

type BackendListSorter

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

func (BackendListSorter) Len

func (s BackendListSorter) Len() int

func (BackendListSorter) Less

func (s BackendListSorter) Less(i, j int) bool

func (BackendListSorter) Swap

func (s BackendListSorter) Swap(i, j int)

type BackendRR

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

func NewBackendRR

func NewBackendRR() *BackendRR

func (*BackendRR) Init

func (backRR *BackendRR) Init(subClusterName string, conf *cluster_table_conf.BackendConf)

Init initialize BackendRR with BackendConf

func (*BackendRR) MatchAddrPort

func (backRR *BackendRR) MatchAddrPort(addr string, port int) bool

func (*BackendRR) Release

func (backRR *BackendRR) Release()

func (*BackendRR) UpdateWeight

func (backRR *BackendRR) UpdateWeight(weight int)

type BalanceRR

type BalanceRR struct {
	sync.Mutex
	Name string
	// contains filtered or unexported fields
}

func NewBalanceRR

func NewBalanceRR(name string) *BalanceRR

func (*BalanceRR) Balance

func (brr *BalanceRR) Balance(algor int, key []byte) (*backend.BfeBackend, error)

Balance select one backend from sub cluster in round-robin manner.

func (*BalanceRR) Init

Init initializes RRList with config.

func (*BalanceRR) Len

func (brr *BalanceRR) Len() int

func (*BalanceRR) Release

func (brr *BalanceRR) Release()

Release releases backend list.

func (*BalanceRR) SetSlowStart added in v1.1.0

func (brr *BalanceRR) SetSlowStart(ssTime int)

func (*BalanceRR) Update

Update updates BalanceRR with new config.

type WeightSS added in v1.1.0

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

Jump to

Keyboard shortcuts

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