cleanup client/selector/lookup (#1937)

* cleanup client/selector/lookup

* add mdns router, remove registry from client

* fix roundtripper

* remove comment

* fix compile issue

* fix mucp test

* fix api router
This commit is contained in:
Asim Aslam
2020-08-17 22:44:45 +01:00
committed by GitHub
parent 7135787b78
commit 50ec6c748f
17 changed files with 398 additions and 418 deletions

View File

@@ -3,35 +3,24 @@ package selector
import (
"errors"
"github.com/micro/go-micro/v3/router"
)
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")
)
// Selector selects a route from a pool
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)
Select([]string, ...SelectOption) (Next, error)
// Record the error returned from a route to inform future selection
Record(router.Route, error) error
// Close the selector
Close() error
Record(string, error) error
// Reset the selector
Reset() error
// String returns the name of the selector
String() string
}
// NewSelector creates new selector and returns it
func NewSelector(opts ...Option) Selector {
return newSelector(opts...)
}
// Next returns the next node
type Next func() string