Table package is no more, hence removed references to it
This commit is contained in:
		| @@ -11,7 +11,6 @@ import ( | |||||||
| 	"github.com/micro/go-micro/client/selector" | 	"github.com/micro/go-micro/client/selector" | ||||||
| 	"github.com/micro/go-micro/network/router" | 	"github.com/micro/go-micro/network/router" | ||||||
| 	pb "github.com/micro/go-micro/network/router/proto" | 	pb "github.com/micro/go-micro/network/router/proto" | ||||||
| 	"github.com/micro/go-micro/network/router/table" |  | ||||||
| 	"github.com/micro/go-micro/registry" | 	"github.com/micro/go-micro/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -41,11 +40,11 @@ type clientKey struct{} | |||||||
| type routerKey struct{} | type routerKey struct{} | ||||||
|  |  | ||||||
| // getRoutes returns the routes whether they are remote or local | // 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 { | 	if !r.remote { | ||||||
| 		// lookup router for routes for the service | 		// lookup router for routes for the service | ||||||
| 		return r.r.Lookup(table.NewQuery( | 		return r.r.Lookup(router.NewQuery( | ||||||
| 			table.QueryService(service), | 			router.QueryService(service), | ||||||
| 		)) | 		)) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -102,11 +101,11 @@ func (r *routerSelector) getRoutes(service string) ([]table.Route, error) { | |||||||
| 		return nil, selector.ErrNoneAvailable | 		return nil, selector.ErrNoneAvailable | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	var routes []table.Route | 	var routes []router.Route | ||||||
|  |  | ||||||
| 	// convert from pb to []*router.Route | 	// convert from pb to []*router.Route | ||||||
| 	for _, r := range pbRoutes.Routes { | 	for _, r := range pbRoutes.Routes { | ||||||
| 		routes = append(routes, table.Route{ | 		routes = append(routes, router.Route{ | ||||||
| 			Service: r.Service, | 			Service: r.Service, | ||||||
| 			Address: r.Address, | 			Address: r.Address, | ||||||
| 			Gateway: r.Gateway, | 			Gateway: r.Gateway, | ||||||
|   | |||||||
| @@ -15,8 +15,6 @@ import ( | |||||||
| 	"github.com/micro/go-micro/network/proxy" | 	"github.com/micro/go-micro/network/proxy" | ||||||
| 	"github.com/micro/go-micro/network/router" | 	"github.com/micro/go-micro/network/router" | ||||||
| 	"github.com/micro/go-micro/server" | 	"github.com/micro/go-micro/server" | ||||||
|  |  | ||||||
| 	"github.com/micro/go-micro/network/router/table" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Proxy will transparently proxy requests to an endpoint. | // Proxy will transparently proxy requests to an endpoint. | ||||||
| @@ -36,7 +34,7 @@ type Proxy struct { | |||||||
|  |  | ||||||
| 	// A fib of routes service:address | 	// A fib of routes service:address | ||||||
| 	sync.RWMutex | 	sync.RWMutex | ||||||
| 	Routes map[string]map[uint64]table.Route | 	Routes map[string]map[uint64]router.Route | ||||||
|  |  | ||||||
| 	// The channel to monitor watcher errors | 	// The channel to monitor watcher errors | ||||||
| 	errChan chan error | 	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 | // 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 | 	var nodes []string | ||||||
| 	for _, node := range routes { | 	for _, node := range routes { | ||||||
| 		address := node.Address | 		address := node.Address | ||||||
| @@ -98,7 +96,7 @@ func (p *Proxy) getRoute(service string) ([]string, error) { | |||||||
| 		p.Unlock() | 		p.Unlock() | ||||||
| 		return toNodes(routes), nil | 		return toNodes(routes), nil | ||||||
| 	} | 	} | ||||||
| 	p.Routes[service] = make(map[uint64]table.Route) | 	p.Routes[service] = make(map[uint64]router.Route) | ||||||
| 	p.Unlock() | 	p.Unlock() | ||||||
|  |  | ||||||
| 	// if the router is broken return error | 	// 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 | 	// 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 { | 	if err != nil { | ||||||
| 		return nil, err | 		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 | // 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 { | 	switch action { | ||||||
| 	case "create", "update": | 	case "create", "update": | ||||||
| 		if _, ok := p.Routes[route.Service]; !ok { | 		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 | 		p.Routes[route.Service][route.Hash()] = route | ||||||
| 	case "delete": | 	case "delete": | ||||||
| @@ -317,7 +315,7 @@ func NewProxy(opts ...options.Option) proxy.Proxy { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// routes cache | 	// routes cache | ||||||
| 	p.Routes = make(map[string]map[uint64]table.Route) | 	p.Routes = make(map[string]map[uint64]router.Route) | ||||||
|  |  | ||||||
| 	// watch router service routes | 	// watch router service routes | ||||||
| 	p.errChan = make(chan error, 1) | 	p.errChan = make(chan error, 1) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user