Lets strip out the rpcplus code
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user