Debian Codegraph @

api/v1/lib/quota/quota.pb.go

raw symbols SCIP
1 // Code generated by protoc-gen-gogo. DO NOT EDIT.
2 // source: quota/quota.proto
3
4 /*
5 Package quota is a generated protocol buffer package.
6
7 It is generated from these files:
8 quota/quota.proto
9
10 It has these top-level messages:
11 QuotaInfo
12 QuotaRequest
13 QuotaStatus
14 */
15 package quota
16
17 import proto "github.com/gogo/protobuf/proto"
18 import fmt "fmt"
19 import math "math"
20 import mesos "github.com/mesos/mesos-go/api/v1/lib"
21 import _ "github.com/gogo/protobuf/gogoproto"
22
23 import strings "strings"
24 import reflect "reflect"
25
26 import io "io"
27
28 // Reference imports to suppress errors if they are not otherwise used.
29 var _ = proto.Marshal
30 var _ = fmt.Errorf
31 var _ = math.Inf
32
33 // This is a compile-time assertion to ensure that this generated file
34 // is compatible with the proto package it is being compiled against.
35 // A compilation error at this line likely means your copy of the
36 // proto package needs to be updated.
37 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
38
39 // TODO(joerg84): Add limits, i.e. upper bounds of resources that a
40 // role is allowed to use.
41 type QuotaInfo struct {
42 // Quota is granted per role and not per framework, similar to
43 // dynamic reservations.
44 Role *string `protobuf:"bytes,1,opt,name=role" json:"role,omitempty"`
45 // Principal which set the quota. Currently only operators can set quotas.
46 Principal *string `protobuf:"bytes,2,opt,name=principal" json:"principal,omitempty"`
47 // The guarantee that these resources are allocatable for the above role.
48 // NOTE: `guarantee.role` should not specify any role except '*',
49 // because quota does not reserve specific resources.
50 Guarantee []mesos.Resource `protobuf:"bytes,3,rep,name=guarantee" json:"guarantee"`
51 }
52
53 func (m *QuotaInfo) Reset() { *m = QuotaInfo{} }
54 func (*QuotaInfo) ProtoMessage() {}
55 func (*QuotaInfo) Descriptor() ([]byte, []int) { return fileDescriptorQuota, []int{0} }
56
57 func (m *QuotaInfo) GetRole() string {
58 if m != nil && m.Role != nil {
59 return *m.Role
60 }
61 return ""
62 }
63
64 func (m *QuotaInfo) GetPrincipal() string {
65 if m != nil && m.Principal != nil {
66 return *m.Principal
67 }
68 return ""
69 }
70
71 func (m *QuotaInfo) GetGuarantee() []mesos.Resource {
72 if m != nil {
73 return m.Guarantee
74 }
75 return nil
76 }
77
78 // *
79 // `QuotaRequest` provides a schema for set quota JSON requests.
80 type QuotaRequest struct {
81 // Disables the capacity heuristic check if set to `true`.
82 Force *bool `protobuf:"varint,1,opt,name=force,def=0" json:"force,omitempty"`
83 // The role for which to set quota.
84 Role *string `protobuf:"bytes,2,opt,name=role" json:"role,omitempty"`
85 // The requested guarantee that these resources will be allocatable for
86 // the above role.
87 Guarantee []mesos.Resource `protobuf:"bytes,3,rep,name=guarantee" json:"guarantee"`
88 }
89
90 func (m *QuotaRequest) Reset() { *m = QuotaRequest{} }
91 func (*QuotaRequest) ProtoMessage() {}
92 func (*QuotaRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuota, []int{1} }
93
94 const Default_QuotaRequest_Force bool = false
95
96 func (m *QuotaRequest) GetForce() bool {
97 if m != nil && m.Force != nil {
98 return *m.Force
99 }
100 return Default_QuotaRequest_Force
101 }
102
103 func (m *QuotaRequest) GetRole() string {
104 if m != nil && m.Role != nil {
105 return *m.Role
106 }
107 return ""
108 }
109
110 func (m *QuotaRequest) GetGuarantee() []mesos.Resource {
111 if m != nil {
112 return m.Guarantee
113 }
114 return nil
115 }
116
117 // *
118 // `QuotaStatus` describes the internal representation for the /quota/status
119 // response.
120 type QuotaStatus struct {
121 // Quotas which are currently set, i.e. known to the master.
122 Infos []QuotaInfo `protobuf:"bytes,1,rep,name=infos" json:"infos"`
123 }
124
125 func (m *QuotaStatus) Reset() { *m = QuotaStatus{} }
126 func (*QuotaStatus) ProtoMessage() {}
127 func (*QuotaStatus) Descriptor() ([]byte, []int) { return fileDescriptorQuota, []int{2} }
128
129 func (m *QuotaStatus) GetInfos() []QuotaInfo {
130 if m != nil {
131 return m.Infos
132 }
133 return nil
134 }
135
136 func init() {
137 proto.RegisterType((*QuotaInfo)(nil), "mesos.quota.QuotaInfo")
138 proto.RegisterType((*QuotaRequest)(nil), "mesos.quota.QuotaRequest")
139 proto.RegisterType((*QuotaStatus)(nil), "mesos.quota.QuotaStatus")
140 }
141 func (this *QuotaInfo) VerboseEqual(that interface{}) error {
142 if that == nil {
143 if this == nil {
144 return nil
145 }
146 return fmt.Errorf("that == nil && this != nil")
147 }
148
149 that1, ok := that.(*QuotaInfo)
150 if !ok {
151 that2, ok := that.(QuotaInfo)
152 if ok {
153 that1 = &that2
154 } else {
155 return fmt.Errorf("that is not of type *QuotaInfo")
156 }
157 }
158 if that1 == nil {
159 if this == nil {
160 return nil
161 }
162 return fmt.Errorf("that is type *QuotaInfo but is nil && this != nil")
163 } else if this == nil {
164 return fmt.Errorf("that is type *QuotaInfo but is not nil && this == nil")
165 }
166 if this.Role != nil && that1.Role != nil {
167 if *this.Role != *that1.Role {
168 return fmt.Errorf("Role this(%v) Not Equal that(%v)", *this.Role, *that1.Role)
169 }
170 } else if this.Role != nil {
171 return fmt.Errorf("this.Role == nil && that.Role != nil")
172 } else if that1.Role != nil {
173 return fmt.Errorf("Role this(%v) Not Equal that(%v)", this.Role, that1.Role)
174 }
175 if this.Principal != nil && that1.Principal != nil {
176 if *this.Principal != *that1.Principal {
177 return fmt.Errorf("Principal this(%v) Not Equal that(%v)", *this.Principal, *that1.Principal)
178 }
179 } else if this.Principal != nil {
180 return fmt.Errorf("this.Principal == nil && that.Principal != nil")
181 } else if that1.Principal != nil {
182 return fmt.Errorf("Principal this(%v) Not Equal that(%v)", this.Principal, that1.Principal)
183 }
184 if len(this.Guarantee) != len(that1.Guarantee) {
185 return fmt.Errorf("Guarantee this(%v) Not Equal that(%v)", len(this.Guarantee), len(that1.Guarantee))
186 }
187 for i := range this.Guarantee {
188 if !this.Guarantee[i].Equal(&that1.Guarantee[i]) {
189 return fmt.Errorf("Guarantee this[%v](%v) Not Equal that[%v](%v)", i, this.Guarantee[i], i, that1.Guarantee[i])
190 }
191 }
192 return nil
193 }
194 func (this *QuotaInfo) Equal(that interface{}) bool {
195 if that == nil {
196 if this == nil {
197 return true
198 }
199 return false
200 }
201
202 that1, ok := that.(*QuotaInfo)
203 if !ok {
204 that2, ok := that.(QuotaInfo)
205 if ok {
206 that1 = &that2
207 } else {
208 return false
209 }
210 }
211 if that1 == nil {
212 if this == nil {
213 return true
214 }
215 return false
216 } else if this == nil {
217 return false
218 }
219 if this.Role != nil && that1.Role != nil {
220 if *this.Role != *that1.Role {
221 return false
222 }
223 } else if this.Role != nil {
224 return false
225 } else if that1.Role != nil {
226 return false
227 }
228 if this.Principal != nil && that1.Principal != nil {
229 if *this.Principal != *that1.Principal {
230 return false
231 }
232 } else if this.Principal != nil {
233 return false
234 } else if that1.Principal != nil {
235 return false
236 }
237 if len(this.Guarantee) != len(that1.Guarantee) {
238 return false
239 }
240 for i := range this.Guarantee {
241 if !this.Guarantee[i].Equal(&that1.Guarantee[i]) {
242 return false
243 }
244 }
245 return true
246 }
247 func (this *QuotaRequest) VerboseEqual(that interface{}) error {
248 if that == nil {
249 if this == nil {
250 return nil
251 }
252 return fmt.Errorf("that == nil && this != nil")
253 }
254
255 that1, ok := that.(*QuotaRequest)
256 if !ok {
257 that2, ok := that.(QuotaRequest)
258 if ok {
259 that1 = &that2
260 } else {
261 return fmt.Errorf("that is not of type *QuotaRequest")
262 }
263 }
264 if that1 == nil {
265 if this == nil {
266 return nil
267 }
268 return fmt.Errorf("that is type *QuotaRequest but is nil && this != nil")
269 } else if this == nil {
270 return fmt.Errorf("that is type *QuotaRequest but is not nil && this == nil")
271 }
272 if this.Force != nil && that1.Force != nil {
273 if *this.Force != *that1.Force {
274 return fmt.Errorf("Force this(%v) Not Equal that(%v)", *this.Force, *that1.Force)
275 }
276 } else if this.Force != nil {
277 return fmt.Errorf("this.Force == nil && that.Force != nil")
278 } else if that1.Force != nil {
279 return fmt.Errorf("Force this(%v) Not Equal that(%v)", this.Force, that1.Force)
280 }
281 if this.Role != nil && that1.Role != nil {
282 if *this.Role != *that1.Role {
283 return fmt.Errorf("Role this(%v) Not Equal that(%v)", *this.Role, *that1.Role)
284 }
285 } else if this.Role != nil {
286 return fmt.Errorf("this.Role == nil && that.Role != nil")
287 } else if that1.Role != nil {
288 return fmt.Errorf("Role this(%v) Not Equal that(%v)", this.Role, that1.Role)
289 }
290 if len(this.Guarantee) != len(that1.Guarantee) {
291 return fmt.Errorf("Guarantee this(%v) Not Equal that(%v)", len(this.Guarantee), len(that1.Guarantee))
292 }
293 for i := range this.Guarantee {
294 if !this.Guarantee[i].Equal(&that1.Guarantee[i]) {
295 return fmt.Errorf("Guarantee this[%v](%v) Not Equal that[%v](%v)", i, this.Guarantee[i], i, that1.Guarantee[i])
296 }
297 }
298 return nil
299 }
300 func (this *QuotaRequest) Equal(that interface{}) bool {
301 if that == nil {
302 if this == nil {
303 return true
304 }
305 return false
306 }
307
308 that1, ok := that.(*QuotaRequest)
309 if !ok {
310 that2, ok := that.(QuotaRequest)
311 if ok {
312 that1 = &that2
313 } else {
314 return false
315 }
316 }
317 if that1 == nil {
318 if this == nil {
319 return true
320 }
321 return false
322 } else if this == nil {
323 return false
324 }
325 if this.Force != nil && that1.Force != nil {
326 if *this.Force != *that1.Force {
327 return false
328 }
329 } else if this.Force != nil {
330 return false
331 } else if that1.Force != nil {
332 return false
333 }
334 if this.Role != nil && that1.Role != nil {
335 if *this.Role != *that1.Role {
336 return false
337 }
338 } else if this.Role != nil {
339 return false
340 } else if that1.Role != nil {
341 return false
342 }
343 if len(this.Guarantee) != len(that1.Guarantee) {
344 return false
345 }
346 for i := range this.Guarantee {
347 if !this.Guarantee[i].Equal(&that1.Guarantee[i]) {
348 return false
349 }
350 }
351 return true
352 }
353 func (this *QuotaStatus) VerboseEqual(that interface{}) error {
354 if that == nil {
355 if this == nil {
356 return nil
357 }
358 return fmt.Errorf("that == nil && this != nil")
359 }
360
361 that1, ok := that.(*QuotaStatus)
362 if !ok {
363 that2, ok := that.(QuotaStatus)
364 if ok {
365 that1 = &that2
366 } else {
367 return fmt.Errorf("that is not of type *QuotaStatus")
368 }
369 }
370 if that1 == nil {
371 if this == nil {
372 return nil
373 }
374 return fmt.Errorf("that is type *QuotaStatus but is nil && this != nil")
375 } else if this == nil {
376 return fmt.Errorf("that is type *QuotaStatus but is not nil && this == nil")
377 }
378 if len(this.Infos) != len(that1.Infos) {
379 return fmt.Errorf("Infos this(%v) Not Equal that(%v)", len(this.Infos), len(that1.Infos))
380 }
381 for i := range this.Infos {
382 if !this.Infos[i].Equal(&that1.Infos[i]) {
383 return fmt.Errorf("Infos this[%v](%v) Not Equal that[%v](%v)", i, this.Infos[i], i, that1.Infos[i])
384 }
385 }
386 return nil
387 }
388 func (this *QuotaStatus) Equal(that interface{}) bool {
389 if that == nil {
390 if this == nil {
391 return true
392 }
393 return false
394 }
395
396 that1, ok := that.(*QuotaStatus)
397 if !ok {
398 that2, ok := that.(QuotaStatus)
399 if ok {
400 that1 = &that2
401 } else {
402 return false
403 }
404 }
405 if that1 == nil {
406 if this == nil {
407 return true
408 }
409 return false
410 } else if this == nil {
411 return false
412 }
413 if len(this.Infos) != len(that1.Infos) {
414 return false
415 }
416 for i := range this.Infos {
417 if !this.Infos[i].Equal(&that1.Infos[i]) {
418 return false
419 }
420 }
421 return true
422 }
423 func (this *QuotaInfo) GoString() string {
424 if this == nil {
425 return "nil"
426 }
427 s := make([]string, 0, 7)
428 s = append(s, "&quota.QuotaInfo{")
429 if this.Role != nil {
430 s = append(s, "Role: "+valueToGoStringQuota(this.Role, "string")+",\n")
431 }
432 if this.Principal != nil {
433 s = append(s, "Principal: "+valueToGoStringQuota(this.Principal, "string")+",\n")
434 }
435 if this.Guarantee != nil {
436 s = append(s, "Guarantee: "+fmt.Sprintf("%#v", this.Guarantee)+",\n")
437 }
438 s = append(s, "}")
439 return strings.Join(s, "")
440 }
441 func (this *QuotaRequest) GoString() string {
442 if this == nil {
443 return "nil"
444 }
445 s := make([]string, 0, 7)
446 s = append(s, "&quota.QuotaRequest{")
447 if this.Force != nil {
448 s = append(s, "Force: "+valueToGoStringQuota(this.Force, "bool")+",\n")
449 }
450 if this.Role != nil {
451 s = append(s, "Role: "+valueToGoStringQuota(this.Role, "string")+",\n")
452 }
453 if this.Guarantee != nil {
454 s = append(s, "Guarantee: "+fmt.Sprintf("%#v", this.Guarantee)+",\n")
455 }
456 s = append(s, "}")
457 return strings.Join(s, "")
458 }
459 func (this *QuotaStatus) GoString() string {
460 if this == nil {
461 return "nil"
462 }
463 s := make([]string, 0, 5)
464 s = append(s, "&quota.QuotaStatus{")
465 if this.Infos != nil {
466 s = append(s, "Infos: "+fmt.Sprintf("%#v", this.Infos)+",\n")
467 }
468 s = append(s, "}")
469 return strings.Join(s, "")
470 }
471 func valueToGoStringQuota(v interface{}, typ string) string {
472 rv := reflect.ValueOf(v)
473 if rv.IsNil() {
474 return "nil"
475 }
476 pv := reflect.Indirect(rv).Interface()
477 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
478 }
479 func (m *QuotaInfo) Marshal() (dAtA []byte, err error) {
480 size := m.ProtoSize()
481 dAtA = make([]byte, size)
482 n, err := m.MarshalTo(dAtA)
483 if err != nil {
484 return nil, err
485 }
486 return dAtA[:n], nil
487 }
488
489 func (m *QuotaInfo) MarshalTo(dAtA []byte) (int, error) {
490 var i int
491 _ = i
492 var l int
493 _ = l
494 if m.Role != nil {
495 dAtA[i] = 0xa
496 i++
497 i = encodeVarintQuota(dAtA, i, uint64(len(*m.Role)))
498 i += copy(dAtA[i:], *m.Role)
499 }
500 if m.Principal != nil {
501 dAtA[i] = 0x12
502 i++
503 i = encodeVarintQuota(dAtA, i, uint64(len(*m.Principal)))
504 i += copy(dAtA[i:], *m.Principal)
505 }
506 if len(m.Guarantee) > 0 {
507 for _, msg := range m.Guarantee {
508 dAtA[i] = 0x1a
509 i++
510 i = encodeVarintQuota(dAtA, i, uint64(msg.ProtoSize()))
511 n, err := msg.MarshalTo(dAtA[i:])
512 if err != nil {
513 return 0, err
514 }
515 i += n
516 }
517 }
518 return i, nil
519 }
520
521 func (m *QuotaRequest) Marshal() (dAtA []byte, err error) {
522 size := m.ProtoSize()
523 dAtA = make([]byte, size)
524 n, err := m.MarshalTo(dAtA)
525 if err != nil {
526 return nil, err
527 }
528 return dAtA[:n], nil
529 }
530
531 func (m *QuotaRequest) MarshalTo(dAtA []byte) (int, error) {
532 var i int
533 _ = i
534 var l int
535 _ = l
536 if m.Force != nil {
537 dAtA[i] = 0x8
538 i++
539 if *m.Force {
540 dAtA[i] = 1
541 } else {
542 dAtA[i] = 0
543 }
544 i++
545 }
546 if m.Role != nil {
547 dAtA[i] = 0x12
548 i++
549 i = encodeVarintQuota(dAtA, i, uint64(len(*m.Role)))
550 i += copy(dAtA[i:], *m.Role)
551 }
552 if len(m.Guarantee) > 0 {
553 for _, msg := range m.Guarantee {
554 dAtA[i] = 0x1a
555 i++
556 i = encodeVarintQuota(dAtA, i, uint64(msg.ProtoSize()))
557 n, err := msg.MarshalTo(dAtA[i:])
558 if err != nil {
559 return 0, err
560 }
561 i += n
562 }
563 }
564 return i, nil
565 }
566
567 func (m *QuotaStatus) Marshal() (dAtA []byte, err error) {
568 size := m.ProtoSize()
569 dAtA = make([]byte, size)
570 n, err := m.MarshalTo(dAtA)
571 if err != nil {
572 return nil, err
573 }
574 return dAtA[:n], nil
575 }
576
577 func (m *QuotaStatus) MarshalTo(dAtA []byte) (int, error) {
578 var i int
579 _ = i
580 var l int
581 _ = l
582 if len(m.Infos) > 0 {
583 for _, msg := range m.Infos {
584 dAtA[i] = 0xa
585 i++
586 i = encodeVarintQuota(dAtA, i, uint64(msg.ProtoSize()))
587 n, err := msg.MarshalTo(dAtA[i:])
588 if err != nil {
589 return 0, err
590 }
591 i += n
592 }
593 }
594 return i, nil
595 }
596
597 func encodeFixed64Quota(dAtA []byte, offset int, v uint64) int {
598 dAtA[offset] = uint8(v)
599 dAtA[offset+1] = uint8(v >> 8)
600 dAtA[offset+2] = uint8(v >> 16)
601 dAtA[offset+3] = uint8(v >> 24)
602 dAtA[offset+4] = uint8(v >> 32)
603 dAtA[offset+5] = uint8(v >> 40)
604 dAtA[offset+6] = uint8(v >> 48)
605 dAtA[offset+7] = uint8(v >> 56)
606 return offset + 8
607 }
608 func encodeFixed32Quota(dAtA []byte, offset int, v uint32) int {
609 dAtA[offset] = uint8(v)
610 dAtA[offset+1] = uint8(v >> 8)
611 dAtA[offset+2] = uint8(v >> 16)
612 dAtA[offset+3] = uint8(v >> 24)
613 return offset + 4
614 }
615 func encodeVarintQuota(dAtA []byte, offset int, v uint64) int {
616 for v >= 1<<7 {
617 dAtA[offset] = uint8(v&0x7f | 0x80)
618 v >>= 7
619 offset++
620 }
621 dAtA[offset] = uint8(v)
622 return offset + 1
623 }
624 func NewPopulatedQuotaInfo(r randyQuota, easy bool) *QuotaInfo {
625 this := &QuotaInfo{}
626 if r.Intn(10) != 0 {
627 v1 := string(randStringQuota(r))
628 this.Role = &v1
629 }
630 if r.Intn(10) != 0 {
631 v2 := string(randStringQuota(r))
632 this.Principal = &v2
633 }
634 if r.Intn(10) != 0 {
635 v3 := r.Intn(5)
636 this.Guarantee = make([]mesos.Resource, v3)
637 for i := 0; i < v3; i++ {
638 v4 := mesos.NewPopulatedResource(r, easy)
639 this.Guarantee[i] = *v4
640 }
641 }
642 if !easy && r.Intn(10) != 0 {
643 }
644 return this
645 }
646
647 func NewPopulatedQuotaRequest(r randyQuota, easy bool) *QuotaRequest {
648 this := &QuotaRequest{}
649 if r.Intn(10) != 0 {
650 v5 := bool(bool(r.Intn(2) == 0))
651 this.Force = &v5
652 }
653 if r.Intn(10) != 0 {
654 v6 := string(randStringQuota(r))
655 this.Role = &v6
656 }
657 if r.Intn(10) != 0 {
658 v7 := r.Intn(5)
659 this.Guarantee = make([]mesos.Resource, v7)
660 for i := 0; i < v7; i++ {
661 v8 := mesos.NewPopulatedResource(r, easy)
662 this.Guarantee[i] = *v8
663 }
664 }
665 if !easy && r.Intn(10) != 0 {
666 }
667 return this
668 }
669
670 func NewPopulatedQuotaStatus(r randyQuota, easy bool) *QuotaStatus {
671 this := &QuotaStatus{}
672 if r.Intn(10) != 0 {
673 v9 := r.Intn(5)
674 this.Infos = make([]QuotaInfo, v9)
675 for i := 0; i < v9; i++ {
676 v10 := NewPopulatedQuotaInfo(r, easy)
677 this.Infos[i] = *v10
678 }
679 }
680 if !easy && r.Intn(10) != 0 {
681 }
682 return this
683 }
684
685 type randyQuota interface {
686 Float32() float32
687 Float64() float64
688 Int63() int64
689 Int31() int32
690 Uint32() uint32
691 Intn(n int) int
692 }
693
694 func randUTF8RuneQuota(r randyQuota) rune {
695 ru := r.Intn(62)
696 if ru < 10 {
697 return rune(ru + 48)
698 } else if ru < 36 {
699 return rune(ru + 55)
700 }
701 return rune(ru + 61)
702 }
703 func randStringQuota(r randyQuota) string {
704 v11 := r.Intn(100)
705 tmps := make([]rune, v11)
706 for i := 0; i < v11; i++ {
707 tmps[i] = randUTF8RuneQuota(r)
708 }
709 return string(tmps)
710 }
711 func randUnrecognizedQuota(r randyQuota, maxFieldNumber int) (dAtA []byte) {
712 l := r.Intn(5)
713 for i := 0; i < l; i++ {
714 wire := r.Intn(4)
715 if wire == 3 {
716 wire = 5
717 }
718 fieldNumber := maxFieldNumber + r.Intn(100)
719 dAtA = randFieldQuota(dAtA, r, fieldNumber, wire)
720 }
721 return dAtA
722 }
723 func randFieldQuota(dAtA []byte, r randyQuota, fieldNumber int, wire int) []byte {
724 key := uint32(fieldNumber)<<3 | uint32(wire)
725 switch wire {
726 case 0:
727 dAtA = encodeVarintPopulateQuota(dAtA, uint64(key))
728 v12 := r.Int63()
729 if r.Intn(2) == 0 {
730 v12 *= -1
731 }
732 dAtA = encodeVarintPopulateQuota(dAtA, uint64(v12))
733 case 1:
734 dAtA = encodeVarintPopulateQuota(dAtA, uint64(key))
735 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
736 case 2:
737 dAtA = encodeVarintPopulateQuota(dAtA, uint64(key))
738 ll := r.Intn(100)
739 dAtA = encodeVarintPopulateQuota(dAtA, uint64(ll))
740 for j := 0; j < ll; j++ {
741 dAtA = append(dAtA, byte(r.Intn(256)))
742 }
743 default:
744 dAtA = encodeVarintPopulateQuota(dAtA, uint64(key))
745 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
746 }
747 return dAtA
748 }
749 func encodeVarintPopulateQuota(dAtA []byte, v uint64) []byte {
750 for v >= 1<<7 {
751 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
752 v >>= 7
753 }
754 dAtA = append(dAtA, uint8(v))
755 return dAtA
756 }
757 func (m *QuotaInfo) ProtoSize() (n int) {
758 var l int
759 _ = l
760 if m.Role != nil {
761 l = len(*m.Role)
762 n += 1 + l + sovQuota(uint64(l))
763 }
764 if m.Principal != nil {
765 l = len(*m.Principal)
766 n += 1 + l + sovQuota(uint64(l))
767 }
768 if len(m.Guarantee) > 0 {
769 for _, e := range m.Guarantee {
770 l = e.ProtoSize()
771 n += 1 + l + sovQuota(uint64(l))
772 }
773 }
774 return n
775 }
776
777 func (m *QuotaRequest) ProtoSize() (n int) {
778 var l int
779 _ = l
780 if m.Force != nil {
781 n += 2
782 }
783 if m.Role != nil {
784 l = len(*m.Role)
785 n += 1 + l + sovQuota(uint64(l))
786 }
787 if len(m.Guarantee) > 0 {
788 for _, e := range m.Guarantee {
789 l = e.ProtoSize()
790 n += 1 + l + sovQuota(uint64(l))
791 }
792 }
793 return n
794 }
795
796 func (m *QuotaStatus) ProtoSize() (n int) {
797 var l int
798 _ = l
799 if len(m.Infos) > 0 {
800 for _, e := range m.Infos {
801 l = e.ProtoSize()
802 n += 1 + l + sovQuota(uint64(l))
803 }
804 }
805 return n
806 }
807
808 func sovQuota(x uint64) (n int) {
809 for {
810 n++
811 x >>= 7
812 if x == 0 {
813 break
814 }
815 }
816 return n
817 }
818 func sozQuota(x uint64) (n int) {
819 return sovQuota(uint64((x << 1) ^ uint64((int64(x) >> 63))))
820 }
821 func (this *QuotaInfo) String() string {
822 if this == nil {
823 return "nil"
824 }
825 s := strings.Join([]string{`&QuotaInfo{`,
826 `Role:` + valueToStringQuota(this.Role) + `,`,
827 `Principal:` + valueToStringQuota(this.Principal) + `,`,
828 `Guarantee:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Guarantee), "Resource", "mesos.Resource", 1), `&`, ``, 1) + `,`,
829 `}`,
830 }, "")
831 return s
832 }
833 func (this *QuotaRequest) String() string {
834 if this == nil {
835 return "nil"
836 }
837 s := strings.Join([]string{`&QuotaRequest{`,
838 `Force:` + valueToStringQuota(this.Force) + `,`,
839 `Role:` + valueToStringQuota(this.Role) + `,`,
840 `Guarantee:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Guarantee), "Resource", "mesos.Resource", 1), `&`, ``, 1) + `,`,
841 `}`,
842 }, "")
843 return s
844 }
845 func (this *QuotaStatus) String() string {
846 if this == nil {
847 return "nil"
848 }
849 s := strings.Join([]string{`&QuotaStatus{`,
850 `Infos:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Infos), "QuotaInfo", "QuotaInfo", 1), `&`, ``, 1) + `,`,
851 `}`,
852 }, "")
853 return s
854 }
855 func valueToStringQuota(v interface{}) string {
856 rv := reflect.ValueOf(v)
857 if rv.IsNil() {
858 return "nil"
859 }
860 pv := reflect.Indirect(rv).Interface()
861 return fmt.Sprintf("*%v", pv)
862 }
863 func (m *QuotaInfo) Unmarshal(dAtA []byte) error {
864 l := len(dAtA)
865 iNdEx := 0
866 for iNdEx < l {
867 preIndex := iNdEx
868 var wire uint64
869 for shift := uint(0); ; shift += 7 {
870 if shift >= 64 {
871 return ErrIntOverflowQuota
872 }
873 if iNdEx >= l {
874 return io.ErrUnexpectedEOF
875 }
876 b := dAtA[iNdEx]
877 iNdEx++
878 wire |= (uint64(b) & 0x7F) << shift
879 if b < 0x80 {
880 break
881 }
882 }
883 fieldNum := int32(wire >> 3)
884 wireType := int(wire & 0x7)
885 if wireType == 4 {
886 return fmt.Errorf("proto: QuotaInfo: wiretype end group for non-group")
887 }
888 if fieldNum <= 0 {
889 return fmt.Errorf("proto: QuotaInfo: illegal tag %d (wire type %d)", fieldNum, wire)
890 }
891 switch fieldNum {
892 case 1:
893 if wireType != 2 {
894 return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
895 }
896 var stringLen uint64
897 for shift := uint(0); ; shift += 7 {
898 if shift >= 64 {
899 return ErrIntOverflowQuota
900 }
901 if iNdEx >= l {
902 return io.ErrUnexpectedEOF
903 }
904 b := dAtA[iNdEx]
905 iNdEx++
906 stringLen |= (uint64(b) & 0x7F) << shift
907 if b < 0x80 {
908 break
909 }
910 }
911 intStringLen := int(stringLen)
912 if intStringLen < 0 {
913 return ErrInvalidLengthQuota
914 }
915 postIndex := iNdEx + intStringLen
916 if postIndex > l {
917 return io.ErrUnexpectedEOF
918 }
919 s := string(dAtA[iNdEx:postIndex])
920 m.Role = &s
921 iNdEx = postIndex
922 case 2:
923 if wireType != 2 {
924 return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType)
925 }
926 var stringLen uint64
927 for shift := uint(0); ; shift += 7 {
928 if shift >= 64 {
929 return ErrIntOverflowQuota
930 }
931 if iNdEx >= l {
932 return io.ErrUnexpectedEOF
933 }
934 b := dAtA[iNdEx]
935 iNdEx++
936 stringLen |= (uint64(b) & 0x7F) << shift
937 if b < 0x80 {
938 break
939 }
940 }
941 intStringLen := int(stringLen)
942 if intStringLen < 0 {
943 return ErrInvalidLengthQuota
944 }
945 postIndex := iNdEx + intStringLen
946 if postIndex > l {
947 return io.ErrUnexpectedEOF
948 }
949 s := string(dAtA[iNdEx:postIndex])
950 m.Principal = &s
951 iNdEx = postIndex
952 case 3:
953 if wireType != 2 {
954 return fmt.Errorf("proto: wrong wireType = %d for field Guarantee", wireType)
955 }
956 var msglen int
957 for shift := uint(0); ; shift += 7 {
958 if shift >= 64 {
959 return ErrIntOverflowQuota
960 }
961 if iNdEx >= l {
962 return io.ErrUnexpectedEOF
963 }
964 b := dAtA[iNdEx]
965 iNdEx++
966 msglen |= (int(b) & 0x7F) << shift
967 if b < 0x80 {
968 break
969 }
970 }
971 if msglen < 0 {
972 return ErrInvalidLengthQuota
973 }
974 postIndex := iNdEx + msglen
975 if postIndex > l {
976 return io.ErrUnexpectedEOF
977 }
978 m.Guarantee = append(m.Guarantee, mesos.Resource{})
979 if err := m.Guarantee[len(m.Guarantee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
980 return err
981 }
982 iNdEx = postIndex
983 default:
984 iNdEx = preIndex
985 skippy, err := skipQuota(dAtA[iNdEx:])
986 if err != nil {
987 return err
988 }
989 if skippy < 0 {
990 return ErrInvalidLengthQuota
991 }
992 if (iNdEx + skippy) > l {
993 return io.ErrUnexpectedEOF
994 }
995 iNdEx += skippy
996 }
997 }
998
999 if iNdEx > l {
1000 return io.ErrUnexpectedEOF
1001 }
1002 return nil
1003 }
1004 func (m *QuotaRequest) Unmarshal(dAtA []byte) error {
1005 l := len(dAtA)
1006 iNdEx := 0
1007 for iNdEx < l {
1008 preIndex := iNdEx
1009 var wire uint64
1010 for shift := uint(0); ; shift += 7 {
1011 if shift >= 64 {
1012 return ErrIntOverflowQuota
1013 }
1014 if iNdEx >= l {
1015 return io.ErrUnexpectedEOF
1016 }
1017 b := dAtA[iNdEx]
1018 iNdEx++
1019 wire |= (uint64(b) & 0x7F) << shift
1020 if b < 0x80 {
1021 break
1022 }
1023 }
1024 fieldNum := int32(wire >> 3)
1025 wireType := int(wire & 0x7)
1026 if wireType == 4 {
1027 return fmt.Errorf("proto: QuotaRequest: wiretype end group for non-group")
1028 }
1029 if fieldNum <= 0 {
1030 return fmt.Errorf("proto: QuotaRequest: illegal tag %d (wire type %d)", fieldNum, wire)
1031 }
1032 switch fieldNum {
1033 case 1:
1034 if wireType != 0 {
1035 return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType)
1036 }
1037 var v int
1038 for shift := uint(0); ; shift += 7 {
1039 if shift >= 64 {
1040 return ErrIntOverflowQuota
1041 }
1042 if iNdEx >= l {
1043 return io.ErrUnexpectedEOF
1044 }
1045 b := dAtA[iNdEx]
1046 iNdEx++
1047 v |= (int(b) & 0x7F) << shift
1048 if b < 0x80 {
1049 break
1050 }
1051 }
1052 b := bool(v != 0)
1053 m.Force = &b
1054 case 2:
1055 if wireType != 2 {
1056 return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
1057 }
1058 var stringLen uint64
1059 for shift := uint(0); ; shift += 7 {
1060 if shift >= 64 {
1061 return ErrIntOverflowQuota
1062 }
1063 if iNdEx >= l {
1064 return io.ErrUnexpectedEOF
1065 }
1066 b := dAtA[iNdEx]
1067 iNdEx++
1068 stringLen |= (uint64(b) & 0x7F) << shift
1069 if b < 0x80 {
1070 break
1071 }
1072 }
1073 intStringLen := int(stringLen)
1074 if intStringLen < 0 {
1075 return ErrInvalidLengthQuota
1076 }
1077 postIndex := iNdEx + intStringLen
1078 if postIndex > l {
1079 return io.ErrUnexpectedEOF
1080 }
1081 s := string(dAtA[iNdEx:postIndex])
1082 m.Role = &s
1083 iNdEx = postIndex
1084 case 3:
1085 if wireType != 2 {
1086 return fmt.Errorf("proto: wrong wireType = %d for field Guarantee", wireType)
1087 }
1088 var msglen int
1089 for shift := uint(0); ; shift += 7 {
1090 if shift >= 64 {
1091 return ErrIntOverflowQuota
1092 }
1093 if iNdEx >= l {
1094 return io.ErrUnexpectedEOF
1095 }
1096 b := dAtA[iNdEx]
1097 iNdEx++
1098 msglen |= (int(b) & 0x7F) << shift
1099 if b < 0x80 {
1100 break
1101 }
1102 }
1103 if msglen < 0 {
1104 return ErrInvalidLengthQuota
1105 }
1106 postIndex := iNdEx + msglen
1107 if postIndex > l {
1108 return io.ErrUnexpectedEOF
1109 }
1110 m.Guarantee = append(m.Guarantee, mesos.Resource{})
1111 if err := m.Guarantee[len(m.Guarantee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
1112 return err
1113 }
1114 iNdEx = postIndex
1115 default:
1116 iNdEx = preIndex
1117 skippy, err := skipQuota(dAtA[iNdEx:])
1118 if err != nil {
1119 return err
1120 }
1121 if skippy < 0 {
1122 return ErrInvalidLengthQuota
1123 }
1124 if (iNdEx + skippy) > l {
1125 return io.ErrUnexpectedEOF
1126 }
1127 iNdEx += skippy
1128 }
1129 }
1130
1131 if iNdEx > l {
1132 return io.ErrUnexpectedEOF
1133 }
1134 return nil
1135 }
1136 func (m *QuotaStatus) Unmarshal(dAtA []byte) error {
1137 l := len(dAtA)
1138 iNdEx := 0
1139 for iNdEx < l {
1140 preIndex := iNdEx
1141 var wire uint64
1142 for shift := uint(0); ; shift += 7 {
1143 if shift >= 64 {
1144 return ErrIntOverflowQuota
1145 }
1146 if iNdEx >= l {
1147 return io.ErrUnexpectedEOF
1148 }
1149 b := dAtA[iNdEx]
1150 iNdEx++
1151 wire |= (uint64(b) & 0x7F) << shift
1152 if b < 0x80 {
1153 break
1154 }
1155 }
1156 fieldNum := int32(wire >> 3)
1157 wireType := int(wire & 0x7)
1158 if wireType == 4 {
1159 return fmt.Errorf("proto: QuotaStatus: wiretype end group for non-group")
1160 }
1161 if fieldNum <= 0 {
1162 return fmt.Errorf("proto: QuotaStatus: illegal tag %d (wire type %d)", fieldNum, wire)
1163 }
1164 switch fieldNum {
1165 case 1:
1166 if wireType != 2 {
1167 return fmt.Errorf("proto: wrong wireType = %d for field Infos", wireType)
1168 }
1169 var msglen int
1170 for shift := uint(0); ; shift += 7 {
1171 if shift >= 64 {
1172 return ErrIntOverflowQuota
1173 }
1174 if iNdEx >= l {
1175 return io.ErrUnexpectedEOF
1176 }
1177 b := dAtA[iNdEx]
1178 iNdEx++
1179 msglen |= (int(b) & 0x7F) << shift
1180 if b < 0x80 {
1181 break
1182 }
1183 }
1184 if msglen < 0 {
1185 return ErrInvalidLengthQuota
1186 }
1187 postIndex := iNdEx + msglen
1188 if postIndex > l {
1189 return io.ErrUnexpectedEOF
1190 }
1191 m.Infos = append(m.Infos, QuotaInfo{})
1192 if err := m.Infos[len(m.Infos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
1193 return err
1194 }
1195 iNdEx = postIndex
1196 default:
1197 iNdEx = preIndex
1198 skippy, err := skipQuota(dAtA[iNdEx:])
1199 if err != nil {
1200 return err
1201 }
1202 if skippy < 0 {
1203 return ErrInvalidLengthQuota
1204 }
1205 if (iNdEx + skippy) > l {
1206 return io.ErrUnexpectedEOF
1207 }
1208 iNdEx += skippy
1209 }
1210 }
1211
1212 if iNdEx > l {
1213 return io.ErrUnexpectedEOF
1214 }
1215 return nil
1216 }
1217 func skipQuota(dAtA []byte) (n int, err error) {
1218 l := len(dAtA)
1219 iNdEx := 0
1220 for iNdEx < l {
1221 var wire uint64
1222 for shift := uint(0); ; shift += 7 {
1223 if shift >= 64 {
1224 return 0, ErrIntOverflowQuota
1225 }
1226 if iNdEx >= l {
1227 return 0, io.ErrUnexpectedEOF
1228 }
1229 b := dAtA[iNdEx]
1230 iNdEx++
1231 wire |= (uint64(b) & 0x7F) << shift
1232 if b < 0x80 {
1233 break
1234 }
1235 }
1236 wireType := int(wire & 0x7)
1237 switch wireType {
1238 case 0:
1239 for shift := uint(0); ; shift += 7 {
1240 if shift >= 64 {
1241 return 0, ErrIntOverflowQuota
1242 }
1243 if iNdEx >= l {
1244 return 0, io.ErrUnexpectedEOF
1245 }
1246 iNdEx++
1247 if dAtA[iNdEx-1] < 0x80 {
1248 break
1249 }
1250 }
1251 return iNdEx, nil
1252 case 1:
1253 iNdEx += 8
1254 return iNdEx, nil
1255 case 2:
1256 var length int
1257 for shift := uint(0); ; shift += 7 {
1258 if shift >= 64 {
1259 return 0, ErrIntOverflowQuota
1260 }
1261 if iNdEx >= l {
1262 return 0, io.ErrUnexpectedEOF
1263 }
1264 b := dAtA[iNdEx]
1265 iNdEx++
1266 length |= (int(b) & 0x7F) << shift
1267 if b < 0x80 {
1268 break
1269 }
1270 }
1271 iNdEx += length
1272 if length < 0 {
1273 return 0, ErrInvalidLengthQuota
1274 }
1275 return iNdEx, nil
1276 case 3:
1277 for {
1278 var innerWire uint64
1279 var start int = iNdEx
1280 for shift := uint(0); ; shift += 7 {
1281 if shift >= 64 {
1282 return 0, ErrIntOverflowQuota
1283 }
1284 if iNdEx >= l {
1285 return 0, io.ErrUnexpectedEOF
1286 }
1287 b := dAtA[iNdEx]
1288 iNdEx++
1289 innerWire |= (uint64(b) & 0x7F) << shift
1290 if b < 0x80 {
1291 break
1292 }
1293 }
1294 innerWireType := int(innerWire & 0x7)
1295 if innerWireType == 4 {
1296 break
1297 }
1298 next, err := skipQuota(dAtA[start:])
1299 if err != nil {
1300 return 0, err
1301 }
1302 iNdEx = start + next
1303 }
1304 return iNdEx, nil
1305 case 4:
1306 return iNdEx, nil
1307 case 5:
1308 iNdEx += 4
1309 return iNdEx, nil
1310 default:
1311 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
1312 }
1313 }
1314 panic("unreachable")
1315 }
1316
1317 var (
1318 ErrInvalidLengthQuota = fmt.Errorf("proto: negative length found during unmarshaling")
1319 ErrIntOverflowQuota = fmt.Errorf("proto: integer overflow")
1320 )
1321
1322 func init() { proto.RegisterFile("quota/quota.proto", fileDescriptorQuota) }
1323
1324 var fileDescriptorQuota = []byte{
1325 // 331 bytes of a gzipped FileDescriptorProto
1326 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x90, 0xbd, 0x4e, 0xeb, 0x40,
1327 0x10, 0x85, 0x3d, 0x49, 0x2c, 0x5d, 0x6f, 0xae, 0x84, 0x70, 0x81, 0xac, 0x80, 0x86, 0x28, 0x55,
1328 0x9a, 0xd8, 0x10, 0x3a, 0x3a, 0x42, 0x45, 0x89, 0xe9, 0xe8, 0x1c, 0x6b, 0x6d, 0x2c, 0x39, 0x5e,
1329 0x67, 0x7f, 0xa8, 0x79, 0x04, 0x1e, 0x81, 0x92, 0x47, 0xa0, 0xa4, 0x4c, 0x99, 0x92, 0x0a, 0xe1,
1330 0x4d, 0x43, 0x99, 0x92, 0x12, 0xb1, 0x8b, 0x92, 0xd4, 0x34, 0xab, 0x99, 0x6f, 0xe7, 0xcc, 0x39,
1331 0x1a, 0xb2, 0x3f, 0x57, 0x4c, 0x26, 0x91, 0x79, 0xc3, 0x9a, 0x33, 0xc9, 0xfc, 0xee, 0x8c, 0x0a,
1332 0x26, 0x42, 0x83, 0x7a, 0x27, 0x79, 0x21, 0xef, 0xd4, 0x34, 0x4c, 0xd9, 0x2c, 0x32, 0xdc, 0xbe,
1333 0xa3, 0x9c, 0x45, 0x49, 0x5d, 0x44, 0xf7, 0xa7, 0x51, 0x59, 0x4c, 0x2d, 0xb3, 0xf2, 0xde, 0x68,
1334 0x47, 0x91, 0xb3, 0x9c, 0x45, 0x06, 0x4f, 0x55, 0x66, 0x3a, 0xd3, 0x98, 0xca, 0x8e, 0x0f, 0x38,
1335 0xf1, 0xae, 0x7f, 0x9c, 0xae, 0xaa, 0x8c, 0xf9, 0x3e, 0xe9, 0x70, 0x56, 0xd2, 0x00, 0xfa, 0x30,
1336 0xf4, 0x62, 0x53, 0xfb, 0x47, 0xc4, 0xab, 0x79, 0x51, 0xa5, 0x45, 0x9d, 0x94, 0x41, 0xcb, 0x7c,
1337 0x6c, 0x81, 0x7f, 0x46, 0xbc, 0x5c, 0x25, 0x3c, 0xa9, 0x24, 0xa5, 0x41, 0xbb, 0xdf, 0x1e, 0x76,
1338 0xc7, 0x7b, 0xa1, 0x8d, 0x13, 0x53, 0xc1, 0x14, 0x4f, 0xe9, 0xa4, 0xb3, 0x78, 0x3f, 0x76, 0xe2,
1339 0xed, 0xdc, 0x40, 0x92, 0xff, 0xc6, 0x33, 0xa6, 0x73, 0x45, 0x85, 0xf4, 0x0f, 0x89, 0x9b, 0x31,
1340 0x9e, 0x5a, 0xdf, 0x7f, 0xe7, 0x6e, 0x96, 0x94, 0x82, 0xc6, 0x96, 0x6d, 0x32, 0xb5, 0x76, 0x32,
1341 0xfd, 0xc9, 0xf5, 0x82, 0x74, 0x8d, 0xeb, 0x8d, 0x4c, 0xa4, 0x12, 0xfe, 0x98, 0xb8, 0x45, 0x95,
1342 0x31, 0x11, 0x80, 0xd1, 0x1f, 0x84, 0x3b, 0x67, 0x0f, 0x37, 0x27, 0xf9, 0x5d, 0x63, 0x47, 0x27,
1343 0x97, 0xcb, 0x06, 0x9d, 0xb7, 0x06, 0x9d, 0x8f, 0x06, 0x61, 0xdd, 0x20, 0x7c, 0x35, 0x08, 0x0f,
1344 0x1a, 0xe1, 0x59, 0x23, 0xbc, 0x68, 0x84, 0x57, 0x8d, 0xb0, 0xd0, 0x08, 0x4b, 0x8d, 0xf0, 0xa9,
1345 0xd1, 0x59, 0x6b, 0x84, 0xc7, 0x15, 0x3a, 0x4f, 0x2b, 0x84, 0x5b, 0xd7, 0xec, 0xfe, 0x0e, 0x00,
1346 0x00, 0xff, 0xff, 0xf0, 0x55, 0x30, 0x8e, 0xf3, 0x01, 0x00, 0x00,
1347 }