/
protocol_grpc.pb.go
316 lines (287 loc) 路 10.9 KB
/
protocol_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
// 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
// ProtocolClient is the client API for Protocol 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 ProtocolClient interface {
// GetIdentity returns the identity of the drand node
GetIdentity(ctx context.Context, in *IdentityRequest, opts ...grpc.CallOption) (*Identity, error)
// SignalDKGParticipant is called by non-coordinators nodes that sends their
// public keys and secret proof they have to the coordinator so that he can
// create the group.
SignalDKGParticipant(ctx context.Context, in *SignalDKGPacket, opts ...grpc.CallOption) (*Empty, error)
// PushDKGInfo is called by the coordinator to push the group he created
// from all received keys and as well other information such as the time of
// starting the DKG.
PushDKGInfo(ctx context.Context, in *DKGInfoPacket, opts ...grpc.CallOption) (*Empty, error)
// BroadcastPacket is used during DKG phases
BroadcastDKG(ctx context.Context, in *DKGPacket, opts ...grpc.CallOption) (*Empty, error)
// PartialBeacon sends its partial beacon to another node
PartialBeacon(ctx context.Context, in *PartialBeaconPacket, opts ...grpc.CallOption) (*Empty, error)
// SyncRequest forces a daemon to sync up its chain with other nodes
SyncChain(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (Protocol_SyncChainClient, error)
}
type protocolClient struct {
cc grpc.ClientConnInterface
}
func NewProtocolClient(cc grpc.ClientConnInterface) ProtocolClient {
return &protocolClient{cc}
}
func (c *protocolClient) GetIdentity(ctx context.Context, in *IdentityRequest, opts ...grpc.CallOption) (*Identity, error) {
out := new(Identity)
err := c.cc.Invoke(ctx, "/drand.Protocol/GetIdentity", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *protocolClient) SignalDKGParticipant(ctx context.Context, in *SignalDKGPacket, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/drand.Protocol/SignalDKGParticipant", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *protocolClient) PushDKGInfo(ctx context.Context, in *DKGInfoPacket, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/drand.Protocol/PushDKGInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *protocolClient) BroadcastDKG(ctx context.Context, in *DKGPacket, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/drand.Protocol/BroadcastDKG", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *protocolClient) PartialBeacon(ctx context.Context, in *PartialBeaconPacket, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/drand.Protocol/PartialBeacon", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *protocolClient) SyncChain(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (Protocol_SyncChainClient, error) {
stream, err := c.cc.NewStream(ctx, &_Protocol_serviceDesc.Streams[0], "/drand.Protocol/SyncChain", opts...)
if err != nil {
return nil, err
}
x := &protocolSyncChainClient{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 Protocol_SyncChainClient interface {
Recv() (*BeaconPacket, error)
grpc.ClientStream
}
type protocolSyncChainClient struct {
grpc.ClientStream
}
func (x *protocolSyncChainClient) Recv() (*BeaconPacket, error) {
m := new(BeaconPacket)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// ProtocolServer is the server API for Protocol service.
// All implementations should embed UnimplementedProtocolServer
// for forward compatibility
type ProtocolServer interface {
// GetIdentity returns the identity of the drand node
GetIdentity(context.Context, *IdentityRequest) (*Identity, error)
// SignalDKGParticipant is called by non-coordinators nodes that sends their
// public keys and secret proof they have to the coordinator so that he can
// create the group.
SignalDKGParticipant(context.Context, *SignalDKGPacket) (*Empty, error)
// PushDKGInfo is called by the coordinator to push the group he created
// from all received keys and as well other information such as the time of
// starting the DKG.
PushDKGInfo(context.Context, *DKGInfoPacket) (*Empty, error)
// BroadcastPacket is used during DKG phases
BroadcastDKG(context.Context, *DKGPacket) (*Empty, error)
// PartialBeacon sends its partial beacon to another node
PartialBeacon(context.Context, *PartialBeaconPacket) (*Empty, error)
// SyncRequest forces a daemon to sync up its chain with other nodes
SyncChain(*SyncRequest, Protocol_SyncChainServer) error
}
// UnimplementedProtocolServer should be embedded to have forward compatible implementations.
type UnimplementedProtocolServer struct {
}
func (*UnimplementedProtocolServer) GetIdentity(context.Context, *IdentityRequest) (*Identity, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetIdentity not implemented")
}
func (*UnimplementedProtocolServer) SignalDKGParticipant(context.Context, *SignalDKGPacket) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignalDKGParticipant not implemented")
}
func (*UnimplementedProtocolServer) PushDKGInfo(context.Context, *DKGInfoPacket) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method PushDKGInfo not implemented")
}
func (*UnimplementedProtocolServer) BroadcastDKG(context.Context, *DKGPacket) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method BroadcastDKG not implemented")
}
func (*UnimplementedProtocolServer) PartialBeacon(context.Context, *PartialBeaconPacket) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method PartialBeacon not implemented")
}
func (*UnimplementedProtocolServer) SyncChain(*SyncRequest, Protocol_SyncChainServer) error {
return status.Errorf(codes.Unimplemented, "method SyncChain not implemented")
}
func RegisterProtocolServer(s *grpc.Server, srv ProtocolServer) {
s.RegisterService(&_Protocol_serviceDesc, srv)
}
func _Protocol_GetIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdentityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProtocolServer).GetIdentity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Protocol/GetIdentity",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProtocolServer).GetIdentity(ctx, req.(*IdentityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Protocol_SignalDKGParticipant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SignalDKGPacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProtocolServer).SignalDKGParticipant(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Protocol/SignalDKGParticipant",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProtocolServer).SignalDKGParticipant(ctx, req.(*SignalDKGPacket))
}
return interceptor(ctx, in, info, handler)
}
func _Protocol_PushDKGInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DKGInfoPacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProtocolServer).PushDKGInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Protocol/PushDKGInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProtocolServer).PushDKGInfo(ctx, req.(*DKGInfoPacket))
}
return interceptor(ctx, in, info, handler)
}
func _Protocol_BroadcastDKG_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DKGPacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProtocolServer).BroadcastDKG(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Protocol/BroadcastDKG",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProtocolServer).BroadcastDKG(ctx, req.(*DKGPacket))
}
return interceptor(ctx, in, info, handler)
}
func _Protocol_PartialBeacon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PartialBeaconPacket)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProtocolServer).PartialBeacon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/drand.Protocol/PartialBeacon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProtocolServer).PartialBeacon(ctx, req.(*PartialBeaconPacket))
}
return interceptor(ctx, in, info, handler)
}
func _Protocol_SyncChain_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SyncRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ProtocolServer).SyncChain(m, &protocolSyncChainServer{stream})
}
type Protocol_SyncChainServer interface {
Send(*BeaconPacket) error
grpc.ServerStream
}
type protocolSyncChainServer struct {
grpc.ServerStream
}
func (x *protocolSyncChainServer) Send(m *BeaconPacket) error {
return x.ServerStream.SendMsg(m)
}
var _Protocol_serviceDesc = grpc.ServiceDesc{
ServiceName: "drand.Protocol",
HandlerType: (*ProtocolServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetIdentity",
Handler: _Protocol_GetIdentity_Handler,
},
{
MethodName: "SignalDKGParticipant",
Handler: _Protocol_SignalDKGParticipant_Handler,
},
{
MethodName: "PushDKGInfo",
Handler: _Protocol_PushDKGInfo_Handler,
},
{
MethodName: "BroadcastDKG",
Handler: _Protocol_BroadcastDKG_Handler,
},
{
MethodName: "PartialBeacon",
Handler: _Protocol_PartialBeacon_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "SyncChain",
Handler: _Protocol_SyncChain_Handler,
ServerStreams: true,
},
},
Metadata: "drand/protocol.proto",
}