Bump reva deps (#8412)
* bump dependencies Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * bump reva and add config options Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> --------- Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ type Codec struct {
|
||||
Conn io.ReadWriteCloser
|
||||
}
|
||||
|
||||
// Frame gives us the ability to define raw data to send over the pipes
|
||||
// Frame gives us the ability to define raw data to send over the pipes.
|
||||
type Frame struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
+6
-5
@@ -19,7 +19,7 @@ var (
|
||||
|
||||
type MessageType int
|
||||
|
||||
// Takes in a connection/buffer and returns a new Codec
|
||||
// Takes in a connection/buffer and returns a new Codec.
|
||||
type NewCodec func(io.ReadWriteCloser) Codec
|
||||
|
||||
// Codec encodes/decodes various types of messages used within go-micro.
|
||||
@@ -55,14 +55,15 @@ type Marshaler interface {
|
||||
// the communication, likely followed by the body.
|
||||
// In the case of an error, body may be nil.
|
||||
type Message struct {
|
||||
|
||||
// The values read from the socket
|
||||
Header map[string]string
|
||||
Id string
|
||||
Type MessageType
|
||||
Target string
|
||||
Method string
|
||||
Endpoint string
|
||||
Error string
|
||||
|
||||
// The values read from the socket
|
||||
Header map[string]string
|
||||
Body []byte
|
||||
Body []byte
|
||||
Type MessageType
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go-micro.dev/v4/codec"
|
||||
"go-micro.dev/v4/transport/headers"
|
||||
)
|
||||
|
||||
type Codec struct {
|
||||
@@ -29,8 +30,8 @@ func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error {
|
||||
// service method
|
||||
path := m.Header[":path"]
|
||||
if len(path) == 0 || path[0] != '/' {
|
||||
m.Target = m.Header["Micro-Service"]
|
||||
m.Endpoint = m.Header["Micro-Endpoint"]
|
||||
m.Target = m.Header[headers.Request]
|
||||
m.Endpoint = m.Header[headers.Endpoint]
|
||||
} else {
|
||||
// [ , a.package.Foo, Bar]
|
||||
parts := strings.Split(path, "/")
|
||||
@@ -89,7 +90,7 @@ func (c *Codec) Write(m *codec.Message, b interface{}) error {
|
||||
m.Header[":authority"] = m.Target
|
||||
m.Header["content-type"] = c.ContentType
|
||||
case codec.Response:
|
||||
m.Header["Trailer"] = "grpc-status" //, grpc-message"
|
||||
m.Header["Trailer"] = "grpc-status" // , grpc-message"
|
||||
m.Header["content-type"] = c.ContentType
|
||||
m.Header[":status"] = "200"
|
||||
m.Header["grpc-status"] = "0"
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
var jsonpbMarshaler = &jsonpb.Marshaler{}
|
||||
|
||||
// create buffer pool with 16 instances each preallocated with 256 bytes
|
||||
// create buffer pool with 16 instances each preallocated with 256 bytes.
|
||||
var bufferPool = bpool.NewSizedBufferPool(16, 256)
|
||||
|
||||
type Marshaler struct{}
|
||||
|
||||
+7
-5
@@ -10,22 +10,24 @@ import (
|
||||
)
|
||||
|
||||
type clientCodec struct {
|
||||
dec *json.Decoder // for reading JSON values
|
||||
enc *json.Encoder // for writing JSON values
|
||||
c io.Closer
|
||||
|
||||
// temporary work space
|
||||
req clientRequest
|
||||
resp clientResponse
|
||||
|
||||
sync.Mutex
|
||||
c io.Closer
|
||||
|
||||
dec *json.Decoder // for reading JSON values
|
||||
enc *json.Encoder // for writing JSON values
|
||||
pending map[interface{}]string
|
||||
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
type clientRequest struct {
|
||||
Method string `json:"method"`
|
||||
Params [1]interface{} `json:"params"`
|
||||
ID interface{} `json:"id"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
type clientResponse struct {
|
||||
|
||||
+5
-5
@@ -11,11 +11,11 @@ import (
|
||||
)
|
||||
|
||||
type jsonCodec struct {
|
||||
buf *bytes.Buffer
|
||||
mt codec.MessageType
|
||||
rwc io.ReadWriteCloser
|
||||
buf *bytes.Buffer
|
||||
c *clientCodec
|
||||
s *serverCodec
|
||||
mt codec.MessageType
|
||||
}
|
||||
|
||||
func (j *jsonCodec) Close() error {
|
||||
@@ -41,7 +41,7 @@ func (j *jsonCodec) Write(m *codec.Message, b interface{}) error {
|
||||
_, err = j.rwc.Write(data)
|
||||
return err
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", m.Type)
|
||||
return fmt.Errorf("Unrecognized message type: %v", m.Type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (j *jsonCodec) ReadHeader(m *codec.Message, mt codec.MessageType) error {
|
||||
_, err := io.Copy(j.buf, j.rwc)
|
||||
return err
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", mt)
|
||||
return fmt.Errorf("Unrecognized message type: %v", mt)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func (j *jsonCodec) ReadBody(b interface{}) error {
|
||||
return json.Unmarshal(j.buf.Bytes(), b)
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", j.mt)
|
||||
return fmt.Errorf("Unrecognized message type: %v", j.mt)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,9 +19,9 @@ type serverCodec struct {
|
||||
}
|
||||
|
||||
type serverRequest struct {
|
||||
Method string `json:"method"`
|
||||
Params *json.RawMessage `json:"params"`
|
||||
ID interface{} `json:"id"`
|
||||
Params *json.RawMessage `json:"params"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
type serverResponse struct {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
"go-micro.dev/v4/codec"
|
||||
)
|
||||
|
||||
// create buffer pool with 16 instances each preallocated with 256 bytes
|
||||
// create buffer pool with 16 instances each preallocated with 256 bytes.
|
||||
var bufferPool = bpool.NewSizedBufferPool(16, 256)
|
||||
|
||||
type Marshaler struct{}
|
||||
|
||||
+5
-5
@@ -17,10 +17,10 @@ type flusher interface {
|
||||
}
|
||||
|
||||
type protoCodec struct {
|
||||
sync.Mutex
|
||||
rwc io.ReadWriteCloser
|
||||
mt codec.MessageType
|
||||
buf *bytes.Buffer
|
||||
mt codec.MessageType
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func (c *protoCodec) Close() error {
|
||||
@@ -114,7 +114,7 @@ func (c *protoCodec) Write(m *codec.Message, b interface{}) error {
|
||||
}
|
||||
c.rwc.Write(data)
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", m.Type)
|
||||
return fmt.Errorf("Unrecognized message type: %v", m.Type)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -153,7 +153,7 @@ func (c *protoCodec) ReadHeader(m *codec.Message, mt codec.MessageType) error {
|
||||
_, err := io.Copy(c.buf, c.rwc)
|
||||
return err
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", mt)
|
||||
return fmt.Errorf("Unrecognized message type: %v", mt)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (c *protoCodec) ReadBody(b interface{}) error {
|
||||
case codec.Event:
|
||||
data = c.buf.Bytes()
|
||||
default:
|
||||
return fmt.Errorf("Unrecognised message type: %v", c.mt)
|
||||
return fmt.Errorf("Unrecognized message type: %v", c.mt)
|
||||
}
|
||||
if b != nil {
|
||||
return proto.Unmarshal(data, b.(proto.Message))
|
||||
|
||||
Reference in New Issue
Block a user