mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-24 06:34:42 +08:00
优化本结点与跨结点Rpc结构&简化原始Rpc接口
This commit is contained in:
@@ -3,6 +3,7 @@ package rpc
|
||||
import (
|
||||
"github.com/duanhf2012/origin/util/sync"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type GoGoPBProcessor struct {
|
||||
@@ -73,6 +74,15 @@ func (slf *GoGoPBProcessor) GetProcessorType() RpcProcessorType{
|
||||
return RpcProcessorGoGoPB
|
||||
}
|
||||
|
||||
func (slf *GoGoPBProcessor) Clone(src interface{}) (interface{},error){
|
||||
srcMsg,ok := src.(proto.Message)
|
||||
if ok == false {
|
||||
return nil,fmt.Errorf("param is not of proto.message type")
|
||||
}
|
||||
|
||||
return proto.Clone(srcMsg),nil
|
||||
}
|
||||
|
||||
func (slf *GoGoPBRpcRequestData) IsNoReply() bool{
|
||||
return slf.GetNoReply()
|
||||
}
|
||||
@@ -91,5 +101,3 @@ func (slf *GoGoPBRpcResponseData) GetErr() *RpcError {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user