micro/selector/selector.go
Vasiliy Tolstov ebd8ddf05b move to v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-04-11 22:21:25 +03:00

25 lines
708 B
Go

// Package selector is for node selection and load balancing
package selector // import "go.unistack.org/micro/v4/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