etcd/wal/walpb/record.pb.go

496 lines
10 KiB
Go
Raw Normal View History

2014-08-05 02:46:12 +04:00
// Code generated by protoc-gen-gogo.
// source: record.proto
// DO NOT EDIT!
/*
2014-09-04 03:46:42 +04:00
Package walpb is a generated protocol buffer package.
2014-08-05 02:46:12 +04:00
It is generated from these files:
record.proto
It has these top-level messages:
Record
2015-01-06 10:27:03 +03:00
Snapshot
2014-08-05 02:46:12 +04:00
*/
2014-09-04 03:46:42 +04:00
package walpb
2014-08-05 02:46:12 +04:00
2016-01-27 04:41:39 +03:00
import (
"fmt"
2014-08-05 02:46:12 +04:00
2016-01-27 04:41:39 +03:00
proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
)
import math "math"
2014-08-05 02:46:12 +04:00
import io "io"
2015-03-25 20:02:00 +03:00
// Reference imports to suppress errors if they are not otherwise used.
2014-08-05 02:46:12 +04:00
var _ = proto.Marshal
2016-01-27 04:41:39 +03:00
var _ = fmt.Errorf
2014-08-05 02:46:12 +04:00
var _ = math.Inf
type Record struct {
2015-06-30 04:37:52 +03:00
Type int64 `protobuf:"varint,1,opt,name=type" json:"type"`
Crc uint32 `protobuf:"varint,2,opt,name=crc" json:"crc"`
2014-08-05 02:46:12 +04:00
Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Record) Reset() { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage() {}
2015-01-06 10:27:03 +03:00
type Snapshot struct {
2015-06-30 04:37:52 +03:00
Index uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
Term uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
2015-01-06 10:27:03 +03:00
XXX_unrecognized []byte `json:"-"`
}
func (m *Snapshot) Reset() { *m = Snapshot{} }
func (m *Snapshot) String() string { return proto.CompactTextString(m) }
func (*Snapshot) ProtoMessage() {}
2016-01-27 04:41:39 +03:00
func init() {
proto.RegisterType((*Record)(nil), "walpb.Record")
proto.RegisterType((*Snapshot)(nil), "walpb.Snapshot")
}
2015-09-04 01:32:25 +03:00
func (m *Record) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *Record) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0x8
i++
i = encodeVarintRecord(data, i, uint64(m.Type))
data[i] = 0x10
i++
i = encodeVarintRecord(data, i, uint64(m.Crc))
if m.Data != nil {
data[i] = 0x1a
i++
i = encodeVarintRecord(data, i, uint64(len(m.Data)))
i += copy(data[i:], m.Data)
}
if m.XXX_unrecognized != nil {
i += copy(data[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *Snapshot) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *Snapshot) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0x8
i++
i = encodeVarintRecord(data, i, uint64(m.Index))
data[i] = 0x10
i++
i = encodeVarintRecord(data, i, uint64(m.Term))
if m.XXX_unrecognized != nil {
i += copy(data[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeFixed64Record(data []byte, offset int, v uint64) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
data[offset+4] = uint8(v >> 32)
data[offset+5] = uint8(v >> 40)
data[offset+6] = uint8(v >> 48)
data[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Record(data []byte, offset int, v uint32) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintRecord(data []byte, offset int, v uint64) int {
for v >= 1<<7 {
data[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
data[offset] = uint8(v)
return offset + 1
}
func (m *Record) Size() (n int) {
var l int
_ = l
n += 1 + sovRecord(uint64(m.Type))
n += 1 + sovRecord(uint64(m.Crc))
if m.Data != nil {
l = len(m.Data)
n += 1 + l + sovRecord(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *Snapshot) Size() (n int) {
var l int
_ = l
n += 1 + sovRecord(uint64(m.Index))
n += 1 + sovRecord(uint64(m.Term))
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovRecord(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozRecord(x uint64) (n int) {
return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63))))
2014-08-05 02:46:12 +04:00
}
func (m *Record) Unmarshal(data []byte) error {
l := len(data)
2015-06-30 02:05:55 +03:00
iNdEx := 0
for iNdEx < l {
2016-01-27 04:41:39 +03:00
preIndex := iNdEx
2014-08-05 02:46:12 +04:00
var wire uint64
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2014-08-05 02:46:12 +04:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2014-08-05 02:46:12 +04:00
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
2016-01-27 04:41:39 +03:00
if wireType == 4 {
return fmt.Errorf("proto: Record: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire)
}
2014-08-05 02:46:12 +04:00
switch fieldNum {
case 1:
if wireType != 0 {
2015-03-25 20:02:00 +03:00
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
2014-08-05 02:46:12 +04:00
}
2015-09-04 01:32:25 +03:00
m.Type = 0
2014-08-05 02:46:12 +04:00
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2014-08-05 02:46:12 +04:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2014-08-05 02:46:12 +04:00
m.Type |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
2015-03-25 20:02:00 +03:00
return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
2014-08-05 02:46:12 +04:00
}
2015-09-04 01:32:25 +03:00
m.Crc = 0
2014-08-05 02:46:12 +04:00
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2014-08-05 02:46:12 +04:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2014-09-04 02:10:15 +04:00
m.Crc |= (uint32(b) & 0x7F) << shift
2014-08-05 02:46:12 +04:00
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
2015-03-25 20:02:00 +03:00
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
2014-08-05 02:46:12 +04:00
}
var byteLen int
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2014-08-05 02:46:12 +04:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2014-08-05 02:46:12 +04:00
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
2015-09-04 01:32:25 +03:00
if byteLen < 0 {
return ErrInvalidLengthRecord
}
2015-06-30 02:05:55 +03:00
postIndex := iNdEx + byteLen
2014-08-05 02:46:12 +04:00
if postIndex > l {
return io.ErrUnexpectedEOF
}
2016-01-27 04:41:39 +03:00
m.Data = append(m.Data[:0], data[iNdEx:postIndex]...)
if m.Data == nil {
m.Data = []byte{}
}
2015-06-30 02:05:55 +03:00
iNdEx = postIndex
2014-08-05 02:46:12 +04:00
default:
2016-01-27 04:41:39 +03:00
iNdEx = preIndex
2015-06-30 02:05:55 +03:00
skippy, err := skipRecord(data[iNdEx:])
2014-08-05 02:46:12 +04:00
if err != nil {
return err
}
2015-09-04 01:32:25 +03:00
if skippy < 0 {
return ErrInvalidLengthRecord
}
2015-06-30 02:05:55 +03:00
if (iNdEx + skippy) > l {
2014-08-05 02:46:12 +04:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
2014-08-05 02:46:12 +04:00
}
}
2015-06-30 02:05:55 +03:00
2016-01-27 04:41:39 +03:00
if iNdEx > l {
return io.ErrUnexpectedEOF
}
2014-08-05 02:46:12 +04:00
return nil
}
2015-01-06 10:27:03 +03:00
func (m *Snapshot) Unmarshal(data []byte) error {
l := len(data)
2015-06-30 02:05:55 +03:00
iNdEx := 0
for iNdEx < l {
2016-01-27 04:41:39 +03:00
preIndex := iNdEx
2015-01-06 10:27:03 +03:00
var wire uint64
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2015-01-06 10:27:03 +03:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2015-01-06 10:27:03 +03:00
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
2016-01-27 04:41:39 +03:00
if wireType == 4 {
return fmt.Errorf("proto: Snapshot: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire)
}
2015-01-06 10:27:03 +03:00
switch fieldNum {
case 1:
if wireType != 0 {
2015-03-25 20:02:00 +03:00
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
2015-01-06 10:27:03 +03:00
}
2015-09-04 01:32:25 +03:00
m.Index = 0
2015-01-06 10:27:03 +03:00
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2015-01-06 10:27:03 +03:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2015-01-06 10:27:03 +03:00
m.Index |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
2015-03-25 20:02:00 +03:00
return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
2015-01-06 10:27:03 +03:00
}
2015-09-04 01:32:25 +03:00
m.Term = 0
2015-01-06 10:27:03 +03:00
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
2015-01-06 10:27:03 +03:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
b := data[iNdEx]
iNdEx++
2015-01-06 10:27:03 +03:00
m.Term |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
2016-01-27 04:41:39 +03:00
iNdEx = preIndex
2015-06-30 02:05:55 +03:00
skippy, err := skipRecord(data[iNdEx:])
2015-01-06 10:27:03 +03:00
if err != nil {
return err
}
2015-09-04 01:32:25 +03:00
if skippy < 0 {
return ErrInvalidLengthRecord
}
2015-06-30 02:05:55 +03:00
if (iNdEx + skippy) > l {
2015-01-06 10:27:03 +03:00
return io.ErrUnexpectedEOF
}
2015-06-30 02:05:55 +03:00
m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
2015-01-06 10:27:03 +03:00
}
}
2015-06-30 02:05:55 +03:00
2016-01-27 04:41:39 +03:00
if iNdEx > l {
return io.ErrUnexpectedEOF
}
2015-01-06 10:27:03 +03:00
return nil
}
2015-06-30 02:05:55 +03:00
func skipRecord(data []byte) (n int, err error) {
l := len(data)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return 0, ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
2016-01-27 04:41:39 +03:00
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if data[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return 0, ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
2015-09-04 01:32:25 +03:00
if length < 0 {
return 0, ErrInvalidLengthRecord
}
2015-06-30 02:05:55 +03:00
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
2016-01-27 04:41:39 +03:00
if shift >= 64 {
return 0, ErrIntOverflowRecord
}
2015-06-30 02:05:55 +03:00
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipRecord(data[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
2015-03-25 20:02:00 +03:00
2015-09-04 01:32:25 +03:00
var (
ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling")
2016-01-27 04:41:39 +03:00
ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow")
2015-09-04 01:32:25 +03:00
)