This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathpeers.pb.go
386 lines (339 loc) · 15.2 KB
/
peers.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
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: peers.proto
package gubernator
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 GetPeerRateLimitsReq struct {
// Must specify at least one RateLimit. The peer that recives this request MUST be authoritative for
// each rate_limit[x].unique_key provided, as the peer will not forward the request to any other peers
Requests []*RateLimitReq `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetPeerRateLimitsReq) Reset() { *m = GetPeerRateLimitsReq{} }
func (m *GetPeerRateLimitsReq) String() string { return proto.CompactTextString(m) }
func (*GetPeerRateLimitsReq) ProtoMessage() {}
func (*GetPeerRateLimitsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_9b029f9e0d26cab5, []int{0}
}
func (m *GetPeerRateLimitsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetPeerRateLimitsReq.Unmarshal(m, b)
}
func (m *GetPeerRateLimitsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetPeerRateLimitsReq.Marshal(b, m, deterministic)
}
func (m *GetPeerRateLimitsReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetPeerRateLimitsReq.Merge(m, src)
}
func (m *GetPeerRateLimitsReq) XXX_Size() int {
return xxx_messageInfo_GetPeerRateLimitsReq.Size(m)
}
func (m *GetPeerRateLimitsReq) XXX_DiscardUnknown() {
xxx_messageInfo_GetPeerRateLimitsReq.DiscardUnknown(m)
}
var xxx_messageInfo_GetPeerRateLimitsReq proto.InternalMessageInfo
func (m *GetPeerRateLimitsReq) GetRequests() []*RateLimitReq {
if m != nil {
return m.Requests
}
return nil
}
type GetPeerRateLimitsResp struct {
// Responses are in the same order as they appeared in the PeerRateLimitRequests
RateLimits []*RateLimitResp `protobuf:"bytes,1,rep,name=rate_limits,json=rateLimits,proto3" json:"rate_limits,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetPeerRateLimitsResp) Reset() { *m = GetPeerRateLimitsResp{} }
func (m *GetPeerRateLimitsResp) String() string { return proto.CompactTextString(m) }
func (*GetPeerRateLimitsResp) ProtoMessage() {}
func (*GetPeerRateLimitsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_9b029f9e0d26cab5, []int{1}
}
func (m *GetPeerRateLimitsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetPeerRateLimitsResp.Unmarshal(m, b)
}
func (m *GetPeerRateLimitsResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetPeerRateLimitsResp.Marshal(b, m, deterministic)
}
func (m *GetPeerRateLimitsResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetPeerRateLimitsResp.Merge(m, src)
}
func (m *GetPeerRateLimitsResp) XXX_Size() int {
return xxx_messageInfo_GetPeerRateLimitsResp.Size(m)
}
func (m *GetPeerRateLimitsResp) XXX_DiscardUnknown() {
xxx_messageInfo_GetPeerRateLimitsResp.DiscardUnknown(m)
}
var xxx_messageInfo_GetPeerRateLimitsResp proto.InternalMessageInfo
func (m *GetPeerRateLimitsResp) GetRateLimits() []*RateLimitResp {
if m != nil {
return m.RateLimits
}
return nil
}
type UpdatePeerGlobalsReq struct {
// Must specify at least one RateLimit
Globals []*UpdatePeerGlobal `protobuf:"bytes,1,rep,name=globals,proto3" json:"globals,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdatePeerGlobalsReq) Reset() { *m = UpdatePeerGlobalsReq{} }
func (m *UpdatePeerGlobalsReq) String() string { return proto.CompactTextString(m) }
func (*UpdatePeerGlobalsReq) ProtoMessage() {}
func (*UpdatePeerGlobalsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_9b029f9e0d26cab5, []int{2}
}
func (m *UpdatePeerGlobalsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdatePeerGlobalsReq.Unmarshal(m, b)
}
func (m *UpdatePeerGlobalsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdatePeerGlobalsReq.Marshal(b, m, deterministic)
}
func (m *UpdatePeerGlobalsReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdatePeerGlobalsReq.Merge(m, src)
}
func (m *UpdatePeerGlobalsReq) XXX_Size() int {
return xxx_messageInfo_UpdatePeerGlobalsReq.Size(m)
}
func (m *UpdatePeerGlobalsReq) XXX_DiscardUnknown() {
xxx_messageInfo_UpdatePeerGlobalsReq.DiscardUnknown(m)
}
var xxx_messageInfo_UpdatePeerGlobalsReq proto.InternalMessageInfo
func (m *UpdatePeerGlobalsReq) GetGlobals() []*UpdatePeerGlobal {
if m != nil {
return m.Globals
}
return nil
}
type UpdatePeerGlobal struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Status *RateLimitResp `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
Algorithm Algorithm `protobuf:"varint,3,opt,name=algorithm,proto3,enum=pb.gubernator.Algorithm" json:"algorithm,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdatePeerGlobal) Reset() { *m = UpdatePeerGlobal{} }
func (m *UpdatePeerGlobal) String() string { return proto.CompactTextString(m) }
func (*UpdatePeerGlobal) ProtoMessage() {}
func (*UpdatePeerGlobal) Descriptor() ([]byte, []int) {
return fileDescriptor_9b029f9e0d26cab5, []int{3}
}
func (m *UpdatePeerGlobal) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdatePeerGlobal.Unmarshal(m, b)
}
func (m *UpdatePeerGlobal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdatePeerGlobal.Marshal(b, m, deterministic)
}
func (m *UpdatePeerGlobal) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdatePeerGlobal.Merge(m, src)
}
func (m *UpdatePeerGlobal) XXX_Size() int {
return xxx_messageInfo_UpdatePeerGlobal.Size(m)
}
func (m *UpdatePeerGlobal) XXX_DiscardUnknown() {
xxx_messageInfo_UpdatePeerGlobal.DiscardUnknown(m)
}
var xxx_messageInfo_UpdatePeerGlobal proto.InternalMessageInfo
func (m *UpdatePeerGlobal) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *UpdatePeerGlobal) GetStatus() *RateLimitResp {
if m != nil {
return m.Status
}
return nil
}
func (m *UpdatePeerGlobal) GetAlgorithm() Algorithm {
if m != nil {
return m.Algorithm
}
return Algorithm_TOKEN_BUCKET
}
type UpdatePeerGlobalsResp struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdatePeerGlobalsResp) Reset() { *m = UpdatePeerGlobalsResp{} }
func (m *UpdatePeerGlobalsResp) String() string { return proto.CompactTextString(m) }
func (*UpdatePeerGlobalsResp) ProtoMessage() {}
func (*UpdatePeerGlobalsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_9b029f9e0d26cab5, []int{4}
}
func (m *UpdatePeerGlobalsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdatePeerGlobalsResp.Unmarshal(m, b)
}
func (m *UpdatePeerGlobalsResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdatePeerGlobalsResp.Marshal(b, m, deterministic)
}
func (m *UpdatePeerGlobalsResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdatePeerGlobalsResp.Merge(m, src)
}
func (m *UpdatePeerGlobalsResp) XXX_Size() int {
return xxx_messageInfo_UpdatePeerGlobalsResp.Size(m)
}
func (m *UpdatePeerGlobalsResp) XXX_DiscardUnknown() {
xxx_messageInfo_UpdatePeerGlobalsResp.DiscardUnknown(m)
}
var xxx_messageInfo_UpdatePeerGlobalsResp proto.InternalMessageInfo
func init() {
proto.RegisterType((*GetPeerRateLimitsReq)(nil), "pb.gubernator.GetPeerRateLimitsReq")
proto.RegisterType((*GetPeerRateLimitsResp)(nil), "pb.gubernator.GetPeerRateLimitsResp")
proto.RegisterType((*UpdatePeerGlobalsReq)(nil), "pb.gubernator.UpdatePeerGlobalsReq")
proto.RegisterType((*UpdatePeerGlobal)(nil), "pb.gubernator.UpdatePeerGlobal")
proto.RegisterType((*UpdatePeerGlobalsResp)(nil), "pb.gubernator.UpdatePeerGlobalsResp")
}
func init() { proto.RegisterFile("peers.proto", fileDescriptor_9b029f9e0d26cab5) }
var fileDescriptor_9b029f9e0d26cab5 = []byte{
// 317 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4a, 0xc3, 0x40,
0x10, 0x40, 0xbb, 0x16, 0x5a, 0x3b, 0x45, 0xad, 0x4b, 0x8b, 0xa1, 0x0a, 0x86, 0xd5, 0x43, 0x4e,
0x01, 0xa3, 0x28, 0x1e, 0x3c, 0xe8, 0xa5, 0x17, 0x41, 0x5d, 0xb0, 0x07, 0x2f, 0xba, 0xc1, 0x21,
0x06, 0x53, 0xb3, 0xd9, 0xdd, 0x1c, 0xbc, 0xf9, 0x0d, 0xfe, 0x97, 0xff, 0x24, 0x49, 0xd3, 0x04,
0x93, 0x48, 0x6f, 0x9b, 0x9d, 0x37, 0x6f, 0x66, 0x32, 0x0b, 0x43, 0x89, 0xa8, 0xb4, 0x2b, 0x55,
0x6c, 0x62, 0xba, 0x25, 0x7d, 0x37, 0x48, 0x7d, 0x54, 0x1f, 0xc2, 0xc4, 0x6a,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b, 0x64, 0x15, 0x1a, 0x6d, 0x34, 0x2a, 0xb4, 0x2d, 0xa4, 0x51, 0xa1,
0x75, 0x1a, 0xd6, 0xb9, 0xd9, 0x79, 0x82, 0x8a, 0xfa, 0x22, 0xc4, 0xef, 0xe5, 0x2f, 0xf2, 0xf4,
0x37, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x74, 0x68, 0xc5, 0xc1, 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
// PeersV1Client is the client API for PeersV1 service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PeersV1Client interface {
// Used by peers to relay batches of requests to an authoritative peer
GetPeerRateLimits(ctx context.Context, in *GetPeerRateLimitsReq, opts ...grpc.CallOption) (*GetPeerRateLimitsResp, error)
// Used by peers send global rate limit updates to other peers
UpdatePeerGlobals(ctx context.Context, in *UpdatePeerGlobalsReq, opts ...grpc.CallOption) (*UpdatePeerGlobalsResp, error)
}
type peersV1Client struct {
cc *grpc.ClientConn
}
func NewPeersV1Client(cc *grpc.ClientConn) PeersV1Client {
return &peersV1Client{cc}
}
func (c *peersV1Client) GetPeerRateLimits(ctx context.Context, in *GetPeerRateLimitsReq, opts ...grpc.CallOption) (*GetPeerRateLimitsResp, error) {
out := new(GetPeerRateLimitsResp)
err := c.cc.Invoke(ctx, "/pb.gubernator.PeersV1/GetPeerRateLimits", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peersV1Client) UpdatePeerGlobals(ctx context.Context, in *UpdatePeerGlobalsReq, opts ...grpc.CallOption) (*UpdatePeerGlobalsResp, error) {
out := new(UpdatePeerGlobalsResp)
err := c.cc.Invoke(ctx, "/pb.gubernator.PeersV1/UpdatePeerGlobals", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PeersV1Server is the server API for PeersV1 service.
type PeersV1Server interface {
// Used by peers to relay batches of requests to an authoritative peer
GetPeerRateLimits(context.Context, *GetPeerRateLimitsReq) (*GetPeerRateLimitsResp, error)
// Used by peers send global rate limit updates to other peers
UpdatePeerGlobals(context.Context, *UpdatePeerGlobalsReq) (*UpdatePeerGlobalsResp, error)
}
// UnimplementedPeersV1Server can be embedded to have forward compatible implementations.
type UnimplementedPeersV1Server struct {
}
func (*UnimplementedPeersV1Server) GetPeerRateLimits(ctx context.Context, req *GetPeerRateLimitsReq) (*GetPeerRateLimitsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPeerRateLimits not implemented")
}
func (*UnimplementedPeersV1Server) UpdatePeerGlobals(ctx context.Context, req *UpdatePeerGlobalsReq) (*UpdatePeerGlobalsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdatePeerGlobals not implemented")
}
func RegisterPeersV1Server(s *grpc.Server, srv PeersV1Server) {
s.RegisterService(&_PeersV1_serviceDesc, srv)
}
func _PeersV1_GetPeerRateLimits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPeerRateLimitsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeersV1Server).GetPeerRateLimits(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.gubernator.PeersV1/GetPeerRateLimits",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeersV1Server).GetPeerRateLimits(ctx, req.(*GetPeerRateLimitsReq))
}
return interceptor(ctx, in, info, handler)
}
func _PeersV1_UpdatePeerGlobals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdatePeerGlobalsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeersV1Server).UpdatePeerGlobals(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.gubernator.PeersV1/UpdatePeerGlobals",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeersV1Server).UpdatePeerGlobals(ctx, req.(*UpdatePeerGlobalsReq))
}
return interceptor(ctx, in, info, handler)
}
var _PeersV1_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.gubernator.PeersV1",
HandlerType: (*PeersV1Server)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetPeerRateLimits",
Handler: _PeersV1_GetPeerRateLimits_Handler,
},
{
MethodName: "UpdatePeerGlobals",
Handler: _PeersV1_UpdatePeerGlobals_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "peers.proto",
}