Version: v3.0.0 Latest Latest

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 0



Package selector is for node selection and load balancing



This section is empty.


View Source
var (
	// ErrNoneAvailable is returned by select when no routes were provided to select from
	ErrNoneAvailable = errors.New("none available")


func Tests

func Tests(t *testing.T, s Selector)

Tests runs all the tests against a selector to ensure the implementations are consistent


type Next

type Next func() string

Next returns the next node

type Option

type Option func(*Options)

Option updates the options

type Options

type Options struct{}

Options used to configure a selector

type SelectOption

type SelectOption func(*SelectOptions)

SelectOption updates the select options

type SelectOptions

type SelectOptions struct{}

SelectOptions used to configure selection

func NewSelectOptions

func NewSelectOptions(opts ...SelectOption) SelectOptions

NewSelectOptions parses select options

type Selector

type Selector interface {
	// Select a route from the pool using the strategy
	Select([]string, ...SelectOption) (Next, error)
	// Record the error returned from a route to inform future selection
	Record(string, error) error
	// Reset the selector
	Reset() error
	// String returns the name of the selector
	String() string

Selector selects a route from a pool


Path Synopsis

Jump to

Keyboard shortcuts

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