plugin.pb.go 15.5 KB
Newer Older
“李磊”'s avatar
“李磊” committed
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: plugin.proto

package proto

import (
	context "context"
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	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 Req struct {
	Header               *Header  `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"`
	Data                 []byte   `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Req) Reset()         { *m = Req{} }
func (m *Req) String() string { return proto.CompactTextString(m) }
func (*Req) ProtoMessage()    {}
func (*Req) Descriptor() ([]byte, []int) {
	return fileDescriptor_22a625af4bc1cc87, []int{0}
}

func (m *Req) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Req.Unmarshal(m, b)
}
func (m *Req) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Req.Marshal(b, m, deterministic)
}
func (m *Req) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Req.Merge(m, src)
}
func (m *Req) XXX_Size() int {
	return xxx_messageInfo_Req.Size(m)
}
func (m *Req) XXX_DiscardUnknown() {
	xxx_messageInfo_Req.DiscardUnknown(m)
}

var xxx_messageInfo_Req proto.InternalMessageInfo

func (m *Req) GetHeader() *Header {
	if m != nil {
		return m.Header
	}
	return nil
}

func (m *Req) GetData() []byte {
	if m != nil {
		return m.Data
	}
	return nil
}

type Res struct {
	Header               *Header  `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"`
	Code                 int32    `protobuf:"varint,2,opt,name=Code,proto3" json:"Code,omitempty"`
	Desc                 string   `protobuf:"bytes,3,opt,name=Desc,proto3" json:"Desc,omitempty"`
	Data                 []byte   `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Res) Reset()         { *m = Res{} }
func (m *Res) String() string { return proto.CompactTextString(m) }
func (*Res) ProtoMessage()    {}
func (*Res) Descriptor() ([]byte, []int) {
	return fileDescriptor_22a625af4bc1cc87, []int{1}
}

func (m *Res) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Res.Unmarshal(m, b)
}
func (m *Res) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Res.Marshal(b, m, deterministic)
}
func (m *Res) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Res.Merge(m, src)
}
func (m *Res) XXX_Size() int {
	return xxx_messageInfo_Res.Size(m)
}
func (m *Res) XXX_DiscardUnknown() {
	xxx_messageInfo_Res.DiscardUnknown(m)
}

var xxx_messageInfo_Res proto.InternalMessageInfo

func (m *Res) GetHeader() *Header {
	if m != nil {
		return m.Header
	}
	return nil
}

func (m *Res) GetCode() int32 {
	if m != nil {
		return m.Code
	}
	return 0
}

func (m *Res) GetDesc() string {
	if m != nil {
		return m.Desc
	}
	return ""
}

func (m *Res) GetData() []byte {
	if m != nil {
		return m.Data
	}
	return nil
}

type FileStream struct {
	Header               *Header  `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	Purpose              string   `protobuf:"bytes,3,opt,name=Purpose,proto3" json:"Purpose,omitempty"`
	TotalSize            int64    `protobuf:"varint,4,opt,name=TotalSize,proto3" json:"TotalSize,omitempty"`
	TotalPart            int64    `protobuf:"varint,5,opt,name=TotalPart,proto3" json:"TotalPart,omitempty"`
	Part                 int64    `protobuf:"varint,6,opt,name=Part,proto3" json:"Part,omitempty"`
	Data                 []byte   `protobuf:"bytes,7,opt,name=Data,proto3" json:"Data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *FileStream) Reset()         { *m = FileStream{} }
func (m *FileStream) String() string { return proto.CompactTextString(m) }
func (*FileStream) ProtoMessage()    {}
func (*FileStream) Descriptor() ([]byte, []int) {
	return fileDescriptor_22a625af4bc1cc87, []int{2}
}

func (m *FileStream) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_FileStream.Unmarshal(m, b)
}
func (m *FileStream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_FileStream.Marshal(b, m, deterministic)
}
func (m *FileStream) XXX_Merge(src proto.Message) {
	xxx_messageInfo_FileStream.Merge(m, src)
}
func (m *FileStream) XXX_Size() int {
	return xxx_messageInfo_FileStream.Size(m)
}
func (m *FileStream) XXX_DiscardUnknown() {
	xxx_messageInfo_FileStream.DiscardUnknown(m)
}

var xxx_messageInfo_FileStream proto.InternalMessageInfo

func (m *FileStream) GetHeader() *Header {
	if m != nil {
		return m.Header
	}
	return nil
}

func (m *FileStream) GetName() string {
	if m != nil {
		return m.Name
	}
	return ""
}

func (m *FileStream) GetPurpose() string {
	if m != nil {
		return m.Purpose
	}
	return ""
}

func (m *FileStream) GetTotalSize() int64 {
	if m != nil {
		return m.TotalSize
	}
	return 0
}

func (m *FileStream) GetTotalPart() int64 {
	if m != nil {
		return m.TotalPart
	}
	return 0
}

func (m *FileStream) GetPart() int64 {
	if m != nil {
		return m.Part
	}
	return 0
}

func (m *FileStream) GetData() []byte {
	if m != nil {
		return m.Data
	}
	return nil
}

type Header struct {
	UUID                 string   `protobuf:"bytes,1,opt,name=UUID,proto3" json:"UUID,omitempty"`
	Timestamp            int64    `protobuf:"varint,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	From                 string   `protobuf:"bytes,3,opt,name=From,proto3" json:"From,omitempty"`
	To                   string   `protobuf:"bytes,4,opt,name=To,proto3" json:"To,omitempty"`
	Func                 string   `protobuf:"bytes,5,opt,name=Func,proto3" json:"Func,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Header) Reset()         { *m = Header{} }
func (m *Header) String() string { return proto.CompactTextString(m) }
func (*Header) ProtoMessage()    {}
func (*Header) Descriptor() ([]byte, []int) {
	return fileDescriptor_22a625af4bc1cc87, []int{3}
}

func (m *Header) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Header.Unmarshal(m, b)
}
func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Header.Marshal(b, m, deterministic)
}
func (m *Header) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Header.Merge(m, src)
}
func (m *Header) XXX_Size() int {
	return xxx_messageInfo_Header.Size(m)
}
func (m *Header) XXX_DiscardUnknown() {
	xxx_messageInfo_Header.DiscardUnknown(m)
}

var xxx_messageInfo_Header proto.InternalMessageInfo

func (m *Header) GetUUID() string {
	if m != nil {
		return m.UUID
	}
	return ""
}

func (m *Header) GetTimestamp() int64 {
	if m != nil {
		return m.Timestamp
	}
	return 0
}

func (m *Header) GetFrom() string {
	if m != nil {
		return m.From
	}
	return ""
}

func (m *Header) GetTo() string {
	if m != nil {
		return m.To
	}
	return ""
}

func (m *Header) GetFunc() string {
	if m != nil {
		return m.Func
	}
	return ""
}

func init() {
	proto.RegisterType((*Req)(nil), "proto.Req")
	proto.RegisterType((*Res)(nil), "proto.Res")
	proto.RegisterType((*FileStream)(nil), "proto.FileStream")
	proto.RegisterType((*Header)(nil), "proto.Header")
}

func init() { proto.RegisterFile("plugin.proto", fileDescriptor_22a625af4bc1cc87) }

var fileDescriptor_22a625af4bc1cc87 = []byte{
	// 326 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x51, 0xc1, 0x4a, 0xc3, 0x40,
	0x10, 0x75, 0xdb, 0x34, 0x35, 0x63, 0x15, 0x9c, 0x53, 0x10, 0x0f, 0x21, 0x20, 0xe4, 0x62, 0x91,
	0xfa, 0x03, 0x42, 0x4b, 0xd1, 0x8b, 0x94, 0x6d, 0xfb, 0x01, 0x6b, 0x3b, 0xd8, 0x40, 0x92, 0x4d,
	0x37, 0x9b, 0x8b, 0xe0, 0xe7, 0xf9, 0x5f, 0xb2, 0xd3, 0xa4, 0x8d, 0x07, 0x0f, 0x3d, 0xe5, 0xcd,
	0x7b, 0x93, 0xf7, 0x66, 0x66, 0x61, 0x54, 0x66, 0xf5, 0x67, 0x5a, 0x8c, 0x4b, 0xa3, 0xad, 0xc6,
	0x01, 0x7f, 0xe2, 0x17, 0xe8, 0x4b, 0xda, 0xe3, 0x03, 0xf8, 0xaf, 0xa4, 0xb6, 0x64, 0x42, 0x11,
	0x89, 0xe4, 0x6a, 0x72, 0x7d, 0xe8, 0x1a, 0x1f, 0x48, 0xd9, 0x88, 0x88, 0xe0, 0xcd, 0x94, 0x55,
	0x61, 0x2f, 0x12, 0xc9, 0x48, 0x32, 0x8e, 0x77, 0xce, 0xa1, 0x3a, 0xc3, 0x61, 0xaa, 0xb7, 0xc4,
	0x0e, 0x03, 0xc9, 0x98, 0x5d, 0xa9, 0xda, 0x84, 0xfd, 0x48, 0x24, 0x81, 0x64, 0x7c, 0x4c, 0xf2,
	0x3a, 0x49, 0x3f, 0x02, 0x60, 0x9e, 0x66, 0xb4, 0xb4, 0x86, 0x54, 0x7e, 0x46, 0xe2, 0xbb, 0xca,
	0x0f, 0x89, 0x81, 0x64, 0x8c, 0x21, 0x0c, 0x17, 0xb5, 0x29, 0x75, 0x45, 0x4d, 0x68, 0x5b, 0xe2,
	0x3d, 0x04, 0x2b, 0x6d, 0x55, 0xb6, 0x4c, 0xbf, 0x88, 0xc3, 0xfb, 0xf2, 0x44, 0x1c, 0xd5, 0x85,
	0x32, 0x36, 0x1c, 0x74, 0x54, 0x47, 0xb8, 0x24, 0x16, 0x7c, 0x16, 0xbc, 0x96, 0xe3, 0x3d, 0x86,
	0x9d, 0x3d, 0x0c, 0x74, 0x66, 0x5b, 0xaf, 0xdf, 0x66, 0xbc, 0x40, 0x20, 0x19, 0x73, 0x46, 0x9a,
	0x53, 0x65, 0x55, 0x5e, 0xf2, 0xd0, 0x2e, 0xa3, 0x25, 0xdc, 0x1f, 0x73, 0xa3, 0xf3, 0xf6, 0x56,
	0x0e, 0xe3, 0x0d, 0xf4, 0x56, 0x9a, 0x87, 0x0d, 0x64, 0x6f, 0xa5, 0xb9, 0xa7, 0x2e, 0x36, 0x3c,
	0xa0, 0xeb, 0xa9, 0x8b, 0xcd, 0xe4, 0x1b, 0xfc, 0x05, 0x3f, 0x3f, 0x46, 0xe0, 0x4d, 0x55, 0x96,
	0x21, 0x34, 0xe7, 0x92, 0xb4, 0xbf, 0x3b, 0xe1, 0x2a, 0xbe, 0xc0, 0x47, 0xb8, 0x5c, 0x52, 0xb1,
	0x75, 0xa7, 0xc6, 0xdb, 0x46, 0x39, 0xdd, 0xfd, 0x6f, 0x73, 0x22, 0x30, 0x06, 0x6f, 0xba, 0x53,
	0xf6, 0x7f, 0xc3, 0x27, 0xf1, 0xe1, 0x73, 0xf9, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x6c,
	0xc9, 0x75, 0x84, 0x02, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// PluginClient is the client API for Plugin service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PluginClient interface {
	Call(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Res, error)
	SendFile(ctx context.Context, opts ...grpc.CallOption) (Plugin_SendFileClient, error)
	Chat(ctx context.Context, in *Req, opts ...grpc.CallOption) (Plugin_ChatClient, error)
}

type pluginClient struct {
	cc *grpc.ClientConn
}

func NewPluginClient(cc *grpc.ClientConn) PluginClient {
	return &pluginClient{cc}
}

func (c *pluginClient) Call(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Res, error) {
	out := new(Res)
	err := c.cc.Invoke(ctx, "/proto.Plugin/Call", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *pluginClient) SendFile(ctx context.Context, opts ...grpc.CallOption) (Plugin_SendFileClient, error) {
	stream, err := c.cc.NewStream(ctx, &_Plugin_serviceDesc.Streams[0], "/proto.Plugin/SendFile", opts...)
	if err != nil {
		return nil, err
	}
	x := &pluginSendFileClient{stream}
	return x, nil
}

type Plugin_SendFileClient interface {
	Send(*FileStream) error
	CloseAndRecv() (*Res, error)
	grpc.ClientStream
}

type pluginSendFileClient struct {
	grpc.ClientStream
}

func (x *pluginSendFileClient) Send(m *FileStream) error {
	return x.ClientStream.SendMsg(m)
}

func (x *pluginSendFileClient) CloseAndRecv() (*Res, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(Res)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *pluginClient) Chat(ctx context.Context, in *Req, opts ...grpc.CallOption) (Plugin_ChatClient, error) {
	stream, err := c.cc.NewStream(ctx, &_Plugin_serviceDesc.Streams[1], "/proto.Plugin/Chat", opts...)
	if err != nil {
		return nil, err
	}
	x := &pluginChatClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type Plugin_ChatClient interface {
	Recv() (*Res, error)
	grpc.ClientStream
}

type pluginChatClient struct {
	grpc.ClientStream
}

func (x *pluginChatClient) Recv() (*Res, error) {
	m := new(Res)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// PluginServer is the server API for Plugin service.
type PluginServer interface {
	Call(context.Context, *Req) (*Res, error)
	SendFile(Plugin_SendFileServer) error
	Chat(*Req, Plugin_ChatServer) error
}

// UnimplementedPluginServer can be embedded to have forward compatible implementations.
type UnimplementedPluginServer struct {
}

func (*UnimplementedPluginServer) Call(ctx context.Context, req *Req) (*Res, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
}
func (*UnimplementedPluginServer) SendFile(srv Plugin_SendFileServer) error {
	return status.Errorf(codes.Unimplemented, "method SendFile not implemented")
}
func (*UnimplementedPluginServer) Chat(req *Req, srv Plugin_ChatServer) error {
	return status.Errorf(codes.Unimplemented, "method Chat not implemented")
}

func RegisterPluginServer(s *grpc.Server, srv PluginServer) {
	s.RegisterService(&_Plugin_serviceDesc, srv)
}

func _Plugin_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Req)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PluginServer).Call(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/proto.Plugin/Call",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PluginServer).Call(ctx, req.(*Req))
	}
	return interceptor(ctx, in, info, handler)
}

func _Plugin_SendFile_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(PluginServer).SendFile(&pluginSendFileServer{stream})
}

type Plugin_SendFileServer interface {
	SendAndClose(*Res) error
	Recv() (*FileStream, error)
	grpc.ServerStream
}

type pluginSendFileServer struct {
	grpc.ServerStream
}

func (x *pluginSendFileServer) SendAndClose(m *Res) error {
	return x.ServerStream.SendMsg(m)
}

func (x *pluginSendFileServer) Recv() (*FileStream, error) {
	m := new(FileStream)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _Plugin_Chat_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Req)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(PluginServer).Chat(m, &pluginChatServer{stream})
}

type Plugin_ChatServer interface {
	Send(*Res) error
	grpc.ServerStream
}

type pluginChatServer struct {
	grpc.ServerStream
}

func (x *pluginChatServer) Send(m *Res) error {
	return x.ServerStream.SendMsg(m)
}

var _Plugin_serviceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Plugin",
	HandlerType: (*PluginServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Call",
			Handler:    _Plugin_Call_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SendFile",
			Handler:       _Plugin_SendFile_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "Chat",
			Handler:       _Plugin_Chat_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "plugin.proto",
}