rpc临时内存池优化

This commit is contained in:
boyce
2020-07-09 20:01:45 +08:00
parent 825c61e626
commit 323e5313fb
8 changed files with 234 additions and 143 deletions

View File

@@ -1,43 +1,14 @@
package rpc
/*
Seq uint64 // sequence number chosen by client
ServiceMethod string // format: "Service.Method"
NoReply bool //是否需要返回
//packbody
InParam []byte
type RpcResponse struct {
//head
Seq uint64 // sequence number chosen by client
Err *RpcError
//returns
Reply []byte
}
*/
type IRpcRequestData interface {
GetSeq() uint64
GetServiceMethod() string
GetInParam() []byte
IsReply() bool
}
type IRpcResponseData interface {
GetSeq() uint64
GetErr() *RpcError
GetReply() []byte
}
type IRpcProcessor interface {
Marshal(v interface{}) ([]byte, error)
Marshal(v interface{}) ([]byte, error) //b表示自定义缓冲区可以填nil由系统自动分配
Unmarshal(data []byte, v interface{}) error
MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData
MakeRpcResponse(seq uint64,err *RpcError,reply []byte) IRpcResponseData
ReleaseRpcRequest(rpcRequestData IRpcRequestData)
ReleaseRpcRespose(rpcRequestData IRpcResponseData)
}