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