diff --git a/client/selector/router/router.go b/client/selector/router/router.go index 7f391f5b..1c03b9ec 100644 --- a/client/selector/router/router.go +++ b/client/selector/router/router.go @@ -11,7 +11,6 @@ import ( "github.com/micro/go-micro/client/selector" "github.com/micro/go-micro/network/router" pb "github.com/micro/go-micro/network/router/proto" - "github.com/micro/go-micro/network/router/table" "github.com/micro/go-micro/registry" ) @@ -41,11 +40,11 @@ type clientKey struct{} type routerKey struct{} // getRoutes returns the routes whether they are remote or local -func (r *routerSelector) getRoutes(service string) ([]table.Route, error) { +func (r *routerSelector) getRoutes(service string) ([]router.Route, error) { if !r.remote { // lookup router for routes for the service - return r.r.Lookup(table.NewQuery( - table.QueryService(service), + return r.r.Lookup(router.NewQuery( + router.QueryService(service), )) } @@ -102,11 +101,11 @@ func (r *routerSelector) getRoutes(service string) ([]table.Route, error) { return nil, selector.ErrNoneAvailable } - var routes []table.Route + var routes []router.Route // convert from pb to []*router.Route for _, r := range pbRoutes.Routes { - routes = append(routes, table.Route{ + routes = append(routes, router.Route{ Service: r.Service, Address: r.Address, Gateway: r.Gateway, diff --git a/network/proxy/mucp/mucp.go b/network/proxy/mucp/mucp.go index 10e3669b..d70c4f77 100644 --- a/network/proxy/mucp/mucp.go +++ b/network/proxy/mucp/mucp.go @@ -15,8 +15,6 @@ import ( "github.com/micro/go-micro/network/proxy" "github.com/micro/go-micro/network/router" "github.com/micro/go-micro/server" - - "github.com/micro/go-micro/network/router/table" ) // Proxy will transparently proxy requests to an endpoint. @@ -36,7 +34,7 @@ type Proxy struct { // A fib of routes service:address sync.RWMutex - Routes map[string]map[uint64]table.Route + Routes map[string]map[uint64]router.Route // The channel to monitor watcher errors errChan chan error @@ -78,7 +76,7 @@ func readLoop(r server.Request, s client.Stream) error { } // toNodes returns a list of node addresses from given routes -func toNodes(routes map[uint64]table.Route) []string { +func toNodes(routes map[uint64]router.Route) []string { var nodes []string for _, node := range routes { address := node.Address @@ -98,7 +96,7 @@ func (p *Proxy) getRoute(service string) ([]string, error) { p.Unlock() return toNodes(routes), nil } - p.Routes[service] = make(map[uint64]table.Route) + p.Routes[service] = make(map[uint64]router.Route) p.Unlock() // if the router is broken return error @@ -107,7 +105,7 @@ func (p *Proxy) getRoute(service string) ([]string, error) { } // lookup the routes in the router - results, err := p.Router.Lookup(table.NewQuery(table.QueryService(service))) + results, err := p.Router.Lookup(router.NewQuery(router.QueryService(service))) if err != nil { return nil, err } @@ -124,11 +122,11 @@ func (p *Proxy) getRoute(service string) ([]string, error) { } // manageRouteCache applies action on a given route to Proxy route cache -func (p *Proxy) manageRouteCache(route table.Route, action string) error { +func (p *Proxy) manageRouteCache(route router.Route, action string) error { switch action { case "create", "update": if _, ok := p.Routes[route.Service]; !ok { - p.Routes[route.Service] = make(map[uint64]table.Route) + p.Routes[route.Service] = make(map[uint64]router.Route) } p.Routes[route.Service][route.Hash()] = route case "delete": @@ -317,7 +315,7 @@ func NewProxy(opts ...options.Option) proxy.Proxy { } // routes cache - p.Routes = make(map[string]map[uint64]table.Route) + p.Routes = make(map[string]map[uint64]router.Route) // watch router service routes p.errChan = make(chan error, 1)