Skip to content
File

Blob: spec/protocol/transport_vtproto.pb.go

go599 lines
1// Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
2// protoc-gen-go-vtproto version: v0.6.0
3// source: spec/proto/transport.proto
4 
5package protocol
6 
7import (
8 fmt "fmt"
9 protohelpers "github.com/planetscale/vtprotobuf/protohelpers"
10 protoimpl "google.golang.org/protobuf/runtime/protoimpl"
11 io "io"
12)
13 
14const (
15 // Verify that this generated code is sufficiently up-to-date.
16 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
17 // Verify that runtime/protoimpl is sufficiently up-to-date.
18 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
19)
20 
21func (m *Stream) MarshalVT() (dAtA []byte, err error) {
22 if m == nil {
23 return nil, nil
24 }
25 size := m.SizeVT()
26 dAtA = make([]byte, size)
27 n, err := m.MarshalToSizedBufferVT(dAtA[:size])
28 if err != nil {
29 return nil, err
30 }
31 return dAtA[:n], nil
32}
33 
34func (m *Stream) MarshalToVT(dAtA []byte) (int, error) {
35 size := m.SizeVT()
36 return m.MarshalToSizedBufferVT(dAtA[:size])
37}
38 
39func (m *Stream) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
40 if m == nil {
41 return 0, nil
42 }
43 i := len(dAtA)
44 _ = i
45 var l int
46 _ = l
47 if m.unknownFields != nil {
48 i -= len(m.unknownFields)
49 copy(dAtA[i:], m.unknownFields)
50 }
51 if m.Target != nil {
52 size, err := m.Target.MarshalToSizedBufferVT(dAtA[:i])
53 if err != nil {
54 return 0, err
55 }
56 i -= size
57 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
58 i--
59 dAtA[i] = 0x12
60 }
61 if m.Type != 0 {
62 i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type))
63 i--
64 dAtA[i] = 0x8
65 }
66 return len(dAtA) - i, nil
67}
68 
69func (m *Datagram) MarshalVT() (dAtA []byte, err error) {
70 if m == nil {
71 return nil, nil
72 }
73 size := m.SizeVT()
74 dAtA = make([]byte, size)
75 n, err := m.MarshalToSizedBufferVT(dAtA[:size])
76 if err != nil {
77 return nil, err
78 }
79 return dAtA[:n], nil
80}
81 
82func (m *Datagram) MarshalToVT(dAtA []byte) (int, error) {
83 size := m.SizeVT()
84 return m.MarshalToSizedBufferVT(dAtA[:size])
85}
86 
87func (m *Datagram) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
88 if m == nil {
89 return 0, nil
90 }
91 i := len(dAtA)
92 _ = i
93 var l int
94 _ = l
95 if m.unknownFields != nil {
96 i -= len(m.unknownFields)
97 copy(dAtA[i:], m.unknownFields)
98 }
99 if len(m.Data) > 0 {
100 i -= len(m.Data)
101 copy(dAtA[i:], m.Data)
102 i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data)))
103 i--
104 dAtA[i] = 0x12
105 }
106 if m.Type != 0 {
107 i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type))
108 i--
109 dAtA[i] = 0x8
110 }
111 return len(dAtA) - i, nil
112}
113 
114func (m *Connection) MarshalVT() (dAtA []byte, err error) {
115 if m == nil {
116 return nil, nil
117 }
118 size := m.SizeVT()
119 dAtA = make([]byte, size)
120 n, err := m.MarshalToSizedBufferVT(dAtA[:size])
121 if err != nil {
122 return nil, err
123 }
124 return dAtA[:n], nil
125}
126 
127func (m *Connection) MarshalToVT(dAtA []byte) (int, error) {
128 size := m.SizeVT()
129 return m.MarshalToSizedBufferVT(dAtA[:size])
130}
131 
132func (m *Connection) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
133 if m == nil {
134 return 0, nil
135 }
136 i := len(dAtA)
137 _ = i
138 var l int
139 _ = l
140 if m.unknownFields != nil {
141 i -= len(m.unknownFields)
142 copy(dAtA[i:], m.unknownFields)
143 }
144 if len(m.Version) > 0 {
145 i -= len(m.Version)
146 copy(dAtA[i:], m.Version)
147 i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Version)))
148 i--
149 dAtA[i] = 0x2a
150 }
151 if m.CacheDirection != 0 {
152 i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CacheDirection))
153 i--
154 dAtA[i] = 0x18
155 }
156 if m.CacheState != 0 {
157 i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CacheState))
158 i--
159 dAtA[i] = 0x10
160 }
161 if m.Identity != nil {
162 size, err := m.Identity.MarshalToSizedBufferVT(dAtA[:i])
163 if err != nil {
164 return 0, err
165 }
166 i -= size
167 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
168 i--
169 dAtA[i] = 0xa
170 }
171 return len(dAtA) - i, nil
172}
173 
174func (m *Stream) SizeVT() (n int) {
175 if m == nil {
176 return 0
177 }
178 var l int
179 _ = l
180 if m.Type != 0 {
181 n += 1 + protohelpers.SizeOfVarint(uint64(m.Type))
182 }
183 if m.Target != nil {
184 l = m.Target.SizeVT()
185 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
186 }
187 n += len(m.unknownFields)
188 return n
189}
190 
191func (m *Datagram) SizeVT() (n int) {
192 if m == nil {
193 return 0
194 }
195 var l int
196 _ = l
197 if m.Type != 0 {
198 n += 1 + protohelpers.SizeOfVarint(uint64(m.Type))
199 }
200 l = len(m.Data)
201 if l > 0 {
202 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
203 }
204 n += len(m.unknownFields)
205 return n
206}
207 
208func (m *Connection) SizeVT() (n int) {
209 if m == nil {
210 return 0
211 }
212 var l int
213 _ = l
214 if m.Identity != nil {
215 l = m.Identity.SizeVT()
216 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
217 }
218 if m.CacheState != 0 {
219 n += 1 + protohelpers.SizeOfVarint(uint64(m.CacheState))
220 }
221 if m.CacheDirection != 0 {
222 n += 1 + protohelpers.SizeOfVarint(uint64(m.CacheDirection))
223 }
224 l = len(m.Version)
225 if l > 0 {
226 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
227 }
228 n += len(m.unknownFields)
229 return n
230}
231 
232func (m *Stream) UnmarshalVT(dAtA []byte) error {
233 l := len(dAtA)
234 iNdEx := 0
235 for iNdEx < l {
236 preIndex := iNdEx
237 var wire uint64
238 for shift := uint(0); ; shift += 7 {
239 if shift >= 64 {
240 return protohelpers.ErrIntOverflow
241 }
242 if iNdEx >= l {
243 return io.ErrUnexpectedEOF
244 }
245 b := dAtA[iNdEx]
246 iNdEx++
247 wire |= uint64(b&0x7F) << shift
248 if b < 0x80 {
249 break
250 }
251 }
252 fieldNum := int32(wire >> 3)
253 wireType := int(wire & 0x7)
254 if wireType == 4 {
255 return fmt.Errorf("proto: Stream: wiretype end group for non-group")
256 }
257 if fieldNum <= 0 {
258 return fmt.Errorf("proto: Stream: illegal tag %d (wire type %d)", fieldNum, wire)
259 }
260 switch fieldNum {
261 case 1:
262 if wireType != 0 {
263 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
264 }
265 m.Type = 0
266 for shift := uint(0); ; shift += 7 {
267 if shift >= 64 {
268 return protohelpers.ErrIntOverflow
269 }
270 if iNdEx >= l {
271 return io.ErrUnexpectedEOF
272 }
273 b := dAtA[iNdEx]
274 iNdEx++
275 m.Type |= Stream_Type(b&0x7F) << shift
276 if b < 0x80 {
277 break
278 }
279 }
280 case 2:
281 if wireType != 2 {
282 return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType)
283 }
284 var msglen int
285 for shift := uint(0); ; shift += 7 {
286 if shift >= 64 {
287 return protohelpers.ErrIntOverflow
288 }
289 if iNdEx >= l {
290 return io.ErrUnexpectedEOF
291 }
292 b := dAtA[iNdEx]
293 iNdEx++
294 msglen |= int(b&0x7F) << shift
295 if b < 0x80 {
296 break
297 }
298 }
299 if msglen < 0 {
300 return protohelpers.ErrInvalidLength
301 }
302 postIndex := iNdEx + msglen
303 if postIndex < 0 {
304 return protohelpers.ErrInvalidLength
305 }
306 if postIndex > l {
307 return io.ErrUnexpectedEOF
308 }
309 if m.Target == nil {
310 m.Target = &Node{}
311 }
312 if err := m.Target.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
313 return err
314 }
315 iNdEx = postIndex
316 default:
317 iNdEx = preIndex
318 skippy, err := protohelpers.Skip(dAtA[iNdEx:])
319 if err != nil {
320 return err
321 }
322 if (skippy < 0) || (iNdEx+skippy) < 0 {
323 return protohelpers.ErrInvalidLength
324 }
325 if (iNdEx + skippy) > l {
326 return io.ErrUnexpectedEOF
327 }
328 m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
329 iNdEx += skippy
330 }
331 }
332 
333 if iNdEx > l {
334 return io.ErrUnexpectedEOF
335 }
336 return nil
337}
338func (m *Datagram) UnmarshalVT(dAtA []byte) error {
339 l := len(dAtA)
340 iNdEx := 0
341 for iNdEx < l {
342 preIndex := iNdEx
343 var wire uint64
344 for shift := uint(0); ; shift += 7 {
345 if shift >= 64 {
346 return protohelpers.ErrIntOverflow
347 }
348 if iNdEx >= l {
349 return io.ErrUnexpectedEOF
350 }
351 b := dAtA[iNdEx]
352 iNdEx++
353 wire |= uint64(b&0x7F) << shift
354 if b < 0x80 {
355 break
356 }
357 }
358 fieldNum := int32(wire >> 3)
359 wireType := int(wire & 0x7)
360 if wireType == 4 {
361 return fmt.Errorf("proto: Datagram: wiretype end group for non-group")
362 }
363 if fieldNum <= 0 {
364 return fmt.Errorf("proto: Datagram: illegal tag %d (wire type %d)", fieldNum, wire)
365 }
366 switch fieldNum {
367 case 1:
368 if wireType != 0 {
369 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
370 }
371 m.Type = 0
372 for shift := uint(0); ; shift += 7 {
373 if shift >= 64 {
374 return protohelpers.ErrIntOverflow
375 }
376 if iNdEx >= l {
377 return io.ErrUnexpectedEOF
378 }
379 b := dAtA[iNdEx]
380 iNdEx++
381 m.Type |= Datagram_Type(b&0x7F) << shift
382 if b < 0x80 {
383 break
384 }
385 }
386 case 2:
387 if wireType != 2 {
388 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
389 }
390 var byteLen int
391 for shift := uint(0); ; shift += 7 {
392 if shift >= 64 {
393 return protohelpers.ErrIntOverflow
394 }
395 if iNdEx >= l {
396 return io.ErrUnexpectedEOF
397 }
398 b := dAtA[iNdEx]
399 iNdEx++
400 byteLen |= int(b&0x7F) << shift
401 if b < 0x80 {
402 break
403 }
404 }
405 if byteLen < 0 {
406 return protohelpers.ErrInvalidLength
407 }
408 postIndex := iNdEx + byteLen
409 if postIndex < 0 {
410 return protohelpers.ErrInvalidLength
411 }
412 if postIndex > l {
413 return io.ErrUnexpectedEOF
414 }
415 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
416 if m.Data == nil {
417 m.Data = []byte{}
418 }
419 iNdEx = postIndex
420 default:
421 iNdEx = preIndex
422 skippy, err := protohelpers.Skip(dAtA[iNdEx:])
423 if err != nil {
424 return err
425 }
426 if (skippy < 0) || (iNdEx+skippy) < 0 {
427 return protohelpers.ErrInvalidLength
428 }
429 if (iNdEx + skippy) > l {
430 return io.ErrUnexpectedEOF
431 }
432 m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
433 iNdEx += skippy
434 }
435 }
436 
437 if iNdEx > l {
438 return io.ErrUnexpectedEOF
439 }
440 return nil
441}
442func (m *Connection) UnmarshalVT(dAtA []byte) error {
443 l := len(dAtA)
444 iNdEx := 0
445 for iNdEx < l {
446 preIndex := iNdEx
447 var wire uint64
448 for shift := uint(0); ; shift += 7 {
449 if shift >= 64 {
450 return protohelpers.ErrIntOverflow
451 }
452 if iNdEx >= l {
453 return io.ErrUnexpectedEOF
454 }
455 b := dAtA[iNdEx]
456 iNdEx++
457 wire |= uint64(b&0x7F) << shift
458 if b < 0x80 {
459 break
460 }
461 }
462 fieldNum := int32(wire >> 3)
463 wireType := int(wire & 0x7)
464 if wireType == 4 {
465 return fmt.Errorf("proto: Connection: wiretype end group for non-group")
466 }
467 if fieldNum <= 0 {
468 return fmt.Errorf("proto: Connection: illegal tag %d (wire type %d)", fieldNum, wire)
469 }
470 switch fieldNum {
471 case 1:
472 if wireType != 2 {
473 return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType)
474 }
475 var msglen int
476 for shift := uint(0); ; shift += 7 {
477 if shift >= 64 {
478 return protohelpers.ErrIntOverflow
479 }
480 if iNdEx >= l {
481 return io.ErrUnexpectedEOF
482 }
483 b := dAtA[iNdEx]
484 iNdEx++
485 msglen |= int(b&0x7F) << shift
486 if b < 0x80 {
487 break
488 }
489 }
490 if msglen < 0 {
491 return protohelpers.ErrInvalidLength
492 }
493 postIndex := iNdEx + msglen
494 if postIndex < 0 {
495 return protohelpers.ErrInvalidLength
496 }
497 if postIndex > l {
498 return io.ErrUnexpectedEOF
499 }
500 if m.Identity == nil {
501 m.Identity = &Node{}
502 }
503 if err := m.Identity.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
504 return err
505 }
506 iNdEx = postIndex
507 case 2:
508 if wireType != 0 {
509 return fmt.Errorf("proto: wrong wireType = %d for field CacheState", wireType)
510 }
511 m.CacheState = 0
512 for shift := uint(0); ; shift += 7 {
513 if shift >= 64 {
514 return protohelpers.ErrIntOverflow
515 }
516 if iNdEx >= l {
517 return io.ErrUnexpectedEOF
518 }
519 b := dAtA[iNdEx]
520 iNdEx++
521 m.CacheState |= Connection_State(b&0x7F) << shift
522 if b < 0x80 {
523 break
524 }
525 }
526 case 3:
527 if wireType != 0 {
528 return fmt.Errorf("proto: wrong wireType = %d for field CacheDirection", wireType)
529 }
530 m.CacheDirection = 0
531 for shift := uint(0); ; shift += 7 {
532 if shift >= 64 {
533 return protohelpers.ErrIntOverflow
534 }
535 if iNdEx >= l {
536 return io.ErrUnexpectedEOF
537 }
538 b := dAtA[iNdEx]
539 iNdEx++
540 m.CacheDirection |= Connection_Direction(b&0x7F) << shift
541 if b < 0x80 {
542 break
543 }
544 }
545 case 5:
546 if wireType != 2 {
547 return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
548 }
549 var stringLen uint64
550 for shift := uint(0); ; shift += 7 {
551 if shift >= 64 {
552 return protohelpers.ErrIntOverflow
553 }
554 if iNdEx >= l {
555 return io.ErrUnexpectedEOF
556 }
557 b := dAtA[iNdEx]
558 iNdEx++
559 stringLen |= uint64(b&0x7F) << shift
560 if b < 0x80 {
561 break
562 }
563 }
564 intStringLen := int(stringLen)
565 if intStringLen < 0 {
566 return protohelpers.ErrInvalidLength
567 }
568 postIndex := iNdEx + intStringLen
569 if postIndex < 0 {
570 return protohelpers.ErrInvalidLength
571 }
572 if postIndex > l {
573 return io.ErrUnexpectedEOF
574 }
575 m.Version = string(dAtA[iNdEx:postIndex])
576 iNdEx = postIndex
577 default:
578 iNdEx = preIndex
579 skippy, err := protohelpers.Skip(dAtA[iNdEx:])
580 if err != nil {
581 return err
582 }
583 if (skippy < 0) || (iNdEx+skippy) < 0 {
584 return protohelpers.ErrInvalidLength
585 }
586 if (iNdEx + skippy) > l {
587 return io.ErrUnexpectedEOF
588 }
589 m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
590 iNdEx += skippy
591 }
592 }
593 
594 if iNdEx > l {
595 return io.ErrUnexpectedEOF
596 }
597 return nil
598}