selector

package
v3.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 3 Imported by: 2 modules, 1 package

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

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