/
control_grpc.pb.go
462 lines (425 loc) 路 16.3 KB
/
control_grpc.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
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
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package drand
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// 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.SupportPackageIsVersion6
// ControlClient is the client API for Control service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ControlClient interface {
// PingPong returns an empty message. Purpose is to test the control port.
PingPong(ctx context.Context, in *Ping, opts ...grpc.CallOption) (*Pong, error)
// InitDKG sends information to daemon to start a fresh DKG protocol
InitDKG(ctx context.Context, in *InitDKGPacket, opts ...grpc.CallOption) (*GroupPacket, error)
// InitReshares sends all informations so that the drand node knows how to
// proceeed during the next resharing protocol.
InitReshare(ctx context.Context, in *InitResharePacket, opts ...grpc.CallOption) (*GroupPacket, error)
// Share returns the current private share used by the node
Share(ctx context.Context, in *ShareRequest, opts ...grpc.CallOption) (*ShareResponse, error)
// PublicKey returns the longterm public key of the drand node
PublicKey(ctx context.Context, in *PublicKeyRequest, opts ...grpc.CallOption) (*PublicKeyResponse, error)
// PrivateKey returns the longterm private key of the drand node
PrivateKey(ctx context.Context, in *PrivateKeyRequest, opts ...grpc.CallOption) (*PrivateKeyResponse, error)
// CollectiveKey returns the distributed public key used by the node
ChainInfo(ctx context.Context, in *ChainInfoRequest, opts ...grpc.CallOption) (*ChainInfoPacket, error)
// GroupFile returns the TOML-encoded group file
// similar to public.Group method but needed for ease of use of the
// control functionalities
GroupFile(ctx context.Context, in *GroupRequest, opts ...grpc.CallOption) (*GroupPacket, error)
Shutdown(ctx context.Context, in *ShutdownRequest, opts ...grpc.CallOption) (*ShutdownResponse, error)
StartFollowChain(ctx context.Context, in *StartFollowRequest, opts ...grpc.CallOption) (Control_StartFollowChainClient, error)
}
type controlClient struct {
cc grpc.ClientConnInterface
}
func NewControlClient(cc grpc.ClientConnInterface) ControlClient {
return &controlClient{cc}
}
func (c *controlClient) PingPong(ctx context.Context, in *Ping, opts ...grpc.CallOption) (*Pong, error) {
out := new(Pong)
err := c.cc.Invoke(ctx, "/drand.Control/PingPong", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) InitDKG(ctx context.Context, in *InitDKGPacket, opts ...grpc.CallOption) (*GroupPacket, error) {
out := new(GroupPacket)
err := c.cc.Invoke(ctx, "/drand.Control/InitDKG", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) InitReshare(ctx context.Context, in *InitResharePacket, opts ...grpc.CallOption) (*GroupPacket, error) {
out := new(GroupPacket)
err := c.cc.Invoke(ctx, "/drand.Control/InitReshare", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) Share(ctx context.Context, in *ShareRequest, opts ...grpc.CallOption) (*ShareResponse, error) {
out := new(ShareResponse)
err := c.cc.Invoke(ctx, "/drand.Control/Share", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) PublicKey(ctx context.Context, in *PublicKeyRequest, opts ...grpc.CallOption) (*PublicKeyResponse, error) {
out := new(PublicKeyResponse)
err := c.cc.Invoke(ctx, "/drand.Control/PublicKey", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) PrivateKey(ctx context.Context, in *PrivateKeyRequest, opts ...grpc.CallOption) (*PrivateKeyResponse, error) {
out := new(PrivateKeyResponse)
err := c.cc.Invoke(ctx, "/drand.Control/PrivateKey", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) ChainInfo(ctx context.Context, in *ChainInfoRequest, opts ...grpc.CallOption) (*ChainInfoPacket, error) {
out := new(ChainInfoPacket)
err := c.cc.Invoke(ctx, "/drand.Control/ChainInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) GroupFile(ctx context.Context, in *GroupRequest, opts ...grpc.CallOption) (*GroupPacket, error) {
out := new(GroupPacket)
err := c.cc.Invoke(ctx, "/drand.Control/GroupFile", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) Shutdown(ctx context.Context, in *ShutdownRequest, opts ...grpc.CallOption) (*ShutdownResponse, error) {
out := new(ShutdownResponse)
err := c.cc.Invoke(ctx, "/drand.Control/Shutdown", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) StartFollowChain(ctx context.Context, in *StartFollowRequest, opts ...grpc.CallOption) (Control_StartFollowChainClient, error) {
stream, err := c.cc.NewStream(ctx, &_Control_serviceDesc.Streams[0], "/drand.Control/StartFollowChain", opts...)
if err != nil {
return nil, err
}
x := &controlStartFollowChainClient{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 Control_StartFollowChainClient interface {
Recv() (*FollowProgress, error)
grpc.ClientStream
}
type controlStartFollowChainClient struct {
grpc.ClientStream
}
func (x *controlStartFollowChainClient) Recv() (*FollowProgress, error) {
m := new(FollowProgress)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// ControlServer is the server API for Control service.
// All implementations should embed UnimplementedControlServer
// for forward compatibility
type ControlServer interface {
// PingPong returns an empty message. Purpose is to test the control port.
PingPong(context.Context, *Ping) (*Pong, error)
// InitDKG sends information to daemon to start a fresh DKG protocol
InitDKG(context.Context, *InitDKGPacket) (*GroupPacket, error)
// InitReshares sends all informations so that the drand node knows how to
// proceeed during the next resharing protocol.
InitReshare(context.Context, *InitResharePacket) (*GroupPacket, error)
// Share returns the current private share used by the node
Share(context.Context, *ShareRequest) (*ShareResponse, error)
// PublicKey returns the longterm public key of the drand node
PublicKey(context.Context, *PublicKeyRequest) (*PublicKeyResponse, error)
// PrivateKey returns the longterm private key of the drand node
PrivateKey(context.Context, *PrivateKeyRequest) (*PrivateKeyResponse, error)
// CollectiveKey returns the distributed public key used by the node
ChainInfo(context.Context, *ChainInfoRequest) (*ChainInfoPacket, error)
// GroupFile returns the TOML-encoded group file
// similar to public.Group method but needed for ease of use of the
// control functionalities
GroupFile(context.Context, *GroupRequest) (*GroupPacket, error)
Shutdown(context.Context, *ShutdownRequest) (*ShutdownResponse, error)
StartFollowChain(*StartFollowRequest, Control_StartFollowChainServer) error
}
// UnimplementedControlServer should be embedded to have forward compatible implementations.
type UnimplementedControlServer struct {
}
func (*UnimplementedControlServer) PingPong(context.Context, *Ping) (*Pong, error) {
return nil, status.Errorf(codes.Unimplemented, "method PingPong not implemented")
}
func (*UnimplementedControlServer) InitDKG(context.Context, *InitDKGPacket) (*GroupPacket, error) {
return nil, status.Errorf(codes.Unimplemented, "method InitDKG not implemented")
}
func (*UnimplementedControlServer) InitReshare(context.Context, *InitResharePacket) (*GroupPacket, error) {
return nil, status.Errorf(codes.Unimplemented, "method InitReshare not implemented")
}
func (*UnimplementedControlServer) Share(context.Context, *ShareRequest) (*ShareResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Share not implemented")
}
func (*UnimplementedControlServer) PublicKey(context.Context, *PublicKeyRequest) (*PublicKeyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PublicKey not implemented")
}
func (*UnimplementedControlServer) PrivateKey(context.Context, *PrivateKeyRequest) (*PrivateKeyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PrivateKey not implemented")
}
func (*UnimplementedControlServer) ChainInfo(context.Context, *ChainInfoRequest) (*ChainInfoPacket, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChainInfo not implemented")
}
func (*UnimplementedControlServer) GroupFile(context.Context, *GroupRequest) (*GroupPacket, error) {
return nil, status.Errorf(codes.Unimplemented, "method GroupFile not implemented")
}
func (*UnimplementedControlServer) Shutdown(context.Context, *ShutdownRequest) (*ShutdownResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented")
}
func (*UnimplementedControlServer) StartFollowChain(*StartFollowRequest, Control_StartFollowChainServer) error {
return status.Errorf(codes.Unimplemented, "method StartFollowChain not implemented")
}
func RegisterControlServer(s *grpc.Server, srv ControlServer) {
s.RegisterService(&_Control_serviceDesc, srv)
}
func _Control_PingPong_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Ping)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).PingPong(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/PingPong",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).PingPong(ctx, req.(*Ping))
}
return interceptor(ctx, in, info, handler)
}
func _Control_InitDKG_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InitDKGPacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).InitDKG(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/InitDKG",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).InitDKG(ctx, req.(*InitDKGPacket))
}
return interceptor(ctx, in, info, handler)
}
func _Control_InitReshare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InitResharePacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).InitReshare(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/InitReshare",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).InitReshare(ctx, req.(*InitResharePacket))
}
return interceptor(ctx, in, info, handler)
}
func _Control_Share_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ShareRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).Share(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/Share",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).Share(ctx, req.(*ShareRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_PublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PublicKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).PublicKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/PublicKey",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).PublicKey(ctx, req.(*PublicKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_PrivateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PrivateKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).PrivateKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/PrivateKey",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).PrivateKey(ctx, req.(*PrivateKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_ChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChainInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).ChainInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/ChainInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).ChainInfo(ctx, req.(*ChainInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_GroupFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GroupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).GroupFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/GroupFile",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).GroupFile(ctx, req.(*GroupRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ShutdownRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).Shutdown(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Control/Shutdown",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).Shutdown(ctx, req.(*ShutdownRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_StartFollowChain_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StartFollowRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ControlServer).StartFollowChain(m, &controlStartFollowChainServer{stream})
}
type Control_StartFollowChainServer interface {
Send(*FollowProgress) error
grpc.ServerStream
}
type controlStartFollowChainServer struct {
grpc.ServerStream
}
func (x *controlStartFollowChainServer) Send(m *FollowProgress) error {
return x.ServerStream.SendMsg(m)
}
var _Control_serviceDesc = grpc.ServiceDesc{
ServiceName: "drand.Control",
HandlerType: (*ControlServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "PingPong",
Handler: _Control_PingPong_Handler,
},
{
MethodName: "InitDKG",
Handler: _Control_InitDKG_Handler,
},
{
MethodName: "InitReshare",
Handler: _Control_InitReshare_Handler,
},
{
MethodName: "Share",
Handler: _Control_Share_Handler,
},
{
MethodName: "PublicKey",
Handler: _Control_PublicKey_Handler,
},
{
MethodName: "PrivateKey",
Handler: _Control_PrivateKey_Handler,
},
{
MethodName: "ChainInfo",
Handler: _Control_ChainInfo_Handler,
},
{
MethodName: "GroupFile",
Handler: _Control_GroupFile_Handler,
},
{
MethodName: "Shutdown",
Handler: _Control_Shutdown_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StartFollowChain",
Handler: _Control_StartFollowChain_Handler,
ServerStreams: true,
},
},
Metadata: "drand/control.proto",
}