balance

package
v0.0.0-...-514d410 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

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

func New

func New(opts ...BalancerOption) (*Balancer, error)

func (*Balancer) GetMembers

func (b *Balancer) GetMembers() []*server.Member

func (*Balancer) Pick

func (b *Balancer) Pick() (*server.Member, error)

func (*Balancer) Register

func (b *Balancer) Register(servers ...server.Server)

func (*Balancer) Shutdown

func (b *Balancer) Shutdown()

func (*Balancer) Validate

func (b *Balancer) Validate() error

type BalancerOption

type BalancerOption func(*option)

func AddCustomMetrics

func AddCustomMetrics(
	entries ...metrics.MetricEntry,
) BalancerOption

func EnableDiscovery

func EnableDiscovery(
	interval time.Duration,
	resolver resolve.Resolver,
) BalancerOption

func EnableHealthcheck

func EnableHealthcheck(
	interval time.Duration,
	fn healthcheck.HealthcheckFn,
) BalancerOption

func WithBalancerAlgorithm

func WithBalancerAlgorithm(algorithm algorithm.Algorithm) BalancerOption

func WithFilterFnList

func WithFilterFnList(funcs ...filter.FilterFn) BalancerOption

func WithZapLogger

func WithZapLogger(logger *zap.Logger) BalancerOption

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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