1
2
3
4 package walpb
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 raftpb "go.etcd.io/etcd/raft/v3/raftpb"
15 )
16
17
18 var _ = proto.Marshal
19 var _ = fmt.Errorf
20 var _ = math.Inf
21
22
23
24
25
26 const _ = proto.ProtoPackageIsVersion3
27
28 type Record struct {
29 Type int64 `protobuf:"varint,1,opt,name=type" json:"type"`
30 Crc uint32 `protobuf:"varint,2,opt,name=crc" json:"crc"`
31 Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
32 XXX_NoUnkeyedLiteral struct{} `json:"-"`
33 XXX_unrecognized []byte `json:"-"`
34 XXX_sizecache int32 `json:"-"`
35 }
36
37 func (m *Record) Reset() { *m = Record{} }
38 func (m *Record) String() string { return proto.CompactTextString(m) }
39 func (*Record) ProtoMessage() {}
40 func (*Record) Descriptor() ([]byte, []int) {
41 return fileDescriptor_bf94fd919e302a1d, []int{0}
42 }
43 func (m *Record) XXX_Unmarshal(b []byte) error {
44 return m.Unmarshal(b)
45 }
46 func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
47 if deterministic {
48 return xxx_messageInfo_Record.Marshal(b, m, deterministic)
49 } else {
50 b = b[:cap(b)]
51 n, err := m.MarshalToSizedBuffer(b)
52 if err != nil {
53 return nil, err
54 }
55 return b[:n], nil
56 }
57 }
58 func (m *Record) XXX_Merge(src proto.Message) {
59 xxx_messageInfo_Record.Merge(m, src)
60 }
61 func (m *Record) XXX_Size() int {
62 return m.Size()
63 }
64 func (m *Record) XXX_DiscardUnknown() {
65 xxx_messageInfo_Record.DiscardUnknown(m)
66 }
67
68 var xxx_messageInfo_Record proto.InternalMessageInfo
69
70
71 type Snapshot struct {
72 Index uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
73 Term uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
74
75 ConfState *raftpb.ConfState `protobuf:"bytes,3,opt,name=conf_state,json=confState" json:"conf_state,omitempty"`
76 XXX_NoUnkeyedLiteral struct{} `json:"-"`
77 XXX_unrecognized []byte `json:"-"`
78 XXX_sizecache int32 `json:"-"`
79 }
80
81 func (m *Snapshot) Reset() { *m = Snapshot{} }
82 func (m *Snapshot) String() string { return proto.CompactTextString(m) }
83 func (*Snapshot) ProtoMessage() {}
84 func (*Snapshot) Descriptor() ([]byte, []int) {
85 return fileDescriptor_bf94fd919e302a1d, []int{1}
86 }
87 func (m *Snapshot) XXX_Unmarshal(b []byte) error {
88 return m.Unmarshal(b)
89 }
90 func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
91 if deterministic {
92 return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic)
93 } else {
94 b = b[:cap(b)]
95 n, err := m.MarshalToSizedBuffer(b)
96 if err != nil {
97 return nil, err
98 }
99 return b[:n], nil
100 }
101 }
102 func (m *Snapshot) XXX_Merge(src proto.Message) {
103 xxx_messageInfo_Snapshot.Merge(m, src)
104 }
105 func (m *Snapshot) XXX_Size() int {
106 return m.Size()
107 }
108 func (m *Snapshot) XXX_DiscardUnknown() {
109 xxx_messageInfo_Snapshot.DiscardUnknown(m)
110 }
111
112 var xxx_messageInfo_Snapshot proto.InternalMessageInfo
113
114 func init() {
115 proto.RegisterType((*Record)(nil), "walpb.Record")
116 proto.RegisterType((*Snapshot)(nil), "walpb.Snapshot")
117 }
118
119 func init() { proto.RegisterFile("record.proto", fileDescriptor_bf94fd919e302a1d) }
120
121 var fileDescriptor_bf94fd919e302a1d = []byte{
122
123 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x8e, 0x41, 0x4e, 0xc3, 0x30,
124 0x10, 0x45, 0x63, 0xe2, 0x22, 0x18, 0xca, 0x02, 0xab, 0xaa, 0xa2, 0x2c, 0x4c, 0xd4, 0x55, 0x56,
125 0x29, 0xe2, 0x08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 0x0c, 0x5a, 0x7c, 0x0d, 0x5a, 0xbc, 0xff, 0xe8, 0xe4, 0x37, 0x00, 0x00,
137 0xff, 0xff, 0xc3, 0x36, 0x0c, 0xad, 0x1d, 0x01, 0x00, 0x00,
138 }
139
140 func (m *Record) Marshal() (dAtA []byte, err error) {
141 size := m.Size()
142 dAtA = make([]byte, size)
143 n, err := m.MarshalToSizedBuffer(dAtA[:size])
144 if err != nil {
145 return nil, err
146 }
147 return dAtA[:n], nil
148 }
149
150 func (m *Record) MarshalTo(dAtA []byte) (int, error) {
151 size := m.Size()
152 return m.MarshalToSizedBuffer(dAtA[:size])
153 }
154
155 func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) {
156 i := len(dAtA)
157 _ = i
158 var l int
159 _ = l
160 if m.XXX_unrecognized != nil {
161 i -= len(m.XXX_unrecognized)
162 copy(dAtA[i:], m.XXX_unrecognized)
163 }
164 if m.Data != nil {
165 i -= len(m.Data)
166 copy(dAtA[i:], m.Data)
167 i = encodeVarintRecord(dAtA, i, uint64(len(m.Data)))
168 i--
169 dAtA[i] = 0x1a
170 }
171 i = encodeVarintRecord(dAtA, i, uint64(m.Crc))
172 i--
173 dAtA[i] = 0x10
174 i = encodeVarintRecord(dAtA, i, uint64(m.Type))
175 i--
176 dAtA[i] = 0x8
177 return len(dAtA) - i, nil
178 }
179
180 func (m *Snapshot) Marshal() (dAtA []byte, err error) {
181 size := m.Size()
182 dAtA = make([]byte, size)
183 n, err := m.MarshalToSizedBuffer(dAtA[:size])
184 if err != nil {
185 return nil, err
186 }
187 return dAtA[:n], nil
188 }
189
190 func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) {
191 size := m.Size()
192 return m.MarshalToSizedBuffer(dAtA[:size])
193 }
194
195 func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
196 i := len(dAtA)
197 _ = i
198 var l int
199 _ = l
200 if m.XXX_unrecognized != nil {
201 i -= len(m.XXX_unrecognized)
202 copy(dAtA[i:], m.XXX_unrecognized)
203 }
204 if m.ConfState != nil {
205 {
206 size, err := m.ConfState.MarshalToSizedBuffer(dAtA[:i])
207 if err != nil {
208 return 0, err
209 }
210 i -= size
211 i = encodeVarintRecord(dAtA, i, uint64(size))
212 }
213 i--
214 dAtA[i] = 0x1a
215 }
216 i = encodeVarintRecord(dAtA, i, uint64(m.Term))
217 i--
218 dAtA[i] = 0x10
219 i = encodeVarintRecord(dAtA, i, uint64(m.Index))
220 i--
221 dAtA[i] = 0x8
222 return len(dAtA) - i, nil
223 }
224
225 func encodeVarintRecord(dAtA []byte, offset int, v uint64) int {
226 offset -= sovRecord(v)
227 base := offset
228 for v >= 1<<7 {
229 dAtA[offset] = uint8(v&0x7f | 0x80)
230 v >>= 7
231 offset++
232 }
233 dAtA[offset] = uint8(v)
234 return base
235 }
236 func (m *Record) Size() (n int) {
237 if m == nil {
238 return 0
239 }
240 var l int
241 _ = l
242 n += 1 + sovRecord(uint64(m.Type))
243 n += 1 + sovRecord(uint64(m.Crc))
244 if m.Data != nil {
245 l = len(m.Data)
246 n += 1 + l + sovRecord(uint64(l))
247 }
248 if m.XXX_unrecognized != nil {
249 n += len(m.XXX_unrecognized)
250 }
251 return n
252 }
253
254 func (m *Snapshot) Size() (n int) {
255 if m == nil {
256 return 0
257 }
258 var l int
259 _ = l
260 n += 1 + sovRecord(uint64(m.Index))
261 n += 1 + sovRecord(uint64(m.Term))
262 if m.ConfState != nil {
263 l = m.ConfState.Size()
264 n += 1 + l + sovRecord(uint64(l))
265 }
266 if m.XXX_unrecognized != nil {
267 n += len(m.XXX_unrecognized)
268 }
269 return n
270 }
271
272 func sovRecord(x uint64) (n int) {
273 return (math_bits.Len64(x|1) + 6) / 7
274 }
275 func sozRecord(x uint64) (n int) {
276 return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63))))
277 }
278 func (m *Record) Unmarshal(dAtA []byte) error {
279 l := len(dAtA)
280 iNdEx := 0
281 for iNdEx < l {
282 preIndex := iNdEx
283 var wire uint64
284 for shift := uint(0); ; shift += 7 {
285 if shift >= 64 {
286 return ErrIntOverflowRecord
287 }
288 if iNdEx >= l {
289 return io.ErrUnexpectedEOF
290 }
291 b := dAtA[iNdEx]
292 iNdEx++
293 wire |= uint64(b&0x7F) << shift
294 if b < 0x80 {
295 break
296 }
297 }
298 fieldNum := int32(wire >> 3)
299 wireType := int(wire & 0x7)
300 if wireType == 4 {
301 return fmt.Errorf("proto: Record: wiretype end group for non-group")
302 }
303 if fieldNum <= 0 {
304 return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire)
305 }
306 switch fieldNum {
307 case 1:
308 if wireType != 0 {
309 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
310 }
311 m.Type = 0
312 for shift := uint(0); ; shift += 7 {
313 if shift >= 64 {
314 return ErrIntOverflowRecord
315 }
316 if iNdEx >= l {
317 return io.ErrUnexpectedEOF
318 }
319 b := dAtA[iNdEx]
320 iNdEx++
321 m.Type |= int64(b&0x7F) << shift
322 if b < 0x80 {
323 break
324 }
325 }
326 case 2:
327 if wireType != 0 {
328 return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
329 }
330 m.Crc = 0
331 for shift := uint(0); ; shift += 7 {
332 if shift >= 64 {
333 return ErrIntOverflowRecord
334 }
335 if iNdEx >= l {
336 return io.ErrUnexpectedEOF
337 }
338 b := dAtA[iNdEx]
339 iNdEx++
340 m.Crc |= uint32(b&0x7F) << shift
341 if b < 0x80 {
342 break
343 }
344 }
345 case 3:
346 if wireType != 2 {
347 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
348 }
349 var byteLen int
350 for shift := uint(0); ; shift += 7 {
351 if shift >= 64 {
352 return ErrIntOverflowRecord
353 }
354 if iNdEx >= l {
355 return io.ErrUnexpectedEOF
356 }
357 b := dAtA[iNdEx]
358 iNdEx++
359 byteLen |= int(b&0x7F) << shift
360 if b < 0x80 {
361 break
362 }
363 }
364 if byteLen < 0 {
365 return ErrInvalidLengthRecord
366 }
367 postIndex := iNdEx + byteLen
368 if postIndex < 0 {
369 return ErrInvalidLengthRecord
370 }
371 if postIndex > l {
372 return io.ErrUnexpectedEOF
373 }
374 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
375 if m.Data == nil {
376 m.Data = []byte{}
377 }
378 iNdEx = postIndex
379 default:
380 iNdEx = preIndex
381 skippy, err := skipRecord(dAtA[iNdEx:])
382 if err != nil {
383 return err
384 }
385 if (skippy < 0) || (iNdEx+skippy) < 0 {
386 return ErrInvalidLengthRecord
387 }
388 if (iNdEx + skippy) > l {
389 return io.ErrUnexpectedEOF
390 }
391 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
392 iNdEx += skippy
393 }
394 }
395
396 if iNdEx > l {
397 return io.ErrUnexpectedEOF
398 }
399 return nil
400 }
401 func (m *Snapshot) Unmarshal(dAtA []byte) error {
402 l := len(dAtA)
403 iNdEx := 0
404 for iNdEx < l {
405 preIndex := iNdEx
406 var wire uint64
407 for shift := uint(0); ; shift += 7 {
408 if shift >= 64 {
409 return ErrIntOverflowRecord
410 }
411 if iNdEx >= l {
412 return io.ErrUnexpectedEOF
413 }
414 b := dAtA[iNdEx]
415 iNdEx++
416 wire |= uint64(b&0x7F) << shift
417 if b < 0x80 {
418 break
419 }
420 }
421 fieldNum := int32(wire >> 3)
422 wireType := int(wire & 0x7)
423 if wireType == 4 {
424 return fmt.Errorf("proto: Snapshot: wiretype end group for non-group")
425 }
426 if fieldNum <= 0 {
427 return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire)
428 }
429 switch fieldNum {
430 case 1:
431 if wireType != 0 {
432 return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
433 }
434 m.Index = 0
435 for shift := uint(0); ; shift += 7 {
436 if shift >= 64 {
437 return ErrIntOverflowRecord
438 }
439 if iNdEx >= l {
440 return io.ErrUnexpectedEOF
441 }
442 b := dAtA[iNdEx]
443 iNdEx++
444 m.Index |= uint64(b&0x7F) << shift
445 if b < 0x80 {
446 break
447 }
448 }
449 case 2:
450 if wireType != 0 {
451 return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
452 }
453 m.Term = 0
454 for shift := uint(0); ; shift += 7 {
455 if shift >= 64 {
456 return ErrIntOverflowRecord
457 }
458 if iNdEx >= l {
459 return io.ErrUnexpectedEOF
460 }
461 b := dAtA[iNdEx]
462 iNdEx++
463 m.Term |= uint64(b&0x7F) << shift
464 if b < 0x80 {
465 break
466 }
467 }
468 case 3:
469 if wireType != 2 {
470 return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType)
471 }
472 var msglen int
473 for shift := uint(0); ; shift += 7 {
474 if shift >= 64 {
475 return ErrIntOverflowRecord
476 }
477 if iNdEx >= l {
478 return io.ErrUnexpectedEOF
479 }
480 b := dAtA[iNdEx]
481 iNdEx++
482 msglen |= int(b&0x7F) << shift
483 if b < 0x80 {
484 break
485 }
486 }
487 if msglen < 0 {
488 return ErrInvalidLengthRecord
489 }
490 postIndex := iNdEx + msglen
491 if postIndex < 0 {
492 return ErrInvalidLengthRecord
493 }
494 if postIndex > l {
495 return io.ErrUnexpectedEOF
496 }
497 if m.ConfState == nil {
498 m.ConfState = &raftpb.ConfState{}
499 }
500 if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
501 return err
502 }
503 iNdEx = postIndex
504 default:
505 iNdEx = preIndex
506 skippy, err := skipRecord(dAtA[iNdEx:])
507 if err != nil {
508 return err
509 }
510 if (skippy < 0) || (iNdEx+skippy) < 0 {
511 return ErrInvalidLengthRecord
512 }
513 if (iNdEx + skippy) > l {
514 return io.ErrUnexpectedEOF
515 }
516 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
517 iNdEx += skippy
518 }
519 }
520
521 if iNdEx > l {
522 return io.ErrUnexpectedEOF
523 }
524 return nil
525 }
526 func skipRecord(dAtA []byte) (n int, err error) {
527 l := len(dAtA)
528 iNdEx := 0
529 depth := 0
530 for iNdEx < l {
531 var wire uint64
532 for shift := uint(0); ; shift += 7 {
533 if shift >= 64 {
534 return 0, ErrIntOverflowRecord
535 }
536 if iNdEx >= l {
537 return 0, io.ErrUnexpectedEOF
538 }
539 b := dAtA[iNdEx]
540 iNdEx++
541 wire |= (uint64(b) & 0x7F) << shift
542 if b < 0x80 {
543 break
544 }
545 }
546 wireType := int(wire & 0x7)
547 switch wireType {
548 case 0:
549 for shift := uint(0); ; shift += 7 {
550 if shift >= 64 {
551 return 0, ErrIntOverflowRecord
552 }
553 if iNdEx >= l {
554 return 0, io.ErrUnexpectedEOF
555 }
556 iNdEx++
557 if dAtA[iNdEx-1] < 0x80 {
558 break
559 }
560 }
561 case 1:
562 iNdEx += 8
563 case 2:
564 var length int
565 for shift := uint(0); ; shift += 7 {
566 if shift >= 64 {
567 return 0, ErrIntOverflowRecord
568 }
569 if iNdEx >= l {
570 return 0, io.ErrUnexpectedEOF
571 }
572 b := dAtA[iNdEx]
573 iNdEx++
574 length |= (int(b) & 0x7F) << shift
575 if b < 0x80 {
576 break
577 }
578 }
579 if length < 0 {
580 return 0, ErrInvalidLengthRecord
581 }
582 iNdEx += length
583 case 3:
584 depth++
585 case 4:
586 if depth == 0 {
587 return 0, ErrUnexpectedEndOfGroupRecord
588 }
589 depth--
590 case 5:
591 iNdEx += 4
592 default:
593 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
594 }
595 if iNdEx < 0 {
596 return 0, ErrInvalidLengthRecord
597 }
598 if depth == 0 {
599 return iNdEx, nil
600 }
601 }
602 return 0, io.ErrUnexpectedEOF
603 }
604
605 var (
606 ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling")
607 ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow")
608 ErrUnexpectedEndOfGroupRecord = fmt.Errorf("proto: unexpected end of group")
609 )
610
View as plain text