mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
新增rpc被调用时可以异步返回,详情请参照originserver示例
This commit is contained in:
@@ -178,7 +178,7 @@ func (client *Client) AsyncCall(rpcHandler IRpcHandler,serviceMethod string,call
|
||||
|
||||
request := &RpcRequest{}
|
||||
call.Seq = client.generateSeq()
|
||||
request.RpcRequestData = processor.MakeRpcRequest(client.startSeq,serviceMethod,false,InParam,nil)
|
||||
request.RpcRequestData = processor.MakeRpcRequest(client.startSeq,serviceMethod,false,InParam)
|
||||
client.AddPending(call)
|
||||
|
||||
bytes,err := processor.Marshal(request.RpcRequestData)
|
||||
@@ -204,7 +204,7 @@ func (client *Client) AsyncCall(rpcHandler IRpcHandler,serviceMethod string,call
|
||||
return err
|
||||
}
|
||||
|
||||
func (client *Client) RawGo(processor IRpcProcessor,noReply bool,serviceMethod string,args []byte,additionParam interface{},reply interface{}) *Call {
|
||||
func (client *Client) RawGo(processor IRpcProcessor,noReply bool,serviceMethod string,args []byte,reply interface{}) *Call {
|
||||
call := MakeCall()
|
||||
call.ServiceMethod = serviceMethod
|
||||
call.Reply = reply
|
||||
@@ -214,7 +214,7 @@ func (client *Client) RawGo(processor IRpcProcessor,noReply bool,serviceMethod s
|
||||
if noReply == false {
|
||||
client.AddPending(call)
|
||||
}
|
||||
request.RpcRequestData = processor.MakeRpcRequest(client.startSeq,serviceMethod,noReply,args,additionParam)
|
||||
request.RpcRequestData = processor.MakeRpcRequest(client.startSeq,serviceMethod,noReply,args)
|
||||
bytes,err := processor.Marshal(request.RpcRequestData)
|
||||
processor.ReleaseRpcRequest(request.RpcRequestData)
|
||||
if err != nil {
|
||||
@@ -246,7 +246,7 @@ func (client *Client) Go(noReply bool,serviceMethod string, args interface{},rep
|
||||
call.Err = err
|
||||
}
|
||||
|
||||
return client.RawGo(processor,noReply,serviceMethod,InParam,nil,reply)
|
||||
return client.RawGo(processor,noReply,serviceMethod,InParam,reply)
|
||||
}
|
||||
|
||||
func (client *Client) Run(){
|
||||
|
||||
@@ -17,7 +17,6 @@ type JsonRpcRequestData struct {
|
||||
NoReply bool //是否需要返回
|
||||
//packbody
|
||||
InParam []byte
|
||||
AdditionParam interface{}
|
||||
}
|
||||
|
||||
type JsonRpcResponseData struct {
|
||||
@@ -50,13 +49,12 @@ func (jsonProcessor *JsonProcessor) Unmarshal(data []byte, v interface{}) error{
|
||||
return json.Unmarshal(data,v)
|
||||
}
|
||||
|
||||
func (jsonProcessor *JsonProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte,additionParam interface{}) IRpcRequestData{
|
||||
func (jsonProcessor *JsonProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData{
|
||||
jsonRpcRequestData := rpcJsonRequestDataPool.Get().(*JsonRpcRequestData)
|
||||
jsonRpcRequestData.Seq = seq
|
||||
jsonRpcRequestData.ServiceMethod = serviceMethod
|
||||
jsonRpcRequestData.NoReply = noReply
|
||||
jsonRpcRequestData.InParam = inParam
|
||||
jsonRpcRequestData.AdditionParam = additionParam
|
||||
return jsonRpcRequestData
|
||||
}
|
||||
|
||||
@@ -102,14 +100,6 @@ func (jsonRpcRequestData *JsonRpcRequestData) GetInParam() []byte{
|
||||
return jsonRpcRequestData.InParam
|
||||
}
|
||||
|
||||
func (jsonRpcRequestData *JsonRpcRequestData) GetParamValue() interface{}{
|
||||
return jsonRpcRequestData.AdditionParam
|
||||
}
|
||||
|
||||
func (jsonRpcRequestData *JsonRpcRequestData) GetAdditionParams() IRawAdditionParam{
|
||||
return jsonRpcRequestData
|
||||
}
|
||||
|
||||
func (jsonRpcResponseData *JsonRpcResponseData) GetSeq() uint64 {
|
||||
return jsonRpcResponseData.Seq
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"sync"
|
||||
)
|
||||
@@ -23,68 +22,12 @@ func init(){
|
||||
}
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetParamValue() interface{}{
|
||||
if m.GetAddtionParam() == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch x := m.AddtionParam.AdditionOneof.(type) {
|
||||
case *AdditionParam_SParam:
|
||||
return x.SParam
|
||||
case *AdditionParam_UParam:
|
||||
return x.UParam
|
||||
case *AdditionParam_StrParam:
|
||||
return x.StrParam
|
||||
case *AdditionParam_BParam:
|
||||
return x.BParam
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetAdditionParams() IRawAdditionParam{
|
||||
if m.GetAddtionParam() == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (slf *PBRpcRequestData) MakeRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte,inAdditionParam interface{}) *PBRpcRequestData{
|
||||
func (slf *PBRpcRequestData) MakeRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) *PBRpcRequestData{
|
||||
slf.Seq = proto.Uint64(seq)
|
||||
slf.ServiceMethod = proto.String(serviceMethod)
|
||||
slf.NoReply = proto.Bool(noReply)
|
||||
slf.InParam = inParam
|
||||
|
||||
if inAdditionParam == nil {
|
||||
return slf
|
||||
}
|
||||
|
||||
switch inAdditionParam.(type) {
|
||||
case int:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_SParam{int64(inAdditionParam.(int))}}
|
||||
case int32:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_SParam{int64(inAdditionParam.(int32))}}
|
||||
case int16:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_SParam{int64(inAdditionParam.(int16))}}
|
||||
case int64:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_SParam{inAdditionParam.(int64)}}
|
||||
case uint:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_UParam{uint64(inAdditionParam.(uint))}}
|
||||
case uint32:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_UParam{uint64(inAdditionParam.(uint32))}}
|
||||
case uint16:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_UParam{uint64(inAdditionParam.(uint16))}}
|
||||
case uint64:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_UParam{inAdditionParam.(uint64)}}
|
||||
case string:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof:&AdditionParam_StrParam{inAdditionParam.(string)}}
|
||||
case []byte:
|
||||
slf.AddtionParam = &AdditionParam{AdditionOneof: &AdditionParam_BParam{inAdditionParam.([]byte)}}
|
||||
default:
|
||||
panic(fmt.Sprintf("not support type %+v",inAdditionParam))
|
||||
}
|
||||
|
||||
return slf
|
||||
}
|
||||
|
||||
@@ -105,9 +48,9 @@ func (slf *PBProcessor) Unmarshal(data []byte, msg interface{}) error{
|
||||
return proto.Unmarshal(data, protoMsg)
|
||||
}
|
||||
|
||||
func (slf *PBProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte,inAdditionParam interface{}) IRpcRequestData{
|
||||
func (slf *PBProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData{
|
||||
pPbRpcRequestData := rpcPbRequestDataPool.Get().(*PBRpcRequestData)
|
||||
pPbRpcRequestData.MakeRequest(seq,serviceMethod,noReply,inParam,inAdditionParam)
|
||||
pPbRpcRequestData.MakeRequest(seq,serviceMethod,noReply,inParam)
|
||||
return pPbRpcRequestData
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package rpc
|
||||
type IRpcProcessor interface {
|
||||
Marshal(v interface{}) ([]byte, error) //b表示自定义缓冲区,可以填nil,由系统自动分配
|
||||
Unmarshal(data []byte, v interface{}) error
|
||||
MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte,additionParam interface{}) IRpcRequestData
|
||||
MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData
|
||||
MakeRpcResponse(seq uint64,err RpcError,reply []byte) IRpcResponseData
|
||||
|
||||
ReleaseRpcRequest(rpcRequestData IRpcRequestData)
|
||||
|
||||
12
rpc/rpc.go
12
rpc/rpc.go
@@ -23,20 +23,18 @@ type RpcResponse struct {
|
||||
RpcResponseData IRpcResponseData
|
||||
}
|
||||
|
||||
type Responder = RequestHandler
|
||||
|
||||
//var rpcResponsePool sync.Pool
|
||||
var rpcRequestPool sync.Pool
|
||||
var rpcCallPool sync.Pool
|
||||
|
||||
type IRawAdditionParam interface {
|
||||
GetParamValue() interface{}
|
||||
}
|
||||
|
||||
type IRpcRequestData interface {
|
||||
GetSeq() uint64
|
||||
GetServiceMethod() string
|
||||
GetInParam() []byte
|
||||
IsNoReply() bool
|
||||
GetAdditionParams() IRawAdditionParam
|
||||
}
|
||||
|
||||
type IRpcResponseData interface {
|
||||
@@ -47,7 +45,6 @@ type IRpcResponseData interface {
|
||||
|
||||
type IRawInputArgs interface {
|
||||
GetRawData() []byte //获取原始数据
|
||||
GetAdditionParam() interface{} //获取附加数据
|
||||
DoGc() //处理完成,回收内存
|
||||
}
|
||||
|
||||
@@ -56,8 +53,6 @@ type RpcHandleFinder interface {
|
||||
}
|
||||
|
||||
type RequestHandler func(Returns interface{},Err RpcError)
|
||||
type RawAdditionParamNull struct {
|
||||
}
|
||||
|
||||
type Call struct {
|
||||
Seq uint64
|
||||
@@ -135,6 +130,3 @@ func ReleaseCall(call *Call){
|
||||
rpcCallPool.Put(call)
|
||||
}
|
||||
|
||||
func (slf *RawAdditionParamNull) GetParamValue() interface{}{
|
||||
return nil
|
||||
}
|
||||
|
||||
514
rpc/rpc.pb.go
514
rpc/rpc.pb.go
@@ -1,371 +1,253 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.23.0
|
||||
// protoc (unknown)
|
||||
// source: rpc.proto
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
math "math"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type AdditionParam struct {
|
||||
// Types that are valid to be assigned to AdditionOneof:
|
||||
// *AdditionParam_SParam
|
||||
// *AdditionParam_UParam
|
||||
// *AdditionParam_StrParam
|
||||
// *AdditionParam_BParam
|
||||
AdditionOneof isAdditionParam_AdditionOneof `protobuf_oneof:"addition_oneof"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AdditionParam) Reset() { *m = AdditionParam{} }
|
||||
func (m *AdditionParam) String() string { return proto.CompactTextString(m) }
|
||||
func (*AdditionParam) ProtoMessage() {}
|
||||
func (*AdditionParam) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_77a6da22d6a3feb1, []int{0}
|
||||
}
|
||||
|
||||
func (m *AdditionParam) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AdditionParam.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AdditionParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AdditionParam.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *AdditionParam) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AdditionParam.Merge(m, src)
|
||||
}
|
||||
func (m *AdditionParam) XXX_Size() int {
|
||||
return xxx_messageInfo_AdditionParam.Size(m)
|
||||
}
|
||||
func (m *AdditionParam) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AdditionParam.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AdditionParam proto.InternalMessageInfo
|
||||
|
||||
type isAdditionParam_AdditionOneof interface {
|
||||
isAdditionParam_AdditionOneof()
|
||||
}
|
||||
|
||||
type AdditionParam_SParam struct {
|
||||
SParam int64 `protobuf:"varint,10,opt,name=SParam,oneof"`
|
||||
}
|
||||
|
||||
type AdditionParam_UParam struct {
|
||||
UParam uint64 `protobuf:"varint,11,opt,name=UParam,oneof"`
|
||||
}
|
||||
|
||||
type AdditionParam_StrParam struct {
|
||||
StrParam string `protobuf:"bytes,12,opt,name=StrParam,oneof"`
|
||||
}
|
||||
|
||||
type AdditionParam_BParam struct {
|
||||
BParam []byte `protobuf:"bytes,13,opt,name=BParam,oneof"`
|
||||
}
|
||||
|
||||
func (*AdditionParam_SParam) isAdditionParam_AdditionOneof() {}
|
||||
|
||||
func (*AdditionParam_UParam) isAdditionParam_AdditionOneof() {}
|
||||
|
||||
func (*AdditionParam_StrParam) isAdditionParam_AdditionOneof() {}
|
||||
|
||||
func (*AdditionParam_BParam) isAdditionParam_AdditionOneof() {}
|
||||
|
||||
func (m *AdditionParam) GetAdditionOneof() isAdditionParam_AdditionOneof {
|
||||
if m != nil {
|
||||
return m.AdditionOneof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdditionParam) GetSParam() int64 {
|
||||
if x, ok := m.GetAdditionOneof().(*AdditionParam_SParam); ok {
|
||||
return x.SParam
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AdditionParam) GetUParam() uint64 {
|
||||
if x, ok := m.GetAdditionOneof().(*AdditionParam_UParam); ok {
|
||||
return x.UParam
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AdditionParam) GetStrParam() string {
|
||||
if x, ok := m.GetAdditionOneof().(*AdditionParam_StrParam); ok {
|
||||
return x.StrParam
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AdditionParam) GetBParam() []byte {
|
||||
if x, ok := m.GetAdditionOneof().(*AdditionParam_BParam); ok {
|
||||
return x.BParam
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*AdditionParam) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _AdditionParam_OneofMarshaler, _AdditionParam_OneofUnmarshaler, _AdditionParam_OneofSizer, []interface{}{
|
||||
(*AdditionParam_SParam)(nil),
|
||||
(*AdditionParam_UParam)(nil),
|
||||
(*AdditionParam_StrParam)(nil),
|
||||
(*AdditionParam_BParam)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _AdditionParam_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*AdditionParam)
|
||||
// addition_oneof
|
||||
switch x := m.AdditionOneof.(type) {
|
||||
case *AdditionParam_SParam:
|
||||
b.EncodeVarint(10<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.SParam))
|
||||
case *AdditionParam_UParam:
|
||||
b.EncodeVarint(11<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.UParam))
|
||||
case *AdditionParam_StrParam:
|
||||
b.EncodeVarint(12<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.StrParam)
|
||||
case *AdditionParam_BParam:
|
||||
b.EncodeVarint(13<<3 | proto.WireBytes)
|
||||
b.EncodeRawBytes(x.BParam)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("AdditionParam.AdditionOneof has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _AdditionParam_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*AdditionParam)
|
||||
switch tag {
|
||||
case 10: // addition_oneof.SParam
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.AdditionOneof = &AdditionParam_SParam{int64(x)}
|
||||
return true, err
|
||||
case 11: // addition_oneof.UParam
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.AdditionOneof = &AdditionParam_UParam{x}
|
||||
return true, err
|
||||
case 12: // addition_oneof.StrParam
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.AdditionOneof = &AdditionParam_StrParam{x}
|
||||
return true, err
|
||||
case 13: // addition_oneof.BParam
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeRawBytes(true)
|
||||
m.AdditionOneof = &AdditionParam_BParam{x}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _AdditionParam_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*AdditionParam)
|
||||
// addition_oneof
|
||||
switch x := m.AdditionOneof.(type) {
|
||||
case *AdditionParam_SParam:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(x.SParam))
|
||||
case *AdditionParam_UParam:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(x.UParam))
|
||||
case *AdditionParam_StrParam:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.StrParam)))
|
||||
n += len(x.StrParam)
|
||||
case *AdditionParam_BParam:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.BParam)))
|
||||
n += len(x.BParam)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type PBRpcRequestData struct {
|
||||
Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"`
|
||||
ServiceMethod *string `protobuf:"bytes,2,opt,name=ServiceMethod" json:"ServiceMethod,omitempty"`
|
||||
NoReply *bool `protobuf:"varint,3,opt,name=NoReply" json:"NoReply,omitempty"`
|
||||
InParam []byte `protobuf:"bytes,4,opt,name=InParam" json:"InParam,omitempty"`
|
||||
AddtionParam *AdditionParam `protobuf:"bytes,5,opt,name=addtionParam" json:"addtionParam,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"`
|
||||
ServiceMethod *string `protobuf:"bytes,2,opt,name=ServiceMethod" json:"ServiceMethod,omitempty"`
|
||||
NoReply *bool `protobuf:"varint,3,opt,name=NoReply" json:"NoReply,omitempty"`
|
||||
InParam []byte `protobuf:"bytes,4,opt,name=InParam" json:"InParam,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) Reset() { *m = PBRpcRequestData{} }
|
||||
func (m *PBRpcRequestData) String() string { return proto.CompactTextString(m) }
|
||||
func (*PBRpcRequestData) ProtoMessage() {}
|
||||
func (x *PBRpcRequestData) Reset() {
|
||||
*x = PBRpcRequestData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PBRpcRequestData) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PBRpcRequestData) ProtoMessage() {}
|
||||
|
||||
func (x *PBRpcRequestData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PBRpcRequestData.ProtoReflect.Descriptor instead.
|
||||
func (*PBRpcRequestData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_77a6da22d6a3feb1, []int{1}
|
||||
return file_rpc_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PBRpcRequestData.Unmarshal(m, b)
|
||||
}
|
||||
func (m *PBRpcRequestData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_PBRpcRequestData.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *PBRpcRequestData) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PBRpcRequestData.Merge(m, src)
|
||||
}
|
||||
func (m *PBRpcRequestData) XXX_Size() int {
|
||||
return xxx_messageInfo_PBRpcRequestData.Size(m)
|
||||
}
|
||||
func (m *PBRpcRequestData) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PBRpcRequestData.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PBRpcRequestData proto.InternalMessageInfo
|
||||
|
||||
func (m *PBRpcRequestData) GetSeq() uint64 {
|
||||
if m != nil && m.Seq != nil {
|
||||
return *m.Seq
|
||||
func (x *PBRpcRequestData) GetSeq() uint64 {
|
||||
if x != nil && x.Seq != nil {
|
||||
return *x.Seq
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetServiceMethod() string {
|
||||
if m != nil && m.ServiceMethod != nil {
|
||||
return *m.ServiceMethod
|
||||
func (x *PBRpcRequestData) GetServiceMethod() string {
|
||||
if x != nil && x.ServiceMethod != nil {
|
||||
return *x.ServiceMethod
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetNoReply() bool {
|
||||
if m != nil && m.NoReply != nil {
|
||||
return *m.NoReply
|
||||
func (x *PBRpcRequestData) GetNoReply() bool {
|
||||
if x != nil && x.NoReply != nil {
|
||||
return *x.NoReply
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetInParam() []byte {
|
||||
if m != nil {
|
||||
return m.InParam
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PBRpcRequestData) GetAddtionParam() *AdditionParam {
|
||||
if m != nil {
|
||||
return m.AddtionParam
|
||||
func (x *PBRpcRequestData) GetInParam() []byte {
|
||||
if x != nil {
|
||||
return x.InParam
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PBRpcResponseData struct {
|
||||
Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"`
|
||||
Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"`
|
||||
Reply []byte `protobuf:"bytes,3,opt,name=Reply" json:"Reply,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Seq *uint64 `protobuf:"varint,1,opt,name=Seq" json:"Seq,omitempty"`
|
||||
Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"`
|
||||
Reply []byte `protobuf:"bytes,3,opt,name=Reply" json:"Reply,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PBRpcResponseData) Reset() { *m = PBRpcResponseData{} }
|
||||
func (m *PBRpcResponseData) String() string { return proto.CompactTextString(m) }
|
||||
func (*PBRpcResponseData) ProtoMessage() {}
|
||||
func (x *PBRpcResponseData) Reset() {
|
||||
*x = PBRpcResponseData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PBRpcResponseData) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PBRpcResponseData) ProtoMessage() {}
|
||||
|
||||
func (x *PBRpcResponseData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PBRpcResponseData.ProtoReflect.Descriptor instead.
|
||||
func (*PBRpcResponseData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_77a6da22d6a3feb1, []int{2}
|
||||
return file_rpc_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (m *PBRpcResponseData) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PBRpcResponseData.Unmarshal(m, b)
|
||||
}
|
||||
func (m *PBRpcResponseData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_PBRpcResponseData.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *PBRpcResponseData) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PBRpcResponseData.Merge(m, src)
|
||||
}
|
||||
func (m *PBRpcResponseData) XXX_Size() int {
|
||||
return xxx_messageInfo_PBRpcResponseData.Size(m)
|
||||
}
|
||||
func (m *PBRpcResponseData) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PBRpcResponseData.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PBRpcResponseData proto.InternalMessageInfo
|
||||
|
||||
func (m *PBRpcResponseData) GetSeq() uint64 {
|
||||
if m != nil && m.Seq != nil {
|
||||
return *m.Seq
|
||||
func (x *PBRpcResponseData) GetSeq() uint64 {
|
||||
if x != nil && x.Seq != nil {
|
||||
return *x.Seq
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *PBRpcResponseData) GetError() string {
|
||||
if m != nil && m.Error != nil {
|
||||
return *m.Error
|
||||
func (x *PBRpcResponseData) GetError() string {
|
||||
if x != nil && x.Error != nil {
|
||||
return *x.Error
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PBRpcResponseData) GetReply() []byte {
|
||||
if m != nil {
|
||||
return m.Reply
|
||||
func (x *PBRpcResponseData) GetReply() []byte {
|
||||
if x != nil {
|
||||
return x.Reply
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*AdditionParam)(nil), "rpc.AdditionParam")
|
||||
proto.RegisterType((*PBRpcRequestData)(nil), "rpc.PBRpcRequestData")
|
||||
proto.RegisterType((*PBRpcResponseData)(nil), "rpc.PBRpcResponseData")
|
||||
var File_rpc_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rpc_proto_rawDesc = []byte{
|
||||
0x0a, 0x09, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x72, 0x70, 0x63,
|
||||
0x22, 0x58, 0x0a, 0x10, 0x50, 0x42, 0x52, 0x70, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x44, 0x61, 0x74, 0x61, 0x12, 0x0b, 0x0a, 0x03, 0x53, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x04, 0x12, 0x15, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68,
|
||||
0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0f, 0x0a, 0x07, 0x4e, 0x6f, 0x52, 0x65,
|
||||
0x70, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x12, 0x0f, 0x0a, 0x07, 0x49, 0x6e, 0x50,
|
||||
0x61, 0x72, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x22, 0x3e, 0x0a, 0x11, 0x50, 0x42,
|
||||
0x52, 0x70, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12,
|
||||
0x0b, 0x0a, 0x03, 0x53, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x12, 0x0d, 0x0a, 0x05,
|
||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0d, 0x0a, 0x05, 0x52,
|
||||
0x65, 0x70, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x3b,
|
||||
0x72, 0x70, 0x63,
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) }
|
||||
var (
|
||||
file_rpc_proto_rawDescOnce sync.Once
|
||||
file_rpc_proto_rawDescData = file_rpc_proto_rawDesc
|
||||
)
|
||||
|
||||
var fileDescriptor_77a6da22d6a3feb1 = []byte{
|
||||
// 274 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
|
||||
0x10, 0x86, 0x6b, 0xd2, 0x42, 0x7b, 0x4d, 0x50, 0xb0, 0x18, 0x3c, 0x30, 0x58, 0x11, 0x83, 0xa7,
|
||||
0x0e, 0x0c, 0xec, 0x44, 0x20, 0x95, 0x01, 0x54, 0x2e, 0x62, 0x46, 0x56, 0x62, 0x44, 0x24, 0x88,
|
||||
0x5d, 0xc7, 0x20, 0xf1, 0x10, 0xbc, 0x0e, 0xcf, 0x87, 0x0e, 0xa7, 0x45, 0x19, 0xd8, 0xee, 0xbb,
|
||||
0xcf, 0xa7, 0xfb, 0x7d, 0xb0, 0xf0, 0xae, 0x5e, 0x39, 0x6f, 0x83, 0xe5, 0x89, 0x77, 0x75, 0xf1,
|
||||
0xc5, 0x20, 0xbb, 0x6a, 0x9a, 0x36, 0xb4, 0xb6, 0xdb, 0x68, 0xaf, 0xdf, 0xb8, 0x80, 0xc3, 0xea,
|
||||
0xb7, 0x12, 0x20, 0x99, 0x4a, 0xd6, 0x13, 0x1c, 0x98, 0xcc, 0x63, 0x34, 0x4b, 0xc9, 0xd4, 0x94,
|
||||
0x4c, 0x64, 0x7e, 0x06, 0xf3, 0x2a, 0xf8, 0xe8, 0x52, 0xc9, 0xd4, 0x62, 0x3d, 0xc1, 0x7d, 0x87,
|
||||
0xe6, 0xca, 0xe8, 0x32, 0xc9, 0x54, 0x4a, 0x73, 0x91, 0xcb, 0x1c, 0x8e, 0xf5, 0xb0, 0xfc, 0xc9,
|
||||
0x76, 0xc6, 0x3e, 0x17, 0xdf, 0x0c, 0xf2, 0x4d, 0x89, 0xae, 0x46, 0xb3, 0x7d, 0x37, 0x7d, 0xb8,
|
||||
0xd6, 0x41, 0xf3, 0x1c, 0x92, 0xca, 0x6c, 0x05, 0xa3, 0xad, 0x48, 0x25, 0x3f, 0x87, 0xac, 0x32,
|
||||
0xfe, 0xa3, 0xad, 0xcd, 0x9d, 0x09, 0x2f, 0xb6, 0x11, 0x07, 0xb4, 0x15, 0xc7, 0x4d, 0x2e, 0xe0,
|
||||
0xe8, 0xde, 0xa2, 0x71, 0xaf, 0x9f, 0x22, 0x91, 0x4c, 0xcd, 0x71, 0x87, 0x64, 0x6e, 0xe3, 0x7f,
|
||||
0xc5, 0x94, 0x32, 0xe1, 0x0e, 0xf9, 0x25, 0xa4, 0xba, 0x69, 0xf6, 0xe7, 0x10, 0x33, 0xc9, 0xd4,
|
||||
0xf2, 0x82, 0xaf, 0xe8, 0x6e, 0xa3, 0x43, 0xe1, 0xe8, 0x5d, 0xf1, 0x00, 0x27, 0x43, 0xee, 0xde,
|
||||
0xd9, 0xae, 0x37, 0xff, 0x04, 0x3f, 0x85, 0xd9, 0x8d, 0xf7, 0xd6, 0x0f, 0x81, 0x23, 0x50, 0xf7,
|
||||
0x2f, 0x66, 0x8a, 0x11, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x00, 0x25, 0x65, 0x17, 0xac, 0x01,
|
||||
0x00, 0x00,
|
||||
func file_rpc_proto_rawDescGZIP() []byte {
|
||||
file_rpc_proto_rawDescOnce.Do(func() {
|
||||
file_rpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_proto_rawDescData)
|
||||
})
|
||||
return file_rpc_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_rpc_proto_goTypes = []interface{}{
|
||||
(*PBRpcRequestData)(nil), // 0: rpc.PBRpcRequestData
|
||||
(*PBRpcResponseData)(nil), // 1: rpc.PBRpcResponseData
|
||||
}
|
||||
var file_rpc_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_rpc_proto_init() }
|
||||
func file_rpc_proto_init() {
|
||||
if File_rpc_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PBRpcRequestData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PBRpcResponseData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_rpc_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_rpc_proto_goTypes,
|
||||
DependencyIndexes: file_rpc_proto_depIdxs,
|
||||
MessageInfos: file_rpc_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rpc_proto = out.File
|
||||
file_rpc_proto_rawDesc = nil
|
||||
file_rpc_proto_goTypes = nil
|
||||
file_rpc_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
syntax = "proto2";
|
||||
|
||||
|
||||
package rpc;
|
||||
|
||||
message AdditionParam {
|
||||
oneof addition_oneof {
|
||||
int64 SParam = 10;
|
||||
uint64 UParam = 11;
|
||||
string StrParam = 12;
|
||||
bytes BParam = 13;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
option go_package =".;rpc";
|
||||
message PBRpcRequestData{
|
||||
optional uint64 Seq = 1;
|
||||
optional string ServiceMethod = 2;
|
||||
optional bool NoReply = 3;
|
||||
optional bytes InParam = 4;
|
||||
optional AdditionParam addtionParam = 5;
|
||||
}
|
||||
|
||||
message PBRpcResponseData{
|
||||
|
||||
@@ -13,17 +13,17 @@ import (
|
||||
const maxClusterNode int = 128
|
||||
type FuncRpcClient func(nodeId int,serviceMethod string,client []*Client) (error,int)
|
||||
type FuncRpcServer func() (*Server)
|
||||
var NilError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem())
|
||||
var nilError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem())
|
||||
|
||||
type RpcError string
|
||||
var noError RpcError
|
||||
var NilError RpcError
|
||||
func (e RpcError) Error() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func ConvertError(e error) RpcError{
|
||||
if e == nil {
|
||||
return noError
|
||||
return NilError
|
||||
}
|
||||
|
||||
rpcErr := RpcError(e.Error())
|
||||
@@ -41,8 +41,7 @@ type RpcMethodInfo struct {
|
||||
inParamValue reflect.Value
|
||||
inParam interface{}
|
||||
outParamValue reflect.Value
|
||||
additionParam reflect.Value
|
||||
hasAdditionParam bool
|
||||
hasResponder bool
|
||||
rpcProcessorType RpcProcessorType
|
||||
}
|
||||
|
||||
@@ -78,10 +77,14 @@ type IRpcHandler interface {
|
||||
IsSingleCoroutine() bool
|
||||
}
|
||||
|
||||
var rawAdditionParamValueNull reflect.Value
|
||||
func init(){
|
||||
rawAdditionParamValueNull = reflect.ValueOf(&RawAdditionParamNull{})
|
||||
func reqHandlerNull(Returns interface{},Err RpcError) {
|
||||
}
|
||||
|
||||
var requestHandlerNull reflect.Value
|
||||
func init(){
|
||||
requestHandlerNull = reflect.ValueOf(reqHandlerNull)
|
||||
}
|
||||
|
||||
func (handler *RpcHandler) GetRpcHandler() IRpcHandler{
|
||||
return handler.rpcHandler
|
||||
}
|
||||
@@ -137,9 +140,9 @@ func (handler *RpcHandler) suitableMethods(method reflect.Method) error {
|
||||
|
||||
//1.判断第一个参数
|
||||
var parIdx int = 1
|
||||
if typ.In(parIdx).String() == "rpc.IRawAdditionParam" {
|
||||
if typ.In(parIdx).String() == "rpc.RequestHandler" {
|
||||
parIdx += 1
|
||||
rpcMethodInfo.hasAdditionParam = true
|
||||
rpcMethodInfo.hasResponder = true
|
||||
}
|
||||
|
||||
for i:= parIdx ;i<typ.NumIn();i++{
|
||||
@@ -208,7 +211,7 @@ func (handler *RpcHandler) HandlerRpcResponseCB(call *Call){
|
||||
}()
|
||||
|
||||
if call.Err == nil {
|
||||
call.callback.Call([]reflect.Value{reflect.ValueOf(call.Reply),NilError})
|
||||
call.callback.Call([]reflect.Value{reflect.ValueOf(call.Reply),nilError})
|
||||
}else{
|
||||
call.callback.Call([]reflect.Value{reflect.ValueOf(call.Reply),reflect.ValueOf(call.Err)})
|
||||
}
|
||||
@@ -287,13 +290,12 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
|
||||
}
|
||||
|
||||
paramList = append(paramList,reflect.ValueOf(handler.GetRpcHandler())) //接受者
|
||||
additionParams := request.RpcRequestData.GetAdditionParams()
|
||||
if v.hasAdditionParam == true{
|
||||
if additionParams!=nil && additionParams.GetParamValue()!=nil{
|
||||
additionVal := reflect.ValueOf(additionParams)
|
||||
paramList = append(paramList,additionVal)
|
||||
if v.hasResponder == true {
|
||||
if request.requestHandle!=nil {
|
||||
responder := reflect.ValueOf(request.requestHandle)
|
||||
paramList = append(paramList,responder)
|
||||
}else{
|
||||
paramList = append(paramList,rawAdditionParamValueNull)
|
||||
paramList = append(paramList,requestHandlerNull)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,8 +310,8 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
|
||||
oParam = reflect.New(v.outParamValue.Type().Elem())
|
||||
}
|
||||
paramList = append(paramList,oParam) //输出参数
|
||||
}else if request.requestHandle != nil { //调用方有返回值,但被调用函数没有返回参数
|
||||
rErr := "Call Rpc "+request.RpcRequestData.GetServiceMethod()+"without return parameter!"
|
||||
}else if request.requestHandle != nil && v.hasResponder==false{ //调用方有返回值,但被调用函数没有返回参数
|
||||
rErr := "Call Rpc "+request.RpcRequestData.GetServiceMethod()+" without return parameter!"
|
||||
log.Error(rErr)
|
||||
request.requestHandle(nil, RpcError(rErr))
|
||||
return
|
||||
@@ -320,7 +322,7 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
|
||||
err = errInter.(error)
|
||||
}
|
||||
|
||||
if request.requestHandle!=nil {
|
||||
if request.requestHandle!=nil && v.hasResponder==false {
|
||||
request.requestHandle(oParam.Interface(), ConvertError(err))
|
||||
}
|
||||
}
|
||||
@@ -503,7 +505,7 @@ func (handler *RpcHandler) asyncCallRpc(nodeid int,serviceMethod string,args int
|
||||
if serviceName == handler.rpcHandler.GetName() { //自己服务调用
|
||||
err := pLocalRpcServer.myselfRpcHandlerGo(serviceName,serviceMethod,args,reply)
|
||||
if err == nil {
|
||||
fVal.Call([]reflect.Value{reflect.ValueOf(reply),NilError})
|
||||
fVal.Call([]reflect.Value{reflect.ValueOf(reply),nilError})
|
||||
}else{
|
||||
fVal.Call([]reflect.Value{reflect.ValueOf(reply),reflect.ValueOf(err)})
|
||||
}
|
||||
@@ -618,7 +620,7 @@ func (handler *RpcHandler) RawGoNode(rpcProcessorType RpcProcessorType,nodeId in
|
||||
}
|
||||
|
||||
//跨node调用
|
||||
pCall := pClientList[i].RawGo(processor,true,serviceMethod,args.GetRawData(),args.GetAdditionParam(),nil)
|
||||
pCall := pClientList[i].RawGo(processor,true,serviceMethod,args.GetRawData(),nil)
|
||||
args.DoGc()
|
||||
if pCall.Err!=nil {
|
||||
err = pCall.Err
|
||||
|
||||
@@ -129,7 +129,7 @@ func (agent *RpcAgent) Run() {
|
||||
//解析head
|
||||
req := MakeRpcRequest()
|
||||
req.rpcProcessor = processor
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0,"",false,nil,nil)
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0,"",false,nil)
|
||||
err = processor.Unmarshal(data[1:],req.RpcRequestData)
|
||||
agent.conn.ReleaseReadMsg(data)
|
||||
if err != nil {
|
||||
@@ -252,12 +252,8 @@ func (server *Server) selfNodeRpcHandlerGo(processor IRpcProcessor,client *Clien
|
||||
if processor == nil {
|
||||
_,processor = GetProcessorType(args)
|
||||
}
|
||||
var additionParam interface{}
|
||||
if inputArgs!=nil {
|
||||
additionParam = inputArgs.GetAdditionParam()
|
||||
}
|
||||
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0, serviceMethod,noReply,nil,additionParam)
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0, serviceMethod,noReply,nil)
|
||||
req.rpcProcessor = processor
|
||||
if noReply == false {
|
||||
client.AddPending(pCall)
|
||||
@@ -308,7 +304,7 @@ func (server *Server) selfNodeRpcHandlerAsyncGo(client *Client,callerRpcHandler
|
||||
req.bLocalRequest = true
|
||||
_,processor := GetProcessorType(args)
|
||||
req.rpcProcessor =processor
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0,serviceMethod,noReply,nil,nil)
|
||||
req.RpcRequestData = processor.MakeRpcRequest(0,serviceMethod,noReply,nil)
|
||||
if noReply == false {
|
||||
client.AddPending(pCall)
|
||||
req.requestHandle = func(Returns interface{},Err RpcError){
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duanhf2012/origin/service"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
type GateProxyModule struct{
|
||||
service.Module
|
||||
defaultGateRpc string
|
||||
}
|
||||
|
||||
func NewGateProxyModule() *GateProxyModule{
|
||||
return &GateProxyModule{defaultGateRpc:"TcpGateService.RPC_Dispatch"}
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) Send(clientId interface{},msgType uint16,msg proto.Message) error {
|
||||
//对agentId进行分组
|
||||
mapNodeClientId := map[int][]uint64{}
|
||||
switch clientId.(type) {
|
||||
case uint64:
|
||||
id := clientId.(uint64)
|
||||
nodeId := tcpservice.GetNodeId(id)
|
||||
mapNodeClientId[nodeId] = append(mapNodeClientId[nodeId],id)
|
||||
|
||||
case []uint64:
|
||||
idList := clientId.([]uint64)
|
||||
for _,id := range idList{
|
||||
nodeId := tcpservice.GetNodeId(id)
|
||||
mapNodeClientId[nodeId] = append(mapNodeClientId[nodeId],id)
|
||||
}
|
||||
}
|
||||
|
||||
bData,err := proto.Marshal(msg)
|
||||
if err!=nil {
|
||||
return err
|
||||
}
|
||||
var replyMsg ReplyMessage
|
||||
replyMsg.MsgType = proto.Uint32(uint32(msgType))
|
||||
replyMsg.Msg = bData
|
||||
|
||||
for nodeId,clientIdList := range mapNodeClientId {
|
||||
if nodeId <0 || nodeId>tcpservice.MaxNodeId {
|
||||
fmt.Errorf("nodeid is error %d",nodeId)
|
||||
continue
|
||||
}
|
||||
|
||||
replyMsg.ClientList = clientIdList
|
||||
gate.GetService().GetRpcHandler().GoNode(nodeId,gate.defaultGateRpc,&replyMsg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) SetDefaultGateRpcMethodName(rpcMethodName string){
|
||||
gate.defaultGateRpc = rpcMethodName
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) send(clientId uint64,msgType uint16,msg []byte) error {
|
||||
nodeId := tcpservice.GetNodeId(clientId)
|
||||
if nodeId <0 || nodeId>tcpservice.MaxNodeId {
|
||||
return fmt.Errorf("nodeid is error %d",nodeId)
|
||||
}
|
||||
|
||||
var replyMsg ReplyMessage
|
||||
replyMsg.MsgType = proto.Uint32(uint32(msgType))
|
||||
replyMsg.Msg = msg
|
||||
replyMsg.ClientList = append(replyMsg.ClientList ,clientId)
|
||||
|
||||
return gate.GetService().GetRpcHandler().GoNode(nodeId, gate.defaultGateRpc,&replyMsg)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type ILoadBalance interface {
|
||||
SelectNode(serviceName string,clientId uint64,eventType string,msgType uint16,msg []byte) int //选择一个结点,通过服务名称
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type IRouter interface {
|
||||
RouterMessage(clientId uint64,msgType uint16,msg []byte) //消息转发
|
||||
RouterEvent(clientId uint64,eventType string) bool//消息转发
|
||||
Load() //加载路由规则
|
||||
|
||||
OnDisconnected(clientId uint64)
|
||||
OnConnected(clientId uint64)
|
||||
//ReplyMessage(clientId uint64,msg []byte)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type LoadBalance struct {
|
||||
}
|
||||
|
||||
func (balance *LoadBalance) SelectNode(serviceName string,clientId uint64,eventType string,msgType uint16,msg []byte) int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/log"
|
||||
"github.com/duanhf2012/origin/network"
|
||||
"github.com/duanhf2012/origin/node"
|
||||
"github.com/duanhf2012/origin/rpc"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type RouterCfg struct {
|
||||
}
|
||||
|
||||
type Router struct {
|
||||
loadBalance ILoadBalance
|
||||
rpcHandler rpc.IRpcHandler
|
||||
|
||||
mapMsgRouterInfo map[uint16]*MsgRouterInfo
|
||||
mapEventRouterInfo map[string]*EventRouterInfo
|
||||
|
||||
tcpService *tcpservice.TcpService
|
||||
|
||||
mapClientRouterCache map[uint64]map[string]int //map[clientid]nodeid
|
||||
}
|
||||
|
||||
type MsgRouterInfo struct {
|
||||
Rpc string
|
||||
ServiceName string
|
||||
LoadBalanceType string
|
||||
}
|
||||
|
||||
type EventRouterInfo struct {
|
||||
Rpc string
|
||||
ServiceName string
|
||||
LoadBalanceType string
|
||||
}
|
||||
|
||||
func NewRouter(loadBalance ILoadBalance,rpcHandler rpc.IRpcHandler,cfg interface{}) IRouter {
|
||||
router := &Router{}
|
||||
router.loadBalance = loadBalance
|
||||
router.rpcHandler = rpcHandler
|
||||
router.tcpService = node.GetService("TcpService").(*tcpservice.TcpService)
|
||||
router.loadCfg(cfg)
|
||||
router.mapClientRouterCache = map[uint64]map[string]int{}
|
||||
return router
|
||||
}
|
||||
|
||||
func (r *Router) loadCfg(cfg interface{}){
|
||||
r.mapMsgRouterInfo = map[uint16]*MsgRouterInfo{}
|
||||
r.mapEventRouterInfo = map[string]*EventRouterInfo{}
|
||||
|
||||
mapRouter,ok := cfg.(map[string]interface{})
|
||||
if ok == false{
|
||||
//error....
|
||||
return
|
||||
}
|
||||
|
||||
//parse MsgRouter
|
||||
routerInfo,ok := mapRouter["MsgRouter"]
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
//ar routerList []RouterItem
|
||||
routerList,ok := routerInfo.([]interface{})
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
for _,v := range routerList{
|
||||
mapItem := v.(map[string]interface{})
|
||||
var iMsgId interface{}
|
||||
var iRpc interface{}
|
||||
var iLoadBalanceType interface{}
|
||||
|
||||
if iMsgId,ok = mapItem["MsgId"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iRpc,ok = mapItem["Rpc"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iLoadBalanceType,ok = mapItem["LoadBalanceType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
msgIdList,ok := iMsgId.(string)
|
||||
if ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
var startMsgId int
|
||||
var endMsgId int
|
||||
var err error
|
||||
sliceId := strings.Split(msgIdList,"-")
|
||||
if len(sliceId) == 1 {
|
||||
startMsgId,err = strconv.Atoi(msgIdList)
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
endMsgId = startMsgId
|
||||
} else if len(sliceId) == 2 {
|
||||
startMsgId,err = strconv.Atoi(sliceId[0])
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
endMsgId,err = strconv.Atoi(sliceId[1])
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
if startMsgId>endMsgId {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
}else {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
|
||||
strService := strings.Split(iRpc.(string),".")
|
||||
if len(strService)!=2 {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
msgInfo := &MsgRouterInfo{ServiceName: strService[0],Rpc: iRpc.(string),LoadBalanceType: iLoadBalanceType.(string)}
|
||||
for i:=startMsgId;i<=endMsgId;i++{
|
||||
r.mapMsgRouterInfo[uint16(i)] = msgInfo
|
||||
}
|
||||
}
|
||||
|
||||
//parse EventRouter
|
||||
eventRouterInfo,ok := mapRouter["EventRouter"]
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
//ar routerList []RouterItem
|
||||
eRouterList,ok := eventRouterInfo.([]interface{})
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
for _,v := range eRouterList{
|
||||
mapItem := v.(map[string]interface{})
|
||||
var eventType interface{}
|
||||
var iRpc interface{}
|
||||
var iLoadBalanceType interface{}
|
||||
|
||||
if eventType,ok = mapItem["EventType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iRpc,ok = mapItem["Rpc"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iLoadBalanceType,ok = mapItem["LoadBalanceType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
strEventType,ok := eventType.(string)
|
||||
if ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
strService := strings.Split(iRpc.(string),".")
|
||||
if len(strService)!=2 {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
r.mapEventRouterInfo[strEventType] = &EventRouterInfo{ServiceName: strService[0],Rpc: iRpc.(string),LoadBalanceType: iLoadBalanceType.(string)}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Router) GetMsgRouterService(msgType uint16) *MsgRouterInfo{
|
||||
info,ok := r.mapMsgRouterInfo[msgType]
|
||||
if ok == false {
|
||||
return nil
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (r *Router) GetEventRouterService(eventType string) *EventRouterInfo{
|
||||
info,ok := r.mapEventRouterInfo[eventType]
|
||||
if ok == false {
|
||||
return nil
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (r *Router) GetRouterId(clientId uint64,serviceName *string) int {
|
||||
mapServiceRouter,ok := r.mapClientRouterCache[clientId]
|
||||
if ok == false{
|
||||
return 0
|
||||
}
|
||||
|
||||
routerId,ok := mapServiceRouter[*serviceName]
|
||||
if ok == false {
|
||||
return 0
|
||||
}
|
||||
|
||||
return routerId
|
||||
}
|
||||
|
||||
func (r *Router) SetRouterId(clientId uint64,serviceName string,routerId int){
|
||||
r.mapClientRouterCache[clientId][serviceName] = routerId
|
||||
}
|
||||
|
||||
type RawInputArgs struct {
|
||||
rawData []byte
|
||||
clientId uint64
|
||||
}
|
||||
|
||||
var rawInputEmpty []byte
|
||||
func (args RawInputArgs) GetRawData() []byte{
|
||||
if len(args.rawData) < 2 {
|
||||
return args.rawData
|
||||
}
|
||||
|
||||
return args.rawData[2:]
|
||||
}
|
||||
|
||||
func (args RawInputArgs) GetAdditionParam() interface{}{
|
||||
return args.clientId
|
||||
}
|
||||
|
||||
func (args RawInputArgs) DoGc() {
|
||||
if len(args.rawData) < 2 {
|
||||
return
|
||||
}
|
||||
network.ReleaseByteSlice(args.rawData)
|
||||
}
|
||||
var msgEventType string
|
||||
|
||||
func (r *Router) RouterMessage(cliId uint64,msgType uint16,msg []byte) {
|
||||
routerInfo:= r.GetMsgRouterService(msgType)
|
||||
if routerInfo==nil {
|
||||
log.Error("The message type is %d with no configured route!",msgType)
|
||||
return
|
||||
}
|
||||
|
||||
routerId := r.GetRouterId(cliId,&routerInfo.ServiceName)
|
||||
if routerId ==0 {
|
||||
routerId = r.loadBalance.SelectNode(routerInfo.ServiceName,cliId,msgEventType,msgType,msg)
|
||||
r.SetRouterId(cliId,routerInfo.ServiceName,routerId)
|
||||
}
|
||||
|
||||
if routerId>0 {
|
||||
r.rpcHandler.RawGoNode(rpc.RpcProcessorPb,routerId,routerInfo.Rpc,RawInputArgs{rawData: msg,clientId: cliId})
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Router) Load(){
|
||||
}
|
||||
|
||||
func (r *Router) RouterEvent(clientId uint64,eventType string) bool{
|
||||
routerInfo:= r.GetEventRouterService(eventType)
|
||||
if routerInfo==nil {
|
||||
log.Error("The event type is %s with no register!",eventType)
|
||||
return false
|
||||
}
|
||||
|
||||
routerId := r.GetRouterId(clientId,&routerInfo.ServiceName)
|
||||
if routerId ==0 {
|
||||
routerId = r.loadBalance.SelectNode(routerInfo.ServiceName,clientId,eventType,0,nil)
|
||||
r.SetRouterId(clientId,routerInfo.ServiceName,routerId)
|
||||
}
|
||||
|
||||
if routerId>0 {
|
||||
r.rpcHandler.RawGoNode(rpc.RpcProcessorPb,routerId,routerInfo.Rpc,RawInputArgs{rawData: rawInputEmpty,clientId: clientId})
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func (r *Router) OnDisconnected(clientId uint64){
|
||||
delete(r.mapClientRouterCache,clientId)
|
||||
//通知事件
|
||||
r.RouterEvent(clientId,"DisConnect")
|
||||
}
|
||||
|
||||
func (r *Router) OnConnected(clientId uint64){
|
||||
r.mapClientRouterCache[clientId] = map[string]int{}
|
||||
r.RouterEvent(clientId,"Connect")
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/log"
|
||||
"github.com/duanhf2012/origin/network/processor"
|
||||
"github.com/duanhf2012/origin/node"
|
||||
"github.com/duanhf2012/origin/service"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
)
|
||||
|
||||
type MsgTypeRouterInfo struct {
|
||||
router IRouter
|
||||
serviceName string
|
||||
}
|
||||
|
||||
type TcpGateService struct {
|
||||
service.Service
|
||||
|
||||
processor processor.IRawProcessor
|
||||
tcpService *tcpservice.TcpService
|
||||
loadBalance ILoadBalance
|
||||
router IRouter
|
||||
}
|
||||
|
||||
|
||||
func (gateService *TcpGateService) OnInit() error {
|
||||
gateService.OnLoad()
|
||||
//注册监听客户连接断开事件
|
||||
gateService.processor.SetDisConnectedHandler(gateService.router.OnDisconnected)
|
||||
//注册监听客户连接事件
|
||||
gateService.processor.SetConnectedHandler(gateService.router.OnConnected)
|
||||
|
||||
//注册监听消息类型MsgType_MsgReq,并注册回调
|
||||
gateService.processor.SetRawMsgHandler(gateService.router.RouterMessage)
|
||||
//将protobuf消息处理器设置到TcpService服务中
|
||||
gateService.tcpService.SetProcessor(gateService.processor, gateService.GetEventHandler())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetEventChannel(channelNum int){
|
||||
gateService.GetEventProcessor().SetEventChannel(channelNum)
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) OnLoad() {
|
||||
//设置默认LoadBalance
|
||||
if gateService.loadBalance == nil {
|
||||
gateService.loadBalance = &LoadBalance{}
|
||||
}
|
||||
|
||||
//设置默认Router
|
||||
if gateService.router == nil {
|
||||
gateService.router = NewRouter(gateService.loadBalance, gateService, gateService.GetServiceCfg())
|
||||
}
|
||||
|
||||
//新建内置的protobuf处理器,您也可以自定义路由器,比如json
|
||||
if gateService.processor == nil {
|
||||
gateService.processor = processor.NewPBRawProcessor()
|
||||
}
|
||||
|
||||
//加载路由
|
||||
gateService.router.Load()
|
||||
|
||||
//设置默认的TcpService服务
|
||||
if gateService.tcpService == nil {
|
||||
gateService.tcpService = node.GetService("TcpService").(*tcpservice.TcpService)
|
||||
}
|
||||
|
||||
if gateService.tcpService == nil {
|
||||
panic("TcpService is not installed!")
|
||||
}
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetLoadBalance(loadBalance ILoadBalance){
|
||||
gateService.loadBalance = loadBalance
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetRouter(router IRouter){
|
||||
gateService.router = router
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetRawProcessor(processor processor.IRawProcessor){
|
||||
gateService.processor = processor
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetTcpGateService(tcpService *tcpservice.TcpService){
|
||||
gateService.tcpService = tcpService
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) RPC_Dispatch(replyMsg *ReplyMessage) error {
|
||||
for _,id := range replyMsg.ClientList {
|
||||
err := gateService.tcpService.SendRawMsg(id,replyMsg.Msg)
|
||||
if err != nil {
|
||||
log.Debug("SendRawMsg fail:%+v!",err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,473 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: base/base.proto
|
||||
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Int struct {
|
||||
Value *int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int) Reset() { *m = Int{} }
|
||||
func (m *Int) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int) ProtoMessage() {}
|
||||
func (*Int) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{0}
|
||||
}
|
||||
|
||||
func (m *Int) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Int) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int.Merge(m, src)
|
||||
}
|
||||
func (m *Int) XXX_Size() int {
|
||||
return xxx_messageInfo_Int.Size(m)
|
||||
}
|
||||
func (m *Int) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int proto.InternalMessageInfo
|
||||
|
||||
func (m *Int) GetValue() int32 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Int64 struct {
|
||||
Value *int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int64) Reset() { *m = Int64{} }
|
||||
func (m *Int64) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int64) ProtoMessage() {}
|
||||
func (*Int64) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{1}
|
||||
}
|
||||
|
||||
func (m *Int64) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int64.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int64.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Int64) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int64.Merge(m, src)
|
||||
}
|
||||
func (m *Int64) XXX_Size() int {
|
||||
return xxx_messageInfo_Int64.Size(m)
|
||||
}
|
||||
func (m *Int64) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int64.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int64 proto.InternalMessageInfo
|
||||
|
||||
func (m *Int64) GetValue() int64 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Bool struct {
|
||||
Value *bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Bool) Reset() { *m = Bool{} }
|
||||
func (m *Bool) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bool) ProtoMessage() {}
|
||||
func (*Bool) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{2}
|
||||
}
|
||||
|
||||
func (m *Bool) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Bool.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Bool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Bool.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Bool) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Bool.Merge(m, src)
|
||||
}
|
||||
func (m *Bool) XXX_Size() int {
|
||||
return xxx_messageInfo_Bool.Size(m)
|
||||
}
|
||||
func (m *Bool) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Bool.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Bool proto.InternalMessageInfo
|
||||
|
||||
func (m *Bool) GetValue() bool {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type String struct {
|
||||
Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *String) Reset() { *m = String{} }
|
||||
func (m *String) String() string { return proto.CompactTextString(m) }
|
||||
func (*String) ProtoMessage() {}
|
||||
func (*String) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{3}
|
||||
}
|
||||
|
||||
func (m *String) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_String.Unmarshal(m, b)
|
||||
}
|
||||
func (m *String) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_String.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *String) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_String.Merge(m, src)
|
||||
}
|
||||
func (m *String) XXX_Size() int {
|
||||
return xxx_messageInfo_String.Size(m)
|
||||
}
|
||||
func (m *String) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_String.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_String proto.InternalMessageInfo
|
||||
|
||||
func (m *String) GetValue() string {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Bytes struct {
|
||||
Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Bytes) Reset() { *m = Bytes{} }
|
||||
func (m *Bytes) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bytes) ProtoMessage() {}
|
||||
func (*Bytes) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{4}
|
||||
}
|
||||
|
||||
func (m *Bytes) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Bytes.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Bytes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Bytes.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Bytes) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Bytes.Merge(m, src)
|
||||
}
|
||||
func (m *Bytes) XXX_Size() int {
|
||||
return xxx_messageInfo_Bytes.Size(m)
|
||||
}
|
||||
func (m *Bytes) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Bytes.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Bytes proto.InternalMessageInfo
|
||||
|
||||
func (m *Bytes) GetValue() []byte {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MsgHead struct {
|
||||
Cid *int32 `protobuf:"varint,1,opt,name=cid" json:"cid,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MsgHead) Reset() { *m = MsgHead{} }
|
||||
func (m *MsgHead) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgHead) ProtoMessage() {}
|
||||
func (*MsgHead) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{5}
|
||||
}
|
||||
|
||||
func (m *MsgHead) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgHead.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MsgHead) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MsgHead.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *MsgHead) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgHead.Merge(m, src)
|
||||
}
|
||||
func (m *MsgHead) XXX_Size() int {
|
||||
return xxx_messageInfo_MsgHead.Size(m)
|
||||
}
|
||||
func (m *MsgHead) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgHead.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgHead proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgHead) GetCid() int32 {
|
||||
if m != nil && m.Cid != nil {
|
||||
return *m.Cid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Msg struct {
|
||||
Head *MsgHead `protobuf:"bytes,1,opt,name=head" json:"head,omitempty"`
|
||||
Ret *int32 `protobuf:"varint,2,opt,name=ret" json:"ret,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Msg) Reset() { *m = Msg{} }
|
||||
func (m *Msg) String() string { return proto.CompactTextString(m) }
|
||||
func (*Msg) ProtoMessage() {}
|
||||
func (*Msg) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{6}
|
||||
}
|
||||
|
||||
var extRange_Msg = []proto.ExtensionRange{
|
||||
{Start: 100, End: 10000},
|
||||
}
|
||||
|
||||
func (*Msg) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Msg
|
||||
}
|
||||
|
||||
func (m *Msg) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Msg.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Msg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Msg.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Msg) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Msg.Merge(m, src)
|
||||
}
|
||||
func (m *Msg) XXX_Size() int {
|
||||
return xxx_messageInfo_Msg.Size(m)
|
||||
}
|
||||
func (m *Msg) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Msg.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Msg proto.InternalMessageInfo
|
||||
|
||||
func (m *Msg) GetHead() *MsgHead {
|
||||
if m != nil {
|
||||
return m.Head
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Msg) GetRet() int32 {
|
||||
if m != nil && m.Ret != nil {
|
||||
return *m.Ret
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ClientList struct {
|
||||
ClientList []uint64 `protobuf:"varint,1,rep,name=clientList" json:"clientList,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ClientList) Reset() { *m = ClientList{} }
|
||||
func (m *ClientList) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientList) ProtoMessage() {}
|
||||
func (*ClientList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{7}
|
||||
}
|
||||
|
||||
func (m *ClientList) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ClientList.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ClientList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ClientList.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ClientList) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ClientList.Merge(m, src)
|
||||
}
|
||||
func (m *ClientList) XXX_Size() int {
|
||||
return xxx_messageInfo_ClientList.Size(m)
|
||||
}
|
||||
func (m *ClientList) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ClientList.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ClientList proto.InternalMessageInfo
|
||||
|
||||
func (m *ClientList) GetClientList() []uint64 {
|
||||
if m != nil {
|
||||
return m.ClientList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReplyMessage struct {
|
||||
ClientList []uint64 `protobuf:"varint,1,rep,name=clientList" json:"clientList,omitempty"`
|
||||
MsgType *uint32 `protobuf:"varint,2,opt,name=msgType" json:"msgType,omitempty"`
|
||||
Msg []byte `protobuf:"bytes,3,opt,name=msg" json:"msg,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) Reset() { *m = ReplyMessage{} }
|
||||
func (m *ReplyMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplyMessage) ProtoMessage() {}
|
||||
func (*ReplyMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{8}
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ReplyMessage.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ReplyMessage.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ReplyMessage.Merge(m, src)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Size() int {
|
||||
return xxx_messageInfo_ReplyMessage.Size(m)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ReplyMessage.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ReplyMessage proto.InternalMessageInfo
|
||||
|
||||
func (m *ReplyMessage) GetClientList() []uint64 {
|
||||
if m != nil {
|
||||
return m.ClientList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) GetMsgType() uint32 {
|
||||
if m != nil && m.MsgType != nil {
|
||||
return *m.MsgType
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) GetMsg() []byte {
|
||||
if m != nil {
|
||||
return m.Msg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PlaceHolders struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *PlaceHolders) Reset() { *m = PlaceHolders{} }
|
||||
func (m *PlaceHolders) String() string { return proto.CompactTextString(m) }
|
||||
func (*PlaceHolders) ProtoMessage() {}
|
||||
func (*PlaceHolders) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{9}
|
||||
}
|
||||
|
||||
func (m *PlaceHolders) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PlaceHolders.Unmarshal(m, b)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_PlaceHolders.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PlaceHolders.Merge(m, src)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Size() int {
|
||||
return xxx_messageInfo_PlaceHolders.Size(m)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PlaceHolders.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PlaceHolders proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Int)(nil), "tcpgateway.Int")
|
||||
proto.RegisterType((*Int64)(nil), "tcpgateway.Int64")
|
||||
proto.RegisterType((*Bool)(nil), "tcpgateway.Bool")
|
||||
proto.RegisterType((*String)(nil), "tcpgateway.String")
|
||||
proto.RegisterType((*Bytes)(nil), "tcpgateway.Bytes")
|
||||
proto.RegisterType((*MsgHead)(nil), "tcpgateway.MsgHead")
|
||||
proto.RegisterType((*Msg)(nil), "tcpgateway.Msg")
|
||||
proto.RegisterType((*ClientList)(nil), "tcpgateway.ClientList")
|
||||
proto.RegisterType((*ReplyMessage)(nil), "tcpgateway.ReplyMessage")
|
||||
proto.RegisterType((*PlaceHolders)(nil), "tcpgateway.PlaceHolders")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("base/base.proto", fileDescriptor_d66ec2e140567106) }
|
||||
|
||||
var fileDescriptor_d66ec2e140567106 = []byte{
|
||||
// 276 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x41, 0x4b, 0xc3, 0x40,
|
||||
0x10, 0x85, 0xa9, 0x9b, 0xd8, 0x3a, 0x46, 0x2d, 0xab, 0x87, 0x40, 0xb5, 0x94, 0xbd, 0x58, 0x44,
|
||||
0x22, 0x88, 0xf8, 0x03, 0xea, 0xc1, 0x16, 0x8c, 0x48, 0xf4, 0xe4, 0x6d, 0x4d, 0x86, 0x35, 0xb0,
|
||||
0x4d, 0x42, 0x66, 0x54, 0xf2, 0x33, 0xfc, 0xc7, 0x92, 0xa4, 0xd1, 0xe6, 0xe4, 0x65, 0x99, 0xb7,
|
||||
0xdf, 0xec, 0xdb, 0xf7, 0xe0, 0xe8, 0x4d, 0x13, 0x5e, 0xd5, 0x47, 0x50, 0x94, 0x39, 0xe7, 0x12,
|
||||
0x38, 0x2e, 0x8c, 0x66, 0xfc, 0xd2, 0x95, 0x9a, 0x80, 0x58, 0x65, 0x2c, 0x4f, 0xc0, 0xfd, 0xd4,
|
||||
0xf6, 0x03, 0xfd, 0xc1, 0x6c, 0x30, 0x77, 0xa3, 0x56, 0xa8, 0x33, 0x70, 0x57, 0x19, 0xdf, 0xde,
|
||||
0xf4, 0xb1, 0xe8, 0xf0, 0x29, 0x38, 0x8b, 0x3c, 0xb7, 0x7d, 0x3a, 0xea, 0xe8, 0x14, 0x76, 0x9f,
|
||||
0xb9, 0x4c, 0x33, 0xd3, 0xe7, 0x7b, 0x5b, 0xe6, 0x8b, 0x8a, 0x91, 0xfa, 0xd8, 0xeb, 0xf0, 0x04,
|
||||
0x86, 0x21, 0x99, 0x25, 0xea, 0x44, 0x8e, 0x41, 0xc4, 0x69, 0xb2, 0x89, 0x56, 0x8f, 0xea, 0x1e,
|
||||
0x44, 0x48, 0x46, 0x9e, 0x83, 0xf3, 0x8e, 0xba, 0x25, 0xfb, 0xd7, 0xc7, 0xc1, 0x5f, 0xaf, 0x60,
|
||||
0xf3, 0x36, 0x6a, 0x16, 0x6a, 0x87, 0x12, 0xd9, 0xdf, 0x69, 0x1d, 0x4a, 0xe4, 0x0b, 0x77, 0x94,
|
||||
0x8c, 0xbf, 0x1f, 0xd5, 0x25, 0xc0, 0x9d, 0x4d, 0x31, 0xe3, 0x87, 0x94, 0x58, 0x4e, 0x01, 0xe2,
|
||||
0x5f, 0xe5, 0x0f, 0x66, 0x62, 0xee, 0x44, 0x5b, 0x37, 0xea, 0x15, 0xbc, 0x08, 0x0b, 0x5b, 0x85,
|
||||
0x48, 0xa4, 0x0d, 0xfe, 0xb7, 0x2f, 0x7d, 0x18, 0xae, 0xc9, 0xbc, 0x54, 0x05, 0x36, 0x5f, 0x1f,
|
||||
0x44, 0x9d, 0xac, 0x03, 0xad, 0xc9, 0xf8, 0xa2, 0x69, 0x5c, 0x8f, 0xea, 0x10, 0xbc, 0x27, 0xab,
|
||||
0x63, 0x5c, 0xe6, 0x36, 0xc1, 0x92, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xb1, 0xeb, 0xcb,
|
||||
0xb6, 0x01, 0x00, 0x00,
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package tcpgateway;
|
||||
|
||||
|
||||
message Int{
|
||||
optional int32 value = 1;
|
||||
}
|
||||
|
||||
|
||||
message Int64{
|
||||
optional int64 value = 1;
|
||||
}
|
||||
|
||||
|
||||
message Bool{
|
||||
optional bool value = 1;
|
||||
}
|
||||
|
||||
message String{
|
||||
optional string value = 1;
|
||||
}
|
||||
|
||||
message Bytes{
|
||||
optional bytes value = 1;
|
||||
}
|
||||
|
||||
|
||||
message MsgHead
|
||||
{
|
||||
optional int32 cid = 1;
|
||||
}
|
||||
|
||||
message Msg
|
||||
{
|
||||
optional MsgHead head = 1;
|
||||
optional int32 ret = 2;
|
||||
extensions 100 to 10000;
|
||||
}
|
||||
|
||||
message ClientList
|
||||
{
|
||||
repeated uint64 clientList = 1;
|
||||
}
|
||||
|
||||
message ReplyMessage
|
||||
{
|
||||
repeated uint64 clientList = 1;
|
||||
optional uint32 msgType = 2;
|
||||
optional bytes msg = 3;
|
||||
}
|
||||
|
||||
message PlaceHolders
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user