mirror of
https://github.com/duanhf2012/origin.git
synced 2026-04-08 16:47:28 +08:00
rpc临时内存池优化
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user