selector

package
v3.0.0 Latest Latest
Warning

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

Documentation

Overview

Package selector is for node selection and load balancing

Index

Constants

This section is empty.

Variables

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

Functions

func Tests

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

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

Types

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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