Lets strip out the rpcplus code

This commit is contained in:
Asim
2016-01-05 21:13:20 +00:00
parent 40cd086543
commit ad4637d89b
3 changed files with 68 additions and 242 deletions

View File

@@ -2,6 +2,7 @@ package client
import (
"bytes"
"errors"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/codec/jsonrpc"
@@ -9,6 +10,23 @@ import (
"github.com/micro/go-micro/transport"
)
const (
lastStreamResponseError = "EOS"
)
// serverError represents an error that has been returned from
// the remote side of the RPC connection.
type serverError string
func (e serverError) Error() string {
return string(e)
}
// errShutdown holds the specific error for closing/closed connections
var (
errShutdown = errors.New("connection is shut down")
)
type rpcPlusCodec struct {
client transport.Client
codec codec.Codec
@@ -22,6 +40,28 @@ type readWriteCloser struct {
rbuf *bytes.Buffer
}
type clientCodec interface {
WriteRequest(*request, interface{}) error
ReadResponseHeader(*response) error
ReadResponseBody(interface{}) error
Close() error
}
type request struct {
Service string
ServiceMethod string // format: "Service.Method"
Seq uint64 // sequence number chosen by client
next *request // for free list in Server
}
type response struct {
ServiceMethod string // echoes that of the Request
Seq uint64 // echoes that of the request
Error string // error, if any.
next *response // for free list in Server
}
var (
defaultContentType = "application/octet-stream"