lb

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotDialer = fmt.Errorf("error not dialer")
)

Functions

func NewLBWithConfig

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

Types

type Config

type Config struct {
	Policy  LoadBalancePolicyEnum `json:",omitempty"`
	Dialers []*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.Dialer) *Random

func NewRoundRobin

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

func (*Random) DialStream

func (r *Random) DialStream(ctx context.Context) (stream.Stream, error)

type RoundRobin

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

func (*RoundRobin) DialStream

func (r *RoundRobin) DialStream(ctx context.Context) (stream.Stream, error)

type Weight

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

Jump to

Keyboard shortcuts

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