micro/selector/selector.go
Vasiliy Tolstov 5eb0e56373 move all imports to own domain
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-02 19:55:07 +03:00

25 lines
708 B
Go

// Package selector is for node selection and load balancing
package selector // import "go.unistack.org/micro/v3/selector"
import (
"errors"
)
// ErrNoneAvailable is returned by select when no routes were provided to select from
var ErrNoneAvailable = errors.New("none available")
// Selector selects a route from a pool
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
}
// Next returns the next node
type Next func() string