From e8b431c5ffeb9ee26f5eae52804b10a2fd0815f1 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 7 Jan 2019 18:17:13 +0000 Subject: [PATCH] rename codec interface --- client/rpc_codec.go | 8 ++++---- client/rpc_stream.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/rpc_codec.go b/client/rpc_codec.go index 310548a4..7b0a8628 100644 --- a/client/rpc_codec.go +++ b/client/rpc_codec.go @@ -47,8 +47,8 @@ type readWriteCloser struct { } type clientCodec interface { - WriteRequest(*request, interface{}) error - ReadResponse(*response, interface{}) error + Write(*request, interface{}) error + Read(*response, interface{}) error Close() error } @@ -106,7 +106,7 @@ func newRpcCodec(req *transport.Message, client transport.Client, c codec.NewCod return r } -func (c *rpcCodec) WriteRequest(req *request, body interface{}) error { +func (c *rpcCodec) Write(req *request, body interface{}) error { c.buf.wbuf.Reset() m := &codec.Message{ @@ -133,7 +133,7 @@ func (c *rpcCodec) WriteRequest(req *request, body interface{}) error { return nil } -func (c *rpcCodec) ReadResponse(r *response, b interface{}) error { +func (c *rpcCodec) Read(r *response, b interface{}) error { var m transport.Message if err := c.client.Recv(&m); err != nil { return errors.InternalServerError("go.micro.client.transport", err.Error()) diff --git a/client/rpc_stream.go b/client/rpc_stream.go index eda78d47..3ad9bccf 100644 --- a/client/rpc_stream.go +++ b/client/rpc_stream.go @@ -51,7 +51,7 @@ func (r *rpcStream) Send(msg interface{}) error { ServiceMethod: r.request.Method(), } - if err := r.codec.WriteRequest(&req, msg); err != nil { + if err := r.codec.Write(&req, msg); err != nil { r.err = err return err } @@ -69,7 +69,7 @@ func (r *rpcStream) Recv(msg interface{}) error { var resp response - if err := r.codec.ReadResponse(&resp, msg); err != nil { + if err := r.codec.Read(&resp, msg); err != nil { if err == io.EOF && !r.isClosed() { r.err = io.ErrUnexpectedEOF return io.ErrUnexpectedEOF @@ -81,7 +81,7 @@ func (r *rpcStream) Recv(msg interface{}) error { switch { case len(resp.Error) > 0: // We've got an error response. Give this to the request; - // any subsequent requests will get the ReadResponseBody + // any subsequent requests will get the ReadBody // error if there is one. if resp.Error != lastStreamResponseError { r.err = serverError(resp.Error)