/
room.pb.go
227 lines (188 loc) · 7.55 KB
/
room.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: pigeon/room.proto
package pigeon
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
client "github.com/smallnest/rpcx/client"
protocol "github.com/smallnest/rpcx/protocol"
server "github.com/smallnest/rpcx/server"
common "github.com/wwengg/proto/common"
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.ProtoPackageIsVersion3 // please upgrade the proto package
type RoomType int32
const (
RoomType_ChatRoom RoomType = 0
RoomType_LiveRoom RoomType = 1
)
var RoomType_name = map[int32]string{
0: "ChatRoom",
1: "LiveRoom",
}
var RoomType_value = map[string]int32{
"ChatRoom": 0,
"LiveRoom": 1,
}
func (x RoomType) String() string {
return proto.EnumName(RoomType_name, int32(x))
}
func (RoomType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_f6d7adb85947422e, []int{0}
}
type JoinRoomArgs struct {
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
RoomId int64 `protobuf:"varint,2,opt,name=roomId,proto3" json:"roomId,omitempty"`
RoomType RoomType `protobuf:"varint,3,opt,name=roomType,proto3,enum=proto.pigeon.RoomType" json:"roomType,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *JoinRoomArgs) Reset() { *m = JoinRoomArgs{} }
func (m *JoinRoomArgs) String() string { return proto.CompactTextString(m) }
func (*JoinRoomArgs) ProtoMessage() {}
func (*JoinRoomArgs) Descriptor() ([]byte, []int) {
return fileDescriptor_f6d7adb85947422e, []int{0}
}
func (m *JoinRoomArgs) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_JoinRoomArgs.Unmarshal(m, b)
}
func (m *JoinRoomArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_JoinRoomArgs.Marshal(b, m, deterministic)
}
func (m *JoinRoomArgs) XXX_Merge(src proto.Message) {
xxx_messageInfo_JoinRoomArgs.Merge(m, src)
}
func (m *JoinRoomArgs) XXX_Size() int {
return xxx_messageInfo_JoinRoomArgs.Size(m)
}
func (m *JoinRoomArgs) XXX_DiscardUnknown() {
xxx_messageInfo_JoinRoomArgs.DiscardUnknown(m)
}
var xxx_messageInfo_JoinRoomArgs proto.InternalMessageInfo
func (m *JoinRoomArgs) GetId() int64 {
if m != nil {
return m.Id
}
return 0
}
func (m *JoinRoomArgs) GetRoomId() int64 {
if m != nil {
return m.RoomId
}
return 0
}
func (m *JoinRoomArgs) GetRoomType() RoomType {
if m != nil {
return m.RoomType
}
return RoomType_ChatRoom
}
func init() {
proto.RegisterEnum("proto.pigeon.RoomType", RoomType_name, RoomType_value)
proto.RegisterType((*JoinRoomArgs)(nil), "proto.pigeon.JoinRoomArgs")
}
func init() {
proto.RegisterFile("pigeon/room.proto", fileDescriptor_f6d7adb85947422e)
}
var fileDescriptor_f6d7adb85947422e = []byte{
// 228 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0xc8, 0x4c, 0x4f,
0xcd, 0xcf, 0xd3, 0x2f, 0xca, 0xcf, 0xcf, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01,
0x53, 0x7a, 0x10, 0x09, 0x29, 0xe1, 0xe4, 0xfc, 0xdc, 0xdc, 0xfc, 0x3c, 0x7d, 0x08, 0x05, 0x51,
0xa2, 0x94, 0xc5, 0xc5, 0xe3, 0x95, 0x9f, 0x99, 0x17, 0x94, 0x9f, 0x9f, 0xeb, 0x58, 0x94, 0x5e,
0x2c, 0xc4, 0xc7, 0xc5, 0x94, 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x1c, 0xc4, 0x94, 0x99,
0x22, 0x24, 0xc6, 0xc5, 0x06, 0x32, 0xd0, 0x33, 0x45, 0x82, 0x09, 0x2c, 0x06, 0xe5, 0x09, 0x19,
0x71, 0x71, 0x80, 0x58, 0x21, 0x95, 0x05, 0xa9, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x7c, 0x46, 0x62,
0x7a, 0xc8, 0xb6, 0xe9, 0x05, 0x41, 0x65, 0x83, 0xe0, 0xea, 0xb4, 0xd4, 0xb8, 0x38, 0x60, 0xa2,
0x42, 0x3c, 0x5c, 0x1c, 0xce, 0x19, 0x89, 0x25, 0x20, 0xbe, 0x00, 0x03, 0x88, 0xe7, 0x93, 0x59,
0x96, 0x0a, 0xe6, 0x31, 0x1a, 0x79, 0x71, 0x71, 0x83, 0x58, 0xc1, 0xa9, 0x45, 0x65, 0x99, 0xc9,
0xa9, 0x42, 0xd6, 0x5c, 0x1c, 0x30, 0x27, 0x0a, 0x49, 0xa1, 0x5a, 0x82, 0xec, 0x74, 0x29, 0x41,
0xa8, 0x1c, 0xd4, 0x7f, 0xae, 0x45, 0x45, 0x4a, 0x0c, 0x4e, 0x0a, 0x51, 0x72, 0xe9, 0x99, 0x25,
0x19, 0xa5, 0x49, 0x20, 0x61, 0xfd, 0xf2, 0xf2, 0xd4, 0xbc, 0xf4, 0x74, 0x7d, 0xb0, 0x3a, 0x7d,
0x88, 0x19, 0x49, 0x6c, 0x60, 0x9e, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xea, 0x37, 0x65, 0xc5,
0x40, 0x01, 0x00, 0x00,
}
// This following code was generated by rpcx
// Gernerated from pigeon/room.proto
//================== interface skeleton ===================
type RoomServiceAble interface {
// RoomServiceAble can be used for interface verification.
// JoinRoom is server rpc method as defined
JoinRoom(ctx context.Context, args *JoinRoomArgs, reply *common.Err) (err error)
}
//================== server skeleton ===================
type RoomServiceImpl struct{}
// ServeForRoomService starts a server only registers one service.
// You can register more services and only start one server.
// It blocks until the application exits.
func ServeForRoomService(addr string) error {
s := server.NewServer()
s.RegisterName("RoomService", new(RoomServiceImpl), "")
return s.Serve("tcp", addr)
}
// JoinRoom is server rpc method as defined
func (s *RoomServiceImpl) JoinRoom(ctx context.Context, args *JoinRoomArgs, reply *common.Err) (err error) {
// TODO: add business logics
// TODO: setting return values
*reply = common.Err{}
return nil
}
//================== client stub ===================
// RoomService is a client wrapped XClient.
type RoomServiceClient struct {
xclient client.XClient
}
// NewRoomServiceClient wraps a XClient as RoomServiceClient.
// You can pass a shared XClient object created by NewXClientForRoomService.
func NewRoomServiceClient(xclient client.XClient) *RoomServiceClient {
return &RoomServiceClient{xclient: xclient}
}
// NewXClientForRoomService creates a XClient.
// You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.
func NewXClientForRoomService(addr string) (client.XClient, error) {
d, err := client.NewPeer2PeerDiscovery("tcp@"+addr, "")
if err != nil {
return nil, err
}
opt := client.DefaultOption
opt.SerializeType = protocol.ProtoBuffer
xclient := client.NewXClient("RoomService", client.Failtry, client.RoundRobin, d, opt)
return xclient, nil
}
// JoinRoom is client rpc method as defined
func (c *RoomServiceClient) JoinRoom(ctx context.Context, args *JoinRoomArgs) (reply *common.Err, err error) {
reply = &common.Err{}
err = c.xclient.Call(ctx, "JoinRoom", args, reply)
return reply, err
}
//================== oneclient stub ===================
// RoomServiceOneClient is a client wrapped oneClient.
type RoomServiceOneClient struct {
serviceName string
oneclient client.OneClient
}
// NewRoomServiceOneClient wraps a OneClient as RoomServiceOneClient.
// You can pass a shared OneClient object created by NewOneClientForRoomService.
func NewRoomServiceOneClient(oneclient client.OneClient) *RoomServiceOneClient {
return &RoomServiceOneClient{
serviceName: "RoomService",
oneclient: oneclient,
}
}
// ======================================================
// JoinRoom is client rpc method as defined
func (c *RoomServiceOneClient) JoinRoom(ctx context.Context, args *JoinRoomArgs) (reply *common.Err, err error) {
reply = &common.Err{}
err = c.oneclient.Call(ctx, c.serviceName, "JoinRoom", args, reply)
return reply, err
}