Documentation
¶
Overview ¶
Package selector is for node selection and load balancing
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultSelector is the default selector DefaultSelector = NewSelector() // ErrNoneAvailable is returned by select when no routes were provided to select from ErrNoneAvailable = errors.New("none available") )
Functions ¶
Types ¶
type SelectOptions ¶
type SelectOptions struct {
Filters []Filter
}
SelectOptions used to configure selection
func NewSelectOptions ¶
func NewSelectOptions(opts ...SelectOption) SelectOptions
NewSelectOptions parses select options
type Selector ¶
type Selector interface {
// Init a selector with options
Init(...Option) error
// Options the selector is using
Options() Options
// Select a route from the pool using the strategy
Select([]router.Route, ...SelectOption) (*router.Route, error)
// Record the error returned from a route to inform future selection
Record(router.Route, error) error
// Close the selector
Close() error
// String returns the name of the selector
String() string
}
Selector selects a route from a pool
func NewSelector ¶
NewSelector creates new selector and returns it
Click to show internal directories.
Click to hide internal directories.