loadbalancer

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoundRobin              string = "round_robin"
	WeightedRoundRobin      string = "weighted_round_robin"
	LeastConnection         string = "least_conn"
	WeightedLeastConnection string = "weighted_least_conn"
	Random                  string = "random"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LeastConnPolicy added in v0.0.26

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

func NewLeastConnLoadBalancer added in v0.0.26

func NewLeastConnLoadBalancer(targets []string, weights []int) *LeastConnPolicy

func (*LeastConnPolicy) ChooseTarget added in v0.0.26

func (p *LeastConnPolicy) ChooseTarget(_ []string) string

func (*LeastConnPolicy) Done added in v0.0.26

func (p *LeastConnPolicy) Done(target string)

type LoadBalancer

type LoadBalancer interface {
	ChooseTarget(targets []string) string
	Done(target string)
}

type RandomPolicy added in v0.0.26

type RandomPolicy struct{}

func NewRandomLoadBalancer added in v0.0.26

func NewRandomLoadBalancer() *RandomPolicy

func (*RandomPolicy) ChooseTarget added in v0.0.26

func (p *RandomPolicy) ChooseTarget(targets []string) string

func (*RandomPolicy) Done added in v0.0.26

func (p *RandomPolicy) Done(_ string)

type RoundRobinPolicy

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

func NewRoundRobinLoadBalancer added in v0.0.26

func NewRoundRobinLoadBalancer() *RoundRobinPolicy

func (*RoundRobinPolicy) ChooseTarget

func (p *RoundRobinPolicy) ChooseTarget(targets []string) string

func (*RoundRobinPolicy) Done added in v0.0.26

func (p *RoundRobinPolicy) Done(_ string)

type WeightedRoundRobinPolicy added in v0.0.26

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

func NewWRoundRobinLoadBalancer added in v0.0.26

func NewWRoundRobinLoadBalancer(weights []int) *WeightedRoundRobinPolicy

func (*WeightedRoundRobinPolicy) ChooseTarget added in v0.0.26

func (p *WeightedRoundRobinPolicy) ChooseTarget(targets []string) string

func (*WeightedRoundRobinPolicy) Done added in v0.0.26

func (p *WeightedRoundRobinPolicy) Done(_ string)

Jump to

Keyboard shortcuts

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