micro/selector/selector.go
Vasiliy Tolstov 86626c5922 fieldalignment of all structs to save memory
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-27 08:32:47 +03:00

25 lines
662 B
Go

// Package selector is for node selection and load balancing
package 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