Select is a better method

This commit is contained in:
Asim 2015-12-08 00:11:51 +00:00
parent 727bba15b8
commit 3d279ffcfd
4 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ import (
// response from a client call. Reset is called to zero out
// any state.
type NodeSelector interface {
Retrieve(context.Context, Request) (*registry.Node, error)
Select(context.Context, Request) (*registry.Node, error)
Response(*registry.Node, error)
Reset()
}
@ -30,7 +30,7 @@ type nodeSelector struct {
r registry.Registry
}
func (n *nodeSelector) Retrieve(ctx context.Context, req Request) (*registry.Node, error) {
func (n *nodeSelector) Select(ctx context.Context, req Request) (*registry.Node, error) {
service, err := n.r.GetService(req.Service())
if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error())

View File

@ -59,7 +59,7 @@ func TestNodeSelector(t *testing.T) {
}
for i := 0; i < 100; i++ {
n, err := n.Retrieve(context.Background(), newRpcRequest("foo", "Foo.Bar", nil, ""))
n, err := n.Select(context.Background(), newRpcRequest("foo", "Foo.Bar", nil, ""))
if err != nil {
t.Errorf("Expected node, got err: %v", err)
}

View File

@ -154,7 +154,7 @@ func (r *rpcClient) CallRemote(ctx context.Context, address string, request Requ
// TODO: Call(..., opts *Options) error {
func (r *rpcClient) Call(ctx context.Context, request Request, response interface{}) error {
node, err := r.sel.Retrieve(ctx, request)
node, err := r.sel.Select(ctx, request)
if err != nil {
return err
}
@ -174,7 +174,7 @@ func (r *rpcClient) StreamRemote(ctx context.Context, address string, request Re
}
func (r *rpcClient) Stream(ctx context.Context, request Request, responseChan interface{}) (Streamer, error) {
node, err := r.sel.Retrieve(ctx, request)
node, err := r.sel.Select(ctx, request)
if err != nil {
return nil, err
}

View File

@ -22,7 +22,7 @@ type nodeSelector struct {
r registry.Registry
}
func (n *nodeSelector) Retrieve(ctx context.Context, req client.Request) (*registry.Node, error) {
func (n *nodeSelector) Select(ctx context.Context, req client.Request) (*registry.Node, error) {
service, err := n.r.GetService(req.Service())
if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error())