1
2
3
4 package snappb
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 Snapshot struct {
28 Crc uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"`
29 Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
30 XXX_NoUnkeyedLiteral struct{} `json:"-"`
31 XXX_unrecognized []byte `json:"-"`
32 XXX_sizecache int32 `json:"-"`
33 }
34
35 func (m *Snapshot) Reset() { *m = Snapshot{} }
36 func (m *Snapshot) String() string { return proto.CompactTextString(m) }
37 func (*Snapshot) ProtoMessage() {}
38 func (*Snapshot) Descriptor() ([]byte, []int) {
39 return fileDescriptor_f2e3c045ebf84d00, []int{0}
40 }
41 func (m *Snapshot) XXX_Unmarshal(b []byte) error {
42 return m.Unmarshal(b)
43 }
44 func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
45 if deterministic {
46 return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic)
47 } else {
48 b = b[:cap(b)]
49 n, err := m.MarshalToSizedBuffer(b)
50 if err != nil {
51 return nil, err
52 }
53 return b[:n], nil
54 }
55 }
56 func (m *Snapshot) XXX_Merge(src proto.Message) {
57 xxx_messageInfo_Snapshot.Merge(m, src)
58 }
59 func (m *Snapshot) XXX_Size() int {
60 return m.Size()
61 }
62 func (m *Snapshot) XXX_DiscardUnknown() {
63 xxx_messageInfo_Snapshot.DiscardUnknown(m)
64 }
65
66 var xxx_messageInfo_Snapshot proto.InternalMessageInfo
67
68 func init() {
69 proto.RegisterType((*Snapshot)(nil), "snappb.snapshot")
70 }
71
72 func init() { proto.RegisterFile("snap.proto", fileDescriptor_f2e3c045ebf84d00) }
73
74 var fileDescriptor_f2e3c045ebf84d00 = []byte{
75
76 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xce, 0x4b, 0x2c,
77 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0xb1, 0x0b, 0x92, 0xa4, 0x44, 0xd2, 0xf3,
78 0xd3, 0xf3, 0xc1, 0x42, 0xfa, 0x20, 0x16, 0x44, 0x56, 0xc9, 0x8c, 0x8b, 0x03, 0x24, 0x5f, 0x9c,
79 0x91, 0x5f, 0x22, 0x24, 0xc6, 0xc5, 0x9c, 0x5c, 0x94, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xeb,
80 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x40, 0x48, 0x88, 0x8b, 0x25, 0x25, 0xb1, 0x24,
81 0x51, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xcc, 0x76, 0x12, 0x39, 0xf1, 0x50, 0x8e, 0xe1,
82 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e,
83 0x01, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x0f, 0x32, 0xb2, 0x78, 0x00, 0x00, 0x00,
84 }
85
86 func (m *Snapshot) Marshal() (dAtA []byte, err error) {
87 size := m.Size()
88 dAtA = make([]byte, size)
89 n, err := m.MarshalToSizedBuffer(dAtA[:size])
90 if err != nil {
91 return nil, err
92 }
93 return dAtA[:n], nil
94 }
95
96 func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) {
97 size := m.Size()
98 return m.MarshalToSizedBuffer(dAtA[:size])
99 }
100
101 func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
102 i := len(dAtA)
103 _ = i
104 var l int
105 _ = l
106 if m.XXX_unrecognized != nil {
107 i -= len(m.XXX_unrecognized)
108 copy(dAtA[i:], m.XXX_unrecognized)
109 }
110 if m.Data != nil {
111 i -= len(m.Data)
112 copy(dAtA[i:], m.Data)
113 i = encodeVarintSnap(dAtA, i, uint64(len(m.Data)))
114 i--
115 dAtA[i] = 0x12
116 }
117 i = encodeVarintSnap(dAtA, i, uint64(m.Crc))
118 i--
119 dAtA[i] = 0x8
120 return len(dAtA) - i, nil
121 }
122
123 func encodeVarintSnap(dAtA []byte, offset int, v uint64) int {
124 offset -= sovSnap(v)
125 base := offset
126 for v >= 1<<7 {
127 dAtA[offset] = uint8(v&0x7f | 0x80)
128 v >>= 7
129 offset++
130 }
131 dAtA[offset] = uint8(v)
132 return base
133 }
134 func (m *Snapshot) Size() (n int) {
135 if m == nil {
136 return 0
137 }
138 var l int
139 _ = l
140 n += 1 + sovSnap(uint64(m.Crc))
141 if m.Data != nil {
142 l = len(m.Data)
143 n += 1 + l + sovSnap(uint64(l))
144 }
145 if m.XXX_unrecognized != nil {
146 n += len(m.XXX_unrecognized)
147 }
148 return n
149 }
150
151 func sovSnap(x uint64) (n int) {
152 return (math_bits.Len64(x|1) + 6) / 7
153 }
154 func sozSnap(x uint64) (n int) {
155 return sovSnap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
156 }
157 func (m *Snapshot) Unmarshal(dAtA []byte) error {
158 l := len(dAtA)
159 iNdEx := 0
160 for iNdEx < l {
161 preIndex := iNdEx
162 var wire uint64
163 for shift := uint(0); ; shift += 7 {
164 if shift >= 64 {
165 return ErrIntOverflowSnap
166 }
167 if iNdEx >= l {
168 return io.ErrUnexpectedEOF
169 }
170 b := dAtA[iNdEx]
171 iNdEx++
172 wire |= uint64(b&0x7F) << shift
173 if b < 0x80 {
174 break
175 }
176 }
177 fieldNum := int32(wire >> 3)
178 wireType := int(wire & 0x7)
179 if wireType == 4 {
180 return fmt.Errorf("proto: snapshot: wiretype end group for non-group")
181 }
182 if fieldNum <= 0 {
183 return fmt.Errorf("proto: snapshot: illegal tag %d (wire type %d)", fieldNum, wire)
184 }
185 switch fieldNum {
186 case 1:
187 if wireType != 0 {
188 return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
189 }
190 m.Crc = 0
191 for shift := uint(0); ; shift += 7 {
192 if shift >= 64 {
193 return ErrIntOverflowSnap
194 }
195 if iNdEx >= l {
196 return io.ErrUnexpectedEOF
197 }
198 b := dAtA[iNdEx]
199 iNdEx++
200 m.Crc |= uint32(b&0x7F) << shift
201 if b < 0x80 {
202 break
203 }
204 }
205 case 2:
206 if wireType != 2 {
207 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
208 }
209 var byteLen int
210 for shift := uint(0); ; shift += 7 {
211 if shift >= 64 {
212 return ErrIntOverflowSnap
213 }
214 if iNdEx >= l {
215 return io.ErrUnexpectedEOF
216 }
217 b := dAtA[iNdEx]
218 iNdEx++
219 byteLen |= int(b&0x7F) << shift
220 if b < 0x80 {
221 break
222 }
223 }
224 if byteLen < 0 {
225 return ErrInvalidLengthSnap
226 }
227 postIndex := iNdEx + byteLen
228 if postIndex < 0 {
229 return ErrInvalidLengthSnap
230 }
231 if postIndex > l {
232 return io.ErrUnexpectedEOF
233 }
234 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
235 if m.Data == nil {
236 m.Data = []byte{}
237 }
238 iNdEx = postIndex
239 default:
240 iNdEx = preIndex
241 skippy, err := skipSnap(dAtA[iNdEx:])
242 if err != nil {
243 return err
244 }
245 if (skippy < 0) || (iNdEx+skippy) < 0 {
246 return ErrInvalidLengthSnap
247 }
248 if (iNdEx + skippy) > l {
249 return io.ErrUnexpectedEOF
250 }
251 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
252 iNdEx += skippy
253 }
254 }
255
256 if iNdEx > l {
257 return io.ErrUnexpectedEOF
258 }
259 return nil
260 }
261 func skipSnap(dAtA []byte) (n int, err error) {
262 l := len(dAtA)
263 iNdEx := 0
264 depth := 0
265 for iNdEx < l {
266 var wire uint64
267 for shift := uint(0); ; shift += 7 {
268 if shift >= 64 {
269 return 0, ErrIntOverflowSnap
270 }
271 if iNdEx >= l {
272 return 0, io.ErrUnexpectedEOF
273 }
274 b := dAtA[iNdEx]
275 iNdEx++
276 wire |= (uint64(b) & 0x7F) << shift
277 if b < 0x80 {
278 break
279 }
280 }
281 wireType := int(wire & 0x7)
282 switch wireType {
283 case 0:
284 for shift := uint(0); ; shift += 7 {
285 if shift >= 64 {
286 return 0, ErrIntOverflowSnap
287 }
288 if iNdEx >= l {
289 return 0, io.ErrUnexpectedEOF
290 }
291 iNdEx++
292 if dAtA[iNdEx-1] < 0x80 {
293 break
294 }
295 }
296 case 1:
297 iNdEx += 8
298 case 2:
299 var length int
300 for shift := uint(0); ; shift += 7 {
301 if shift >= 64 {
302 return 0, ErrIntOverflowSnap
303 }
304 if iNdEx >= l {
305 return 0, io.ErrUnexpectedEOF
306 }
307 b := dAtA[iNdEx]
308 iNdEx++
309 length |= (int(b) & 0x7F) << shift
310 if b < 0x80 {
311 break
312 }
313 }
314 if length < 0 {
315 return 0, ErrInvalidLengthSnap
316 }
317 iNdEx += length
318 case 3:
319 depth++
320 case 4:
321 if depth == 0 {
322 return 0, ErrUnexpectedEndOfGroupSnap
323 }
324 depth--
325 case 5:
326 iNdEx += 4
327 default:
328 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
329 }
330 if iNdEx < 0 {
331 return 0, ErrInvalidLengthSnap
332 }
333 if depth == 0 {
334 return iNdEx, nil
335 }
336 }
337 return 0, io.ErrUnexpectedEOF
338 }
339
340 var (
341 ErrInvalidLengthSnap = fmt.Errorf("proto: negative length found during unmarshaling")
342 ErrIntOverflowSnap = fmt.Errorf("proto: integer overflow")
343 ErrUnexpectedEndOfGroupSnap = fmt.Errorf("proto: unexpected end of group")
344 )
345
View as plain text