balancer

package
v3.25.0-rc0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOkConnection added in v3.25.0

func IsOkConnection(c conn.Conn, bannedIsOk bool) bool

Types

type Balancer

type Balancer interface {
	// Next returns next connection for request.
	Next(ctx context.Context, opts ...NextOption) conn.Conn

	// Create same balancer instance with new connections
	Create(conns []conn.Conn) Balancer
}

Balancer is an interface that implements particular load-balancing algorithm.

Balancer methods called synchronized. That is, implementations must not provide additional goroutine safety.

type NextOption added in v3.25.0

type NextOption func(o *NextOptions)

func WithAcceptBanned added in v3.25.0

func WithAcceptBanned(val bool) NextOption

func WithOnBadState added in v3.25.0

func WithOnBadState(callback OnBadStateCallback) NextOption

type NextOptions added in v3.25.0

type NextOptions struct {
	OnBadState   OnBadStateCallback
	AcceptBanned bool
}

func MakeNextOptions added in v3.25.0

func MakeNextOptions(opts ...NextOption) NextOptions

func (*NextOptions) Discovery added in v3.25.0

func (o *NextOptions) Discovery(ctx context.Context)

type OnBadStateCallback added in v3.25.0

type OnBadStateCallback func(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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