loadbalancer

package
v0.0.0-...-9704ce3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalityPrioritySelector

func LocalityPrioritySelector(src *mesh2.Client, dest *mesh2.Node) uint32

func NewRoundRobin

func NewRoundRobin(conns []*WeightedConnection) network.Connection

Types

type EDF

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

EDF implements the Earliest Deadline First scheduling algorithm

func NewEDF

func NewEDF() *EDF

NewEDF create a new edf scheduler

func (*EDF) Add

func (e *EDF) Add(weight float64, value any)

Add a new entry for load balance

func (*EDF) PickAndAdd

func (e *EDF) PickAndAdd(calcWeight func(prevWeight float64, value any) float64) any

PickAndAdd picks an available entry and re-adds it with the given weight calculation

type Entry

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

Entry is an item for load balance

type LeastRequestSettings

type LeastRequestSettings struct {
	Connections       []*WeightedConnection
	ActiveRequestBias float64
}

type PrioritySelector

type PrioritySelector func(src *mesh2.Client, dest *mesh2.Node) uint32

type WeightedConnection

type WeightedConnection struct {
	network2.Connection
	Weight uint32
}

type WeightedConnectionFactory

type WeightedConnectionFactory func(src *mesh2.Client, n *mesh2.Node) *WeightedConnection

func EquallyWeightedConnectionFactory

func EquallyWeightedConnectionFactory() WeightedConnectionFactory

func PriorityWeightedConnectionFactory

func PriorityWeightedConnectionFactory(selectPriority PrioritySelector, priorityWeightMap map[uint32]uint32) WeightedConnectionFactory

Jump to

Keyboard shortcuts

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