lb

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotHandler = fmt.Errorf("error not handler")
)

Functions

func NewLBWithConfig

func NewLBWithConfig(conf *Config) (stream.Handler, error)

Types

type Config

type Config struct {
	Policy   LoadBalancePolicyEnum `json:",omitempty"`
	Handlers []*Weight
}

type LoadBalancePolicyEnum

type LoadBalancePolicyEnum string
const (
	EnumRoundRobin LoadBalancePolicyEnum = "round_robin"
	EnumRandom     LoadBalancePolicyEnum = "random"
)

type Random

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

func NewRandom

func NewRandom(handlers []stream.Handler) *Random

func NewRoundRobin

func NewRoundRobin(handlers []stream.Handler) *Random

func (*Random) ServeStream

func (r *Random) ServeStream(ctx context.Context, stm stream.Stream)

type RoundRobin

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

func (*RoundRobin) ServeStream

func (r *RoundRobin) ServeStream(ctx context.Context, stm stream.Stream)

type Weight

type Weight struct {
	Weight  uint `json:",omitempty"`
	Handler stream.Handler
}

Jump to

Keyboard shortcuts

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