Documentation
¶
Index ¶
- Variables
- func NewXClientForGate(addr string) (client.XClient, error)
- func ServeForGate(addr string) error
- type Cmd
- type GateAble
- type GateClient
- type GateImpl
- type GateOneClient
- type SendMsgData
- func (*SendMsgData) Descriptor() ([]byte, []int)
- func (m *SendMsgData) GetDataJson() []byte
- func (m *SendMsgData) GetDataProto() []byte
- func (m *SendMsgData) GetTo() int64
- func (m *SendMsgData) GetType() SendMsgDataToType
- func (m *SendMsgData) Marshal() (dAtA []byte, err error)
- func (m *SendMsgData) MarshalTo(dAtA []byte) (int, error)
- func (m *SendMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SendMsgData) ProtoMessage()
- func (m *SendMsgData) Reset()
- func (m *SendMsgData) Size() (n int)
- func (m *SendMsgData) String() string
- func (m *SendMsgData) Unmarshal(dAtA []byte) error
- func (m *SendMsgData) XXX_DiscardUnknown()
- func (m *SendMsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SendMsgData) XXX_Merge(src proto.Message)
- func (m *SendMsgData) XXX_Size() int
- func (m *SendMsgData) XXX_Unmarshal(b []byte) error
- type SendMsgDataReply
- func (*SendMsgDataReply) Descriptor() ([]byte, []int)
- func (m *SendMsgDataReply) GetCode() SendMsgDataReplyCodeType
- func (m *SendMsgDataReply) Marshal() (dAtA []byte, err error)
- func (m *SendMsgDataReply) MarshalTo(dAtA []byte) (int, error)
- func (m *SendMsgDataReply) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SendMsgDataReply) ProtoMessage()
- func (m *SendMsgDataReply) Reset()
- func (m *SendMsgDataReply) Size() (n int)
- func (m *SendMsgDataReply) String() string
- func (m *SendMsgDataReply) Unmarshal(dAtA []byte) error
- func (m *SendMsgDataReply) XXX_DiscardUnknown()
- func (m *SendMsgDataReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SendMsgDataReply) XXX_Merge(src proto.Message)
- func (m *SendMsgDataReply) XXX_Size() int
- func (m *SendMsgDataReply) XXX_Unmarshal(b []byte) error
- type SendMsgDataReplyCodeType
- type SendMsgDataToType
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthGate = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGate = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGate = fmt.Errorf("proto: unexpected end of group") )
var Cmd_name = map[int32]string{
0: "SerializeNone",
1: "JSON",
2: "ProtoBuffer",
}
var Cmd_value = map[string]int32{
"SerializeNone": 0,
"JSON": 1,
"ProtoBuffer": 2,
}
var SendMsgDataReplyCodeType_name = map[int32]string{
0: "Code_None",
200: "Success",
}
var SendMsgDataReplyCodeType_value = map[string]int32{
"Code_None": 0,
"Success": 200,
}
var SendMsgDataToType_name = map[int32]string{
0: "To_None",
1: "To_Conn",
2: "To_All",
}
var SendMsgDataToType_value = map[string]int32{
"To_None": 0,
"To_Conn": 1,
"To_All": 2,
}
Functions ¶
func NewXClientForGate ¶
NewXClientForGate creates a XClient. You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.
func ServeForGate ¶
ServeForGate starts a server only registers one service. You can register more services and only start one server. It blocks until the application exits.
Types ¶
type GateAble ¶
type GateAble interface { // SendMsg is server rpc method as defined SendMsg(ctx context.Context, args *SendMsgData, reply *SendMsgDataReply) (err error) }
================== interface skeleton ===================
type GateClient ¶
type GateClient struct {
// contains filtered or unexported fields
}
================== client stub =================== Gate is a client wrapped XClient.
func NewGateClient ¶
func NewGateClient(xclient client.XClient) *GateClient
NewGateClient wraps a XClient as GateClient. You can pass a shared XClient object created by NewXClientForGate.
func (*GateClient) SendMsg ¶
func (c *GateClient) SendMsg(ctx context.Context, args *SendMsgData) (reply *SendMsgDataReply, err error)
SendMsg is client rpc method as defined
type GateImpl ¶
type GateImpl struct{}
================== server skeleton ===================
func (*GateImpl) SendMsg ¶
func (s *GateImpl) SendMsg(ctx context.Context, args *SendMsgData, reply *SendMsgDataReply) (err error)
SendMsg is server rpc method as defined
type GateOneClient ¶
type GateOneClient struct {
// contains filtered or unexported fields
}
================== oneclient stub =================== GateOneClient is a client wrapped oneClient.
func NewGateOneClient ¶
func NewGateOneClient(oneclient *client.OneClient) *GateOneClient
NewGateOneClient wraps a OneClient as GateOneClient. You can pass a shared OneClient object created by NewOneClientForGate.
func (*GateOneClient) SendMsg ¶
func (c *GateOneClient) SendMsg(ctx context.Context, args *SendMsgData) (reply *SendMsgDataReply, err error)
SendMsg is client rpc method as defined
type SendMsgData ¶
type SendMsgData struct { To int64 `protobuf:"varint,1,opt,name=to,proto3" json:"to,omitempty"` Type SendMsgDataToType `protobuf:"varint,2,opt,name=type,proto3,enum=pbgate.SendMsgDataToType" json:"type,omitempty"` DataJson []byte `protobuf:"bytes,4,opt,name=dataJson,proto3" json:"dataJson,omitempty"` DataProto []byte `protobuf:"bytes,5,opt,name=dataProto,proto3" json:"dataProto,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SendMsgData) Descriptor ¶
func (*SendMsgData) Descriptor() ([]byte, []int)
func (*SendMsgData) GetDataJson ¶
func (m *SendMsgData) GetDataJson() []byte
func (*SendMsgData) GetDataProto ¶
func (m *SendMsgData) GetDataProto() []byte
func (*SendMsgData) GetTo ¶
func (m *SendMsgData) GetTo() int64
func (*SendMsgData) GetType ¶
func (m *SendMsgData) GetType() SendMsgDataToType
func (*SendMsgData) Marshal ¶
func (m *SendMsgData) Marshal() (dAtA []byte, err error)
func (*SendMsgData) MarshalToSizedBuffer ¶
func (m *SendMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SendMsgData) ProtoMessage ¶
func (*SendMsgData) ProtoMessage()
func (*SendMsgData) Reset ¶
func (m *SendMsgData) Reset()
func (*SendMsgData) Size ¶
func (m *SendMsgData) Size() (n int)
func (*SendMsgData) String ¶
func (m *SendMsgData) String() string
func (*SendMsgData) Unmarshal ¶
func (m *SendMsgData) Unmarshal(dAtA []byte) error
func (*SendMsgData) XXX_DiscardUnknown ¶
func (m *SendMsgData) XXX_DiscardUnknown()
func (*SendMsgData) XXX_Marshal ¶
func (m *SendMsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SendMsgData) XXX_Merge ¶
func (m *SendMsgData) XXX_Merge(src proto.Message)
func (*SendMsgData) XXX_Size ¶
func (m *SendMsgData) XXX_Size() int
func (*SendMsgData) XXX_Unmarshal ¶
func (m *SendMsgData) XXX_Unmarshal(b []byte) error
type SendMsgDataReply ¶
type SendMsgDataReply struct { Code SendMsgDataReplyCodeType `protobuf:"varint,1,opt,name=code,proto3,enum=pbgate.SendMsgDataReplyCodeType" json:"code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SendMsgDataReply) Descriptor ¶
func (*SendMsgDataReply) Descriptor() ([]byte, []int)
func (*SendMsgDataReply) GetCode ¶
func (m *SendMsgDataReply) GetCode() SendMsgDataReplyCodeType
func (*SendMsgDataReply) Marshal ¶
func (m *SendMsgDataReply) Marshal() (dAtA []byte, err error)
func (*SendMsgDataReply) MarshalToSizedBuffer ¶
func (m *SendMsgDataReply) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SendMsgDataReply) ProtoMessage ¶
func (*SendMsgDataReply) ProtoMessage()
func (*SendMsgDataReply) Reset ¶
func (m *SendMsgDataReply) Reset()
func (*SendMsgDataReply) Size ¶
func (m *SendMsgDataReply) Size() (n int)
func (*SendMsgDataReply) String ¶
func (m *SendMsgDataReply) String() string
func (*SendMsgDataReply) Unmarshal ¶
func (m *SendMsgDataReply) Unmarshal(dAtA []byte) error
func (*SendMsgDataReply) XXX_DiscardUnknown ¶
func (m *SendMsgDataReply) XXX_DiscardUnknown()
func (*SendMsgDataReply) XXX_Marshal ¶
func (m *SendMsgDataReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SendMsgDataReply) XXX_Merge ¶
func (m *SendMsgDataReply) XXX_Merge(src proto.Message)
func (*SendMsgDataReply) XXX_Size ¶
func (m *SendMsgDataReply) XXX_Size() int
func (*SendMsgDataReply) XXX_Unmarshal ¶
func (m *SendMsgDataReply) XXX_Unmarshal(b []byte) error
type SendMsgDataReplyCodeType ¶
type SendMsgDataReplyCodeType int32
const ( SendMsgDataReply_Code_None SendMsgDataReplyCodeType = 0 SendMsgDataReply_Success SendMsgDataReplyCodeType = 200 )
func (SendMsgDataReplyCodeType) EnumDescriptor ¶
func (SendMsgDataReplyCodeType) EnumDescriptor() ([]byte, []int)
func (SendMsgDataReplyCodeType) String ¶
func (x SendMsgDataReplyCodeType) String() string
type SendMsgDataToType ¶
type SendMsgDataToType int32
const ( SendMsgData_To_None SendMsgDataToType = 0 SendMsgData_To_Conn SendMsgDataToType = 1 SendMsgData_To_All SendMsgDataToType = 2 )
func (SendMsgDataToType) EnumDescriptor ¶
func (SendMsgDataToType) EnumDescriptor() ([]byte, []int)
func (SendMsgDataToType) String ¶
func (x SendMsgDataToType) String() string