1
2
3
4 package mvccpb
5
6 import (
7 fmt "fmt"
8 io "io"
9 math "math"
10 math_bits "math/bits"
11
12 _ "github.com/gogo/protobuf/gogoproto"
13 proto "github.com/golang/protobuf/proto"
14 )
15
16
17 var _ = proto.Marshal
18 var _ = fmt.Errorf
19 var _ = math.Inf
20
21
22
23
24
25 const _ = proto.ProtoPackageIsVersion3
26
27 type Event_EventType int32
28
29 const (
30 PUT Event_EventType = 0
31 DELETE Event_EventType = 1
32 )
33
34 var Event_EventType_name = map[int32]string{
35 0: "PUT",
36 1: "DELETE",
37 }
38
39 var Event_EventType_value = map[string]int32{
40 "PUT": 0,
41 "DELETE": 1,
42 }
43
44 func (x Event_EventType) String() string {
45 return proto.EnumName(Event_EventType_name, int32(x))
46 }
47
48 func (Event_EventType) EnumDescriptor() ([]byte, []int) {
49 return fileDescriptor_2216fe83c9c12408, []int{1, 0}
50 }
51
52 type KeyValue struct {
53
54 Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
55
56 CreateRevision int64 `protobuf:"varint,2,opt,name=create_revision,json=createRevision,proto3" json:"create_revision,omitempty"`
57
58 ModRevision int64 `protobuf:"varint,3,opt,name=mod_revision,json=modRevision,proto3" json:"mod_revision,omitempty"`
59
60
61
62 Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
63
64 Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
65
66
67
68 Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"`
69 XXX_NoUnkeyedLiteral struct{} `json:"-"`
70 XXX_unrecognized []byte `json:"-"`
71 XXX_sizecache int32 `json:"-"`
72 }
73
74 func (m *KeyValue) Reset() { *m = KeyValue{} }
75 func (m *KeyValue) String() string { return proto.CompactTextString(m) }
76 func (*KeyValue) ProtoMessage() {}
77 func (*KeyValue) Descriptor() ([]byte, []int) {
78 return fileDescriptor_2216fe83c9c12408, []int{0}
79 }
80 func (m *KeyValue) XXX_Unmarshal(b []byte) error {
81 return m.Unmarshal(b)
82 }
83 func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
84 if deterministic {
85 return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic)
86 } else {
87 b = b[:cap(b)]
88 n, err := m.MarshalToSizedBuffer(b)
89 if err != nil {
90 return nil, err
91 }
92 return b[:n], nil
93 }
94 }
95 func (m *KeyValue) XXX_Merge(src proto.Message) {
96 xxx_messageInfo_KeyValue.Merge(m, src)
97 }
98 func (m *KeyValue) XXX_Size() int {
99 return m.Size()
100 }
101 func (m *KeyValue) XXX_DiscardUnknown() {
102 xxx_messageInfo_KeyValue.DiscardUnknown(m)
103 }
104
105 var xxx_messageInfo_KeyValue proto.InternalMessageInfo
106
107 type Event struct {
108
109
110
111 Type Event_EventType `protobuf:"varint,1,opt,name=type,proto3,enum=mvccpb.Event_EventType" json:"type,omitempty"`
112
113
114
115
116
117 Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"`
118
119 PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"`
120 XXX_NoUnkeyedLiteral struct{} `json:"-"`
121 XXX_unrecognized []byte `json:"-"`
122 XXX_sizecache int32 `json:"-"`
123 }
124
125 func (m *Event) Reset() { *m = Event{} }
126 func (m *Event) String() string { return proto.CompactTextString(m) }
127 func (*Event) ProtoMessage() {}
128 func (*Event) Descriptor() ([]byte, []int) {
129 return fileDescriptor_2216fe83c9c12408, []int{1}
130 }
131 func (m *Event) XXX_Unmarshal(b []byte) error {
132 return m.Unmarshal(b)
133 }
134 func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
135 if deterministic {
136 return xxx_messageInfo_Event.Marshal(b, m, deterministic)
137 } else {
138 b = b[:cap(b)]
139 n, err := m.MarshalToSizedBuffer(b)
140 if err != nil {
141 return nil, err
142 }
143 return b[:n], nil
144 }
145 }
146 func (m *Event) XXX_Merge(src proto.Message) {
147 xxx_messageInfo_Event.Merge(m, src)
148 }
149 func (m *Event) XXX_Size() int {
150 return m.Size()
151 }
152 func (m *Event) XXX_DiscardUnknown() {
153 xxx_messageInfo_Event.DiscardUnknown(m)
154 }
155
156 var xxx_messageInfo_Event proto.InternalMessageInfo
157
158 func init() {
159 proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value)
160 proto.RegisterType((*KeyValue)(nil), "mvccpb.KeyValue")
161 proto.RegisterType((*Event)(nil), "mvccpb.Event")
162 }
163
164 func init() { proto.RegisterFile("kv.proto", fileDescriptor_2216fe83c9c12408) }
165
166 var fileDescriptor_2216fe83c9c12408 = []byte{
167
168 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4e, 0xc2, 0x40,
169 0x14, 0x86, 0x3b, 0x14, 0x0a, 0x3e, 0x08, 0x36, 0x13, 0x12, 0x27, 0x2e, 0x26, 0x95, 0x8d, 0x18,
170 0x13, 0x4c, 0xf0, 0x06, 0xc6, 0xae, 0x70, 0x61, 0x1a, 0x74, 0x4b, 0x4a, 0x79, 0x21, 0xa4, 0x94,
171 0x69, 0x4a, 0x9d, 0xa4, 0x37, 0x71, 0xef, 0xde, 0x73, 0xb0, 0xe4, 0x08, 0x52, 0x2f, 0x62, 0xfa,
172 0xc6, 0xe2, 0xc6, 0xcd, 0xe4, 0xfd, 0xff, 0xff, 0x65, 0xe6, 0x7f, 0x03, 0x9d, 0x58, 0x8f, 0xd3,
173 0x4c, 0xe5, 0x8a, 0x3b, 0x89, 0x8e, 0xa2, 0x74, 0x71, 0x39, 0x58, 0xa9, 0x95, 0x22, 0xeb, 0xae,
174 0x9a, 0x4c, 0x3a, 0xfc, 0x64, 0xd0, 0x99, 0x62, 0xf1, 0x1a, 0x6e, 0xde, 0x90, 0xbb, 0x60, 0xc7,
175 0x58, 0x08, 0xe6, 0xb1, 0x51, 0x2f, 0xa8, 0x46, 0x7e, 0x0d, 0xe7, 0x51, 0x86, 0x61, 0x8e, 0xf3,
176 0x0c, 0xf5, 0x7a, 0xb7, 0x56, 0x5b, 0xd1, 0xf0, 0xd8, 0xc8, 0x0e, 0xfa, 0xc6, 0x0e, 0x7e, 0x5d,
177 0x7e, 0x05, 0xbd, 0x44, 0x2d, 0xff, 0x28, 0x9b, 0xa8, 0x6e, 0xa2, 0x96, 0x27, 0x44, 0x40, 0x5b,
178 0x63, 0x46, 0x69, 0x93, 0xd2, 0x5a, 0xf2, 0x01, 0xb4, 0x74, 0x55, 0x40, 0xb4, 0xe8, 0x65, 0x23,
179 0x2a, 0x77, 0x83, 0xe1, 0x0e, 0x85, 0x43, 0xb4, 0x11, 0xc3, 0x0f, 0x06, 0x2d, 0x5f, 0xe3, 0x36,
180 0xe7, 0xb7, 0xd0, 0xcc, 0x8b, 0x14, 0xa9, 0x6e, 0x7f, 0x72, 0x31, 0x36, 0x7b, 0x8e, 0x29, 0x34,
181 0xe7, 0xac, 0x48, 0x31, 0x20, 0x88, 0x7b, 0xd0, 0x88, 0x35, 0x75, 0xef, 0x4e, 0xdc, 0x1a, 0xad,
182 0x17, 0x0f, 0x1a, 0xb1, 0xe6, 0x37, 0xd0, 0x4e, 0x33, 0xd4, 0xf3, 0x58, 0x53, 0xf9, 0xff, 0x30,
183 0xa7, 0x02, 0xa6, 0x7a, 0xe8, 0xc1, 0xd9, 0xe9, 0x7e, 0xde, 0x06, 0xfb, 0xf9, 0x65, 0xe6, 0x5a,
184 0x1c, 0xc0, 0x79, 0xf4, 0x9f, 0xfc, 0x99, 0xef, 0xb2, 0x07, 0xb1, 0x3f, 0x4a, 0xeb, 0x70, 0x94,
185 0xd6, 0xbe, 0x94, 0xec, 0x50, 0x4a, 0xf6, 0x55, 0x4a, 0xf6, 0xfe, 0x2d, 0xad, 0x85, 0x43, 0xff,
186 0x7e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x45, 0x92, 0x5d, 0xa1, 0x01, 0x00, 0x00,
187 }
188
189 func (m *KeyValue) Marshal() (dAtA []byte, err error) {
190 size := m.Size()
191 dAtA = make([]byte, size)
192 n, err := m.MarshalToSizedBuffer(dAtA[:size])
193 if err != nil {
194 return nil, err
195 }
196 return dAtA[:n], nil
197 }
198
199 func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) {
200 size := m.Size()
201 return m.MarshalToSizedBuffer(dAtA[:size])
202 }
203
204 func (m *KeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
205 i := len(dAtA)
206 _ = i
207 var l int
208 _ = l
209 if m.XXX_unrecognized != nil {
210 i -= len(m.XXX_unrecognized)
211 copy(dAtA[i:], m.XXX_unrecognized)
212 }
213 if m.Lease != 0 {
214 i = encodeVarintKv(dAtA, i, uint64(m.Lease))
215 i--
216 dAtA[i] = 0x30
217 }
218 if len(m.Value) > 0 {
219 i -= len(m.Value)
220 copy(dAtA[i:], m.Value)
221 i = encodeVarintKv(dAtA, i, uint64(len(m.Value)))
222 i--
223 dAtA[i] = 0x2a
224 }
225 if m.Version != 0 {
226 i = encodeVarintKv(dAtA, i, uint64(m.Version))
227 i--
228 dAtA[i] = 0x20
229 }
230 if m.ModRevision != 0 {
231 i = encodeVarintKv(dAtA, i, uint64(m.ModRevision))
232 i--
233 dAtA[i] = 0x18
234 }
235 if m.CreateRevision != 0 {
236 i = encodeVarintKv(dAtA, i, uint64(m.CreateRevision))
237 i--
238 dAtA[i] = 0x10
239 }
240 if len(m.Key) > 0 {
241 i -= len(m.Key)
242 copy(dAtA[i:], m.Key)
243 i = encodeVarintKv(dAtA, i, uint64(len(m.Key)))
244 i--
245 dAtA[i] = 0xa
246 }
247 return len(dAtA) - i, nil
248 }
249
250 func (m *Event) Marshal() (dAtA []byte, err error) {
251 size := m.Size()
252 dAtA = make([]byte, size)
253 n, err := m.MarshalToSizedBuffer(dAtA[:size])
254 if err != nil {
255 return nil, err
256 }
257 return dAtA[:n], nil
258 }
259
260 func (m *Event) MarshalTo(dAtA []byte) (int, error) {
261 size := m.Size()
262 return m.MarshalToSizedBuffer(dAtA[:size])
263 }
264
265 func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) {
266 i := len(dAtA)
267 _ = i
268 var l int
269 _ = l
270 if m.XXX_unrecognized != nil {
271 i -= len(m.XXX_unrecognized)
272 copy(dAtA[i:], m.XXX_unrecognized)
273 }
274 if m.PrevKv != nil {
275 {
276 size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i])
277 if err != nil {
278 return 0, err
279 }
280 i -= size
281 i = encodeVarintKv(dAtA, i, uint64(size))
282 }
283 i--
284 dAtA[i] = 0x1a
285 }
286 if m.Kv != nil {
287 {
288 size, err := m.Kv.MarshalToSizedBuffer(dAtA[:i])
289 if err != nil {
290 return 0, err
291 }
292 i -= size
293 i = encodeVarintKv(dAtA, i, uint64(size))
294 }
295 i--
296 dAtA[i] = 0x12
297 }
298 if m.Type != 0 {
299 i = encodeVarintKv(dAtA, i, uint64(m.Type))
300 i--
301 dAtA[i] = 0x8
302 }
303 return len(dAtA) - i, nil
304 }
305
306 func encodeVarintKv(dAtA []byte, offset int, v uint64) int {
307 offset -= sovKv(v)
308 base := offset
309 for v >= 1<<7 {
310 dAtA[offset] = uint8(v&0x7f | 0x80)
311 v >>= 7
312 offset++
313 }
314 dAtA[offset] = uint8(v)
315 return base
316 }
317 func (m *KeyValue) Size() (n int) {
318 if m == nil {
319 return 0
320 }
321 var l int
322 _ = l
323 l = len(m.Key)
324 if l > 0 {
325 n += 1 + l + sovKv(uint64(l))
326 }
327 if m.CreateRevision != 0 {
328 n += 1 + sovKv(uint64(m.CreateRevision))
329 }
330 if m.ModRevision != 0 {
331 n += 1 + sovKv(uint64(m.ModRevision))
332 }
333 if m.Version != 0 {
334 n += 1 + sovKv(uint64(m.Version))
335 }
336 l = len(m.Value)
337 if l > 0 {
338 n += 1 + l + sovKv(uint64(l))
339 }
340 if m.Lease != 0 {
341 n += 1 + sovKv(uint64(m.Lease))
342 }
343 if m.XXX_unrecognized != nil {
344 n += len(m.XXX_unrecognized)
345 }
346 return n
347 }
348
349 func (m *Event) Size() (n int) {
350 if m == nil {
351 return 0
352 }
353 var l int
354 _ = l
355 if m.Type != 0 {
356 n += 1 + sovKv(uint64(m.Type))
357 }
358 if m.Kv != nil {
359 l = m.Kv.Size()
360 n += 1 + l + sovKv(uint64(l))
361 }
362 if m.PrevKv != nil {
363 l = m.PrevKv.Size()
364 n += 1 + l + sovKv(uint64(l))
365 }
366 if m.XXX_unrecognized != nil {
367 n += len(m.XXX_unrecognized)
368 }
369 return n
370 }
371
372 func sovKv(x uint64) (n int) {
373 return (math_bits.Len64(x|1) + 6) / 7
374 }
375 func sozKv(x uint64) (n int) {
376 return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63))))
377 }
378 func (m *KeyValue) Unmarshal(dAtA []byte) error {
379 l := len(dAtA)
380 iNdEx := 0
381 for iNdEx < l {
382 preIndex := iNdEx
383 var wire uint64
384 for shift := uint(0); ; shift += 7 {
385 if shift >= 64 {
386 return ErrIntOverflowKv
387 }
388 if iNdEx >= l {
389 return io.ErrUnexpectedEOF
390 }
391 b := dAtA[iNdEx]
392 iNdEx++
393 wire |= uint64(b&0x7F) << shift
394 if b < 0x80 {
395 break
396 }
397 }
398 fieldNum := int32(wire >> 3)
399 wireType := int(wire & 0x7)
400 if wireType == 4 {
401 return fmt.Errorf("proto: KeyValue: wiretype end group for non-group")
402 }
403 if fieldNum <= 0 {
404 return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire)
405 }
406 switch fieldNum {
407 case 1:
408 if wireType != 2 {
409 return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
410 }
411 var byteLen int
412 for shift := uint(0); ; shift += 7 {
413 if shift >= 64 {
414 return ErrIntOverflowKv
415 }
416 if iNdEx >= l {
417 return io.ErrUnexpectedEOF
418 }
419 b := dAtA[iNdEx]
420 iNdEx++
421 byteLen |= int(b&0x7F) << shift
422 if b < 0x80 {
423 break
424 }
425 }
426 if byteLen < 0 {
427 return ErrInvalidLengthKv
428 }
429 postIndex := iNdEx + byteLen
430 if postIndex < 0 {
431 return ErrInvalidLengthKv
432 }
433 if postIndex > l {
434 return io.ErrUnexpectedEOF
435 }
436 m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
437 if m.Key == nil {
438 m.Key = []byte{}
439 }
440 iNdEx = postIndex
441 case 2:
442 if wireType != 0 {
443 return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
444 }
445 m.CreateRevision = 0
446 for shift := uint(0); ; shift += 7 {
447 if shift >= 64 {
448 return ErrIntOverflowKv
449 }
450 if iNdEx >= l {
451 return io.ErrUnexpectedEOF
452 }
453 b := dAtA[iNdEx]
454 iNdEx++
455 m.CreateRevision |= int64(b&0x7F) << shift
456 if b < 0x80 {
457 break
458 }
459 }
460 case 3:
461 if wireType != 0 {
462 return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
463 }
464 m.ModRevision = 0
465 for shift := uint(0); ; shift += 7 {
466 if shift >= 64 {
467 return ErrIntOverflowKv
468 }
469 if iNdEx >= l {
470 return io.ErrUnexpectedEOF
471 }
472 b := dAtA[iNdEx]
473 iNdEx++
474 m.ModRevision |= int64(b&0x7F) << shift
475 if b < 0x80 {
476 break
477 }
478 }
479 case 4:
480 if wireType != 0 {
481 return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
482 }
483 m.Version = 0
484 for shift := uint(0); ; shift += 7 {
485 if shift >= 64 {
486 return ErrIntOverflowKv
487 }
488 if iNdEx >= l {
489 return io.ErrUnexpectedEOF
490 }
491 b := dAtA[iNdEx]
492 iNdEx++
493 m.Version |= int64(b&0x7F) << shift
494 if b < 0x80 {
495 break
496 }
497 }
498 case 5:
499 if wireType != 2 {
500 return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
501 }
502 var byteLen int
503 for shift := uint(0); ; shift += 7 {
504 if shift >= 64 {
505 return ErrIntOverflowKv
506 }
507 if iNdEx >= l {
508 return io.ErrUnexpectedEOF
509 }
510 b := dAtA[iNdEx]
511 iNdEx++
512 byteLen |= int(b&0x7F) << shift
513 if b < 0x80 {
514 break
515 }
516 }
517 if byteLen < 0 {
518 return ErrInvalidLengthKv
519 }
520 postIndex := iNdEx + byteLen
521 if postIndex < 0 {
522 return ErrInvalidLengthKv
523 }
524 if postIndex > l {
525 return io.ErrUnexpectedEOF
526 }
527 m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
528 if m.Value == nil {
529 m.Value = []byte{}
530 }
531 iNdEx = postIndex
532 case 6:
533 if wireType != 0 {
534 return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
535 }
536 m.Lease = 0
537 for shift := uint(0); ; shift += 7 {
538 if shift >= 64 {
539 return ErrIntOverflowKv
540 }
541 if iNdEx >= l {
542 return io.ErrUnexpectedEOF
543 }
544 b := dAtA[iNdEx]
545 iNdEx++
546 m.Lease |= int64(b&0x7F) << shift
547 if b < 0x80 {
548 break
549 }
550 }
551 default:
552 iNdEx = preIndex
553 skippy, err := skipKv(dAtA[iNdEx:])
554 if err != nil {
555 return err
556 }
557 if (skippy < 0) || (iNdEx+skippy) < 0 {
558 return ErrInvalidLengthKv
559 }
560 if (iNdEx + skippy) > l {
561 return io.ErrUnexpectedEOF
562 }
563 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
564 iNdEx += skippy
565 }
566 }
567
568 if iNdEx > l {
569 return io.ErrUnexpectedEOF
570 }
571 return nil
572 }
573 func (m *Event) Unmarshal(dAtA []byte) error {
574 l := len(dAtA)
575 iNdEx := 0
576 for iNdEx < l {
577 preIndex := iNdEx
578 var wire uint64
579 for shift := uint(0); ; shift += 7 {
580 if shift >= 64 {
581 return ErrIntOverflowKv
582 }
583 if iNdEx >= l {
584 return io.ErrUnexpectedEOF
585 }
586 b := dAtA[iNdEx]
587 iNdEx++
588 wire |= uint64(b&0x7F) << shift
589 if b < 0x80 {
590 break
591 }
592 }
593 fieldNum := int32(wire >> 3)
594 wireType := int(wire & 0x7)
595 if wireType == 4 {
596 return fmt.Errorf("proto: Event: wiretype end group for non-group")
597 }
598 if fieldNum <= 0 {
599 return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire)
600 }
601 switch fieldNum {
602 case 1:
603 if wireType != 0 {
604 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
605 }
606 m.Type = 0
607 for shift := uint(0); ; shift += 7 {
608 if shift >= 64 {
609 return ErrIntOverflowKv
610 }
611 if iNdEx >= l {
612 return io.ErrUnexpectedEOF
613 }
614 b := dAtA[iNdEx]
615 iNdEx++
616 m.Type |= Event_EventType(b&0x7F) << shift
617 if b < 0x80 {
618 break
619 }
620 }
621 case 2:
622 if wireType != 2 {
623 return fmt.Errorf("proto: wrong wireType = %d for field Kv", wireType)
624 }
625 var msglen int
626 for shift := uint(0); ; shift += 7 {
627 if shift >= 64 {
628 return ErrIntOverflowKv
629 }
630 if iNdEx >= l {
631 return io.ErrUnexpectedEOF
632 }
633 b := dAtA[iNdEx]
634 iNdEx++
635 msglen |= int(b&0x7F) << shift
636 if b < 0x80 {
637 break
638 }
639 }
640 if msglen < 0 {
641 return ErrInvalidLengthKv
642 }
643 postIndex := iNdEx + msglen
644 if postIndex < 0 {
645 return ErrInvalidLengthKv
646 }
647 if postIndex > l {
648 return io.ErrUnexpectedEOF
649 }
650 if m.Kv == nil {
651 m.Kv = &KeyValue{}
652 }
653 if err := m.Kv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
654 return err
655 }
656 iNdEx = postIndex
657 case 3:
658 if wireType != 2 {
659 return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
660 }
661 var msglen int
662 for shift := uint(0); ; shift += 7 {
663 if shift >= 64 {
664 return ErrIntOverflowKv
665 }
666 if iNdEx >= l {
667 return io.ErrUnexpectedEOF
668 }
669 b := dAtA[iNdEx]
670 iNdEx++
671 msglen |= int(b&0x7F) << shift
672 if b < 0x80 {
673 break
674 }
675 }
676 if msglen < 0 {
677 return ErrInvalidLengthKv
678 }
679 postIndex := iNdEx + msglen
680 if postIndex < 0 {
681 return ErrInvalidLengthKv
682 }
683 if postIndex > l {
684 return io.ErrUnexpectedEOF
685 }
686 if m.PrevKv == nil {
687 m.PrevKv = &KeyValue{}
688 }
689 if err := m.PrevKv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
690 return err
691 }
692 iNdEx = postIndex
693 default:
694 iNdEx = preIndex
695 skippy, err := skipKv(dAtA[iNdEx:])
696 if err != nil {
697 return err
698 }
699 if (skippy < 0) || (iNdEx+skippy) < 0 {
700 return ErrInvalidLengthKv
701 }
702 if (iNdEx + skippy) > l {
703 return io.ErrUnexpectedEOF
704 }
705 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
706 iNdEx += skippy
707 }
708 }
709
710 if iNdEx > l {
711 return io.ErrUnexpectedEOF
712 }
713 return nil
714 }
715 func skipKv(dAtA []byte) (n int, err error) {
716 l := len(dAtA)
717 iNdEx := 0
718 depth := 0
719 for iNdEx < l {
720 var wire uint64
721 for shift := uint(0); ; shift += 7 {
722 if shift >= 64 {
723 return 0, ErrIntOverflowKv
724 }
725 if iNdEx >= l {
726 return 0, io.ErrUnexpectedEOF
727 }
728 b := dAtA[iNdEx]
729 iNdEx++
730 wire |= (uint64(b) & 0x7F) << shift
731 if b < 0x80 {
732 break
733 }
734 }
735 wireType := int(wire & 0x7)
736 switch wireType {
737 case 0:
738 for shift := uint(0); ; shift += 7 {
739 if shift >= 64 {
740 return 0, ErrIntOverflowKv
741 }
742 if iNdEx >= l {
743 return 0, io.ErrUnexpectedEOF
744 }
745 iNdEx++
746 if dAtA[iNdEx-1] < 0x80 {
747 break
748 }
749 }
750 case 1:
751 iNdEx += 8
752 case 2:
753 var length int
754 for shift := uint(0); ; shift += 7 {
755 if shift >= 64 {
756 return 0, ErrIntOverflowKv
757 }
758 if iNdEx >= l {
759 return 0, io.ErrUnexpectedEOF
760 }
761 b := dAtA[iNdEx]
762 iNdEx++
763 length |= (int(b) & 0x7F) << shift
764 if b < 0x80 {
765 break
766 }
767 }
768 if length < 0 {
769 return 0, ErrInvalidLengthKv
770 }
771 iNdEx += length
772 case 3:
773 depth++
774 case 4:
775 if depth == 0 {
776 return 0, ErrUnexpectedEndOfGroupKv
777 }
778 depth--
779 case 5:
780 iNdEx += 4
781 default:
782 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
783 }
784 if iNdEx < 0 {
785 return 0, ErrInvalidLengthKv
786 }
787 if depth == 0 {
788 return iNdEx, nil
789 }
790 }
791 return 0, io.ErrUnexpectedEOF
792 }
793
794 var (
795 ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling")
796 ErrIntOverflowKv = fmt.Errorf("proto: integer overflow")
797 ErrUnexpectedEndOfGroupKv = fmt.Errorf("proto: unexpected end of group")
798 )
799
View as plain text