loadbalance

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyLoadBalancer = errors.New("empty load balancer")

Functions

This section is empty.

Types

type LoadBalancer

type LoadBalancer[E any] interface {
	Len() int
	Next() E
	Ring() *container.Ring[*E]
	Link(LoadBalancer[E]) LoadBalancer[E]
	Unlink(int) LoadBalancer[E]
}

func Random

func Random[E any](items ...E) LoadBalancer[E]

func RoundRobin

func RoundRobin[E any](items ...E) LoadBalancer[E]

func WeightedRandom

func WeightedRandom[E any](items ...Weighted[E]) LoadBalancer[E]

func WeightedRoundRobin

func WeightedRoundRobin[E any](items ...Weighted[E]) LoadBalancer[E]

type Weighted

type Weighted[E any] struct {
	Item   E
	Weight int
}

Jump to

Keyboard shortcuts

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