1// Autogenerated by Thrift Compiler (0.11.0) 2// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 4package jaeger // import "go.opentelemetry.io/otel/exporters/trace/jaeger/internal/gen-go/jaeger" 5 6import ( 7 "bytes" 8 "context" 9 "database/sql/driver" 10 "errors" 11 "fmt" 12 "reflect" 13 14 "github.com/apache/thrift/lib/go/thrift" 15) 16 17// (needed to ensure safety because of naive import list construction.) 18var _ = thrift.ZERO 19var _ = fmt.Printf 20var _ = context.Background 21var _ = reflect.DeepEqual 22var _ = bytes.Equal 23 24type TagType int64 25 26const ( 27 TagType_STRING TagType = 0 28 TagType_DOUBLE TagType = 1 29 TagType_BOOL TagType = 2 30 TagType_LONG TagType = 3 31 TagType_BINARY TagType = 4 32) 33 34func (p TagType) String() string { 35 switch p { 36 case TagType_STRING: 37 return "STRING" 38 case TagType_DOUBLE: 39 return "DOUBLE" 40 case TagType_BOOL: 41 return "BOOL" 42 case TagType_LONG: 43 return "LONG" 44 case TagType_BINARY: 45 return "BINARY" 46 } 47 return "<UNSET>" 48} 49 50func TagTypeFromString(s string) (TagType, error) { 51 switch s { 52 case "STRING": 53 return TagType_STRING, nil 54 case "DOUBLE": 55 return TagType_DOUBLE, nil 56 case "BOOL": 57 return TagType_BOOL, nil 58 case "LONG": 59 return TagType_LONG, nil 60 case "BINARY": 61 return TagType_BINARY, nil 62 } 63 return TagType(0), fmt.Errorf("not a valid TagType string") 64} 65 66func TagTypePtr(v TagType) *TagType { return &v } 67 68func (p TagType) MarshalText() ([]byte, error) { 69 return []byte(p.String()), nil 70} 71 72func (p *TagType) UnmarshalText(text []byte) error { 73 q, err := TagTypeFromString(string(text)) 74 if err != nil { 75 return err 76 } 77 *p = q 78 return nil 79} 80 81func (p *TagType) Scan(value interface{}) error { 82 v, ok := value.(int64) 83 if !ok { 84 return errors.New("Scan value is not int64") 85 } 86 *p = TagType(v) 87 return nil 88} 89 90func (p *TagType) Value() (driver.Value, error) { 91 if p == nil { 92 return nil, nil 93 } 94 return int64(*p), nil 95} 96 97type SpanRefType int64 98 99const ( 100 SpanRefType_CHILD_OF SpanRefType = 0 101 SpanRefType_FOLLOWS_FROM SpanRefType = 1 102) 103 104func (p SpanRefType) String() string { 105 switch p { 106 case SpanRefType_CHILD_OF: 107 return "CHILD_OF" 108 case SpanRefType_FOLLOWS_FROM: 109 return "FOLLOWS_FROM" 110 } 111 return "<UNSET>" 112} 113 114func SpanRefTypeFromString(s string) (SpanRefType, error) { 115 switch s { 116 case "CHILD_OF": 117 return SpanRefType_CHILD_OF, nil 118 case "FOLLOWS_FROM": 119 return SpanRefType_FOLLOWS_FROM, nil 120 } 121 return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string") 122} 123 124func SpanRefTypePtr(v SpanRefType) *SpanRefType { return &v } 125 126func (p SpanRefType) MarshalText() ([]byte, error) { 127 return []byte(p.String()), nil 128} 129 130func (p *SpanRefType) UnmarshalText(text []byte) error { 131 q, err := SpanRefTypeFromString(string(text)) 132 if err != nil { 133 return err 134 } 135 *p = q 136 return nil 137} 138 139func (p *SpanRefType) Scan(value interface{}) error { 140 v, ok := value.(int64) 141 if !ok { 142 return errors.New("Scan value is not int64") 143 } 144 *p = SpanRefType(v) 145 return nil 146} 147 148func (p *SpanRefType) Value() (driver.Value, error) { 149 if p == nil { 150 return nil, nil 151 } 152 return int64(*p), nil 153} 154 155// Attributes: 156// - Key 157// - VType 158// - VStr 159// - VDouble 160// - VBool 161// - VLong 162// - VBinary 163type Tag struct { 164 Key string `thrift:"key,1,required" db:"key" json:"key"` 165 VType TagType `thrift:"vType,2,required" db:"vType" json:"vType"` 166 VStr *string `thrift:"vStr,3" db:"vStr" json:"vStr,omitempty"` 167 VDouble *float64 `thrift:"vDouble,4" db:"vDouble" json:"vDouble,omitempty"` 168 VBool *bool `thrift:"vBool,5" db:"vBool" json:"vBool,omitempty"` 169 VLong *int64 `thrift:"vLong,6" db:"vLong" json:"vLong,omitempty"` 170 VBinary []byte `thrift:"vBinary,7" db:"vBinary" json:"vBinary,omitempty"` 171} 172 173func NewTag() *Tag { 174 return &Tag{} 175} 176 177func (p *Tag) GetKey() string { 178 return p.Key 179} 180 181func (p *Tag) GetVType() TagType { 182 return p.VType 183} 184 185var Tag_VStr_DEFAULT string 186 187func (p *Tag) GetVStr() string { 188 if !p.IsSetVStr() { 189 return Tag_VStr_DEFAULT 190 } 191 return *p.VStr 192} 193 194var Tag_VDouble_DEFAULT float64 195 196func (p *Tag) GetVDouble() float64 { 197 if !p.IsSetVDouble() { 198 return Tag_VDouble_DEFAULT 199 } 200 return *p.VDouble 201} 202 203var Tag_VBool_DEFAULT bool 204 205func (p *Tag) GetVBool() bool { 206 if !p.IsSetVBool() { 207 return Tag_VBool_DEFAULT 208 } 209 return *p.VBool 210} 211 212var Tag_VLong_DEFAULT int64 213 214func (p *Tag) GetVLong() int64 { 215 if !p.IsSetVLong() { 216 return Tag_VLong_DEFAULT 217 } 218 return *p.VLong 219} 220 221var Tag_VBinary_DEFAULT []byte 222 223func (p *Tag) GetVBinary() []byte { 224 return p.VBinary 225} 226func (p *Tag) IsSetVStr() bool { 227 return p.VStr != nil 228} 229 230func (p *Tag) IsSetVDouble() bool { 231 return p.VDouble != nil 232} 233 234func (p *Tag) IsSetVBool() bool { 235 return p.VBool != nil 236} 237 238func (p *Tag) IsSetVLong() bool { 239 return p.VLong != nil 240} 241 242func (p *Tag) IsSetVBinary() bool { 243 return p.VBinary != nil 244} 245 246func (p *Tag) Read(iprot thrift.TProtocol) error { 247 if _, err := iprot.ReadStructBegin(); err != nil { 248 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 249 } 250 251 var issetKey bool = false 252 var issetVType bool = false 253 254 for { 255 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 256 if err != nil { 257 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 258 } 259 if fieldTypeId == thrift.STOP { 260 break 261 } 262 switch fieldId { 263 case 1: 264 if fieldTypeId == thrift.STRING { 265 if err := p.ReadField1(iprot); err != nil { 266 return err 267 } 268 } else { 269 if err := iprot.Skip(fieldTypeId); err != nil { 270 return err 271 } 272 } 273 issetKey = true 274 case 2: 275 if fieldTypeId == thrift.I32 { 276 if err := p.ReadField2(iprot); err != nil { 277 return err 278 } 279 } else { 280 if err := iprot.Skip(fieldTypeId); err != nil { 281 return err 282 } 283 } 284 issetVType = true 285 case 3: 286 if fieldTypeId == thrift.STRING { 287 if err := p.ReadField3(iprot); err != nil { 288 return err 289 } 290 } else { 291 if err := iprot.Skip(fieldTypeId); err != nil { 292 return err 293 } 294 } 295 case 4: 296 if fieldTypeId == thrift.DOUBLE { 297 if err := p.ReadField4(iprot); err != nil { 298 return err 299 } 300 } else { 301 if err := iprot.Skip(fieldTypeId); err != nil { 302 return err 303 } 304 } 305 case 5: 306 if fieldTypeId == thrift.BOOL { 307 if err := p.ReadField5(iprot); err != nil { 308 return err 309 } 310 } else { 311 if err := iprot.Skip(fieldTypeId); err != nil { 312 return err 313 } 314 } 315 case 6: 316 if fieldTypeId == thrift.I64 { 317 if err := p.ReadField6(iprot); err != nil { 318 return err 319 } 320 } else { 321 if err := iprot.Skip(fieldTypeId); err != nil { 322 return err 323 } 324 } 325 case 7: 326 if fieldTypeId == thrift.STRING { 327 if err := p.ReadField7(iprot); err != nil { 328 return err 329 } 330 } else { 331 if err := iprot.Skip(fieldTypeId); err != nil { 332 return err 333 } 334 } 335 default: 336 if err := iprot.Skip(fieldTypeId); err != nil { 337 return err 338 } 339 } 340 if err := iprot.ReadFieldEnd(); err != nil { 341 return err 342 } 343 } 344 if err := iprot.ReadStructEnd(); err != nil { 345 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 346 } 347 if !issetKey { 348 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set")) 349 } 350 if !issetVType { 351 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set")) 352 } 353 return nil 354} 355 356func (p *Tag) ReadField1(iprot thrift.TProtocol) error { 357 if v, err := iprot.ReadString(); err != nil { 358 return thrift.PrependError("error reading field 1: ", err) 359 } else { 360 p.Key = v 361 } 362 return nil 363} 364 365func (p *Tag) ReadField2(iprot thrift.TProtocol) error { 366 if v, err := iprot.ReadI32(); err != nil { 367 return thrift.PrependError("error reading field 2: ", err) 368 } else { 369 temp := TagType(v) 370 p.VType = temp 371 } 372 return nil 373} 374 375func (p *Tag) ReadField3(iprot thrift.TProtocol) error { 376 if v, err := iprot.ReadString(); err != nil { 377 return thrift.PrependError("error reading field 3: ", err) 378 } else { 379 p.VStr = &v 380 } 381 return nil 382} 383 384func (p *Tag) ReadField4(iprot thrift.TProtocol) error { 385 if v, err := iprot.ReadDouble(); err != nil { 386 return thrift.PrependError("error reading field 4: ", err) 387 } else { 388 p.VDouble = &v 389 } 390 return nil 391} 392 393func (p *Tag) ReadField5(iprot thrift.TProtocol) error { 394 if v, err := iprot.ReadBool(); err != nil { 395 return thrift.PrependError("error reading field 5: ", err) 396 } else { 397 p.VBool = &v 398 } 399 return nil 400} 401 402func (p *Tag) ReadField6(iprot thrift.TProtocol) error { 403 if v, err := iprot.ReadI64(); err != nil { 404 return thrift.PrependError("error reading field 6: ", err) 405 } else { 406 p.VLong = &v 407 } 408 return nil 409} 410 411func (p *Tag) ReadField7(iprot thrift.TProtocol) error { 412 if v, err := iprot.ReadBinary(); err != nil { 413 return thrift.PrependError("error reading field 7: ", err) 414 } else { 415 p.VBinary = v 416 } 417 return nil 418} 419 420func (p *Tag) Write(oprot thrift.TProtocol) error { 421 if err := oprot.WriteStructBegin("Tag"); err != nil { 422 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 423 } 424 if p != nil { 425 if err := p.writeField1(oprot); err != nil { 426 return err 427 } 428 if err := p.writeField2(oprot); err != nil { 429 return err 430 } 431 if err := p.writeField3(oprot); err != nil { 432 return err 433 } 434 if err := p.writeField4(oprot); err != nil { 435 return err 436 } 437 if err := p.writeField5(oprot); err != nil { 438 return err 439 } 440 if err := p.writeField6(oprot); err != nil { 441 return err 442 } 443 if err := p.writeField7(oprot); err != nil { 444 return err 445 } 446 } 447 if err := oprot.WriteFieldStop(); err != nil { 448 return thrift.PrependError("write field stop error: ", err) 449 } 450 if err := oprot.WriteStructEnd(); err != nil { 451 return thrift.PrependError("write struct stop error: ", err) 452 } 453 return nil 454} 455 456func (p *Tag) writeField1(oprot thrift.TProtocol) (err error) { 457 if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { 458 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) 459 } 460 if err := oprot.WriteString(string(p.Key)); err != nil { 461 return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) 462 } 463 if err := oprot.WriteFieldEnd(); err != nil { 464 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) 465 } 466 return err 467} 468 469func (p *Tag) writeField2(oprot thrift.TProtocol) (err error) { 470 if err := oprot.WriteFieldBegin("vType", thrift.I32, 2); err != nil { 471 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) 472 } 473 if err := oprot.WriteI32(int32(p.VType)); err != nil { 474 return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) 475 } 476 if err := oprot.WriteFieldEnd(); err != nil { 477 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) 478 } 479 return err 480} 481 482func (p *Tag) writeField3(oprot thrift.TProtocol) (err error) { 483 if p.IsSetVStr() { 484 if err := oprot.WriteFieldBegin("vStr", thrift.STRING, 3); err != nil { 485 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) 486 } 487 if err := oprot.WriteString(string(*p.VStr)); err != nil { 488 return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) 489 } 490 if err := oprot.WriteFieldEnd(); err != nil { 491 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) 492 } 493 } 494 return err 495} 496 497func (p *Tag) writeField4(oprot thrift.TProtocol) (err error) { 498 if p.IsSetVDouble() { 499 if err := oprot.WriteFieldBegin("vDouble", thrift.DOUBLE, 4); err != nil { 500 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) 501 } 502 if err := oprot.WriteDouble(float64(*p.VDouble)); err != nil { 503 return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) 504 } 505 if err := oprot.WriteFieldEnd(); err != nil { 506 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) 507 } 508 } 509 return err 510} 511 512func (p *Tag) writeField5(oprot thrift.TProtocol) (err error) { 513 if p.IsSetVBool() { 514 if err := oprot.WriteFieldBegin("vBool", thrift.BOOL, 5); err != nil { 515 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) 516 } 517 if err := oprot.WriteBool(bool(*p.VBool)); err != nil { 518 return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) 519 } 520 if err := oprot.WriteFieldEnd(); err != nil { 521 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) 522 } 523 } 524 return err 525} 526 527func (p *Tag) writeField6(oprot thrift.TProtocol) (err error) { 528 if p.IsSetVLong() { 529 if err := oprot.WriteFieldBegin("vLong", thrift.I64, 6); err != nil { 530 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) 531 } 532 if err := oprot.WriteI64(int64(*p.VLong)); err != nil { 533 return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) 534 } 535 if err := oprot.WriteFieldEnd(); err != nil { 536 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) 537 } 538 } 539 return err 540} 541 542func (p *Tag) writeField7(oprot thrift.TProtocol) (err error) { 543 if p.IsSetVBinary() { 544 if err := oprot.WriteFieldBegin("vBinary", thrift.STRING, 7); err != nil { 545 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) 546 } 547 if err := oprot.WriteBinary(p.VBinary); err != nil { 548 return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) 549 } 550 if err := oprot.WriteFieldEnd(); err != nil { 551 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) 552 } 553 } 554 return err 555} 556 557func (p *Tag) String() string { 558 if p == nil { 559 return "<nil>" 560 } 561 return fmt.Sprintf("Tag(%+v)", *p) 562} 563 564// Attributes: 565// - Timestamp 566// - Fields 567type Log struct { 568 Timestamp int64 `thrift:"timestamp,1,required" db:"timestamp" json:"timestamp"` 569 Fields []*Tag `thrift:"fields,2,required" db:"fields" json:"fields"` 570} 571 572func NewLog() *Log { 573 return &Log{} 574} 575 576func (p *Log) GetTimestamp() int64 { 577 return p.Timestamp 578} 579 580func (p *Log) GetFields() []*Tag { 581 return p.Fields 582} 583func (p *Log) Read(iprot thrift.TProtocol) error { 584 if _, err := iprot.ReadStructBegin(); err != nil { 585 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 586 } 587 588 var issetTimestamp bool = false 589 var issetFields bool = false 590 591 for { 592 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 593 if err != nil { 594 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 595 } 596 if fieldTypeId == thrift.STOP { 597 break 598 } 599 switch fieldId { 600 case 1: 601 if fieldTypeId == thrift.I64 { 602 if err := p.ReadField1(iprot); err != nil { 603 return err 604 } 605 } else { 606 if err := iprot.Skip(fieldTypeId); err != nil { 607 return err 608 } 609 } 610 issetTimestamp = true 611 case 2: 612 if fieldTypeId == thrift.LIST { 613 if err := p.ReadField2(iprot); err != nil { 614 return err 615 } 616 } else { 617 if err := iprot.Skip(fieldTypeId); err != nil { 618 return err 619 } 620 } 621 issetFields = true 622 default: 623 if err := iprot.Skip(fieldTypeId); err != nil { 624 return err 625 } 626 } 627 if err := iprot.ReadFieldEnd(); err != nil { 628 return err 629 } 630 } 631 if err := iprot.ReadStructEnd(); err != nil { 632 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 633 } 634 if !issetTimestamp { 635 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")) 636 } 637 if !issetFields { 638 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set")) 639 } 640 return nil 641} 642 643func (p *Log) ReadField1(iprot thrift.TProtocol) error { 644 if v, err := iprot.ReadI64(); err != nil { 645 return thrift.PrependError("error reading field 1: ", err) 646 } else { 647 p.Timestamp = v 648 } 649 return nil 650} 651 652func (p *Log) ReadField2(iprot thrift.TProtocol) error { 653 _, size, err := iprot.ReadListBegin() 654 if err != nil { 655 return thrift.PrependError("error reading list begin: ", err) 656 } 657 tSlice := make([]*Tag, 0, size) 658 p.Fields = tSlice 659 for i := 0; i < size; i++ { 660 _elem0 := &Tag{} 661 if err := _elem0.Read(iprot); err != nil { 662 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) 663 } 664 p.Fields = append(p.Fields, _elem0) 665 } 666 if err := iprot.ReadListEnd(); err != nil { 667 return thrift.PrependError("error reading list end: ", err) 668 } 669 return nil 670} 671 672func (p *Log) Write(oprot thrift.TProtocol) error { 673 if err := oprot.WriteStructBegin("Log"); err != nil { 674 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 675 } 676 if p != nil { 677 if err := p.writeField1(oprot); err != nil { 678 return err 679 } 680 if err := p.writeField2(oprot); err != nil { 681 return err 682 } 683 } 684 if err := oprot.WriteFieldStop(); err != nil { 685 return thrift.PrependError("write field stop error: ", err) 686 } 687 if err := oprot.WriteStructEnd(); err != nil { 688 return thrift.PrependError("write struct stop error: ", err) 689 } 690 return nil 691} 692 693func (p *Log) writeField1(oprot thrift.TProtocol) (err error) { 694 if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { 695 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) 696 } 697 if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { 698 return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) 699 } 700 if err := oprot.WriteFieldEnd(); err != nil { 701 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) 702 } 703 return err 704} 705 706func (p *Log) writeField2(oprot thrift.TProtocol) (err error) { 707 if err := oprot.WriteFieldBegin("fields", thrift.LIST, 2); err != nil { 708 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) 709 } 710 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Fields)); err != nil { 711 return thrift.PrependError("error writing list begin: ", err) 712 } 713 for _, v := range p.Fields { 714 if err := v.Write(oprot); err != nil { 715 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 716 } 717 } 718 if err := oprot.WriteListEnd(); err != nil { 719 return thrift.PrependError("error writing list end: ", err) 720 } 721 if err := oprot.WriteFieldEnd(); err != nil { 722 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) 723 } 724 return err 725} 726 727func (p *Log) String() string { 728 if p == nil { 729 return "<nil>" 730 } 731 return fmt.Sprintf("Log(%+v)", *p) 732} 733 734// Attributes: 735// - RefType 736// - TraceIdLow 737// - TraceIdHigh 738// - SpanId 739type SpanRef struct { 740 RefType SpanRefType `thrift:"refType,1,required" db:"refType" json:"refType"` 741 TraceIdLow int64 `thrift:"traceIdLow,2,required" db:"traceIdLow" json:"traceIdLow"` 742 TraceIdHigh int64 `thrift:"traceIdHigh,3,required" db:"traceIdHigh" json:"traceIdHigh"` 743 SpanId int64 `thrift:"spanId,4,required" db:"spanId" json:"spanId"` 744} 745 746func NewSpanRef() *SpanRef { 747 return &SpanRef{} 748} 749 750func (p *SpanRef) GetRefType() SpanRefType { 751 return p.RefType 752} 753 754func (p *SpanRef) GetTraceIdLow() int64 { 755 return p.TraceIdLow 756} 757 758func (p *SpanRef) GetTraceIdHigh() int64 { 759 return p.TraceIdHigh 760} 761 762func (p *SpanRef) GetSpanId() int64 { 763 return p.SpanId 764} 765func (p *SpanRef) Read(iprot thrift.TProtocol) error { 766 if _, err := iprot.ReadStructBegin(); err != nil { 767 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 768 } 769 770 var issetRefType bool = false 771 var issetTraceIdLow bool = false 772 var issetTraceIdHigh bool = false 773 var issetSpanId bool = false 774 775 for { 776 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 777 if err != nil { 778 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 779 } 780 if fieldTypeId == thrift.STOP { 781 break 782 } 783 switch fieldId { 784 case 1: 785 if fieldTypeId == thrift.I32 { 786 if err := p.ReadField1(iprot); err != nil { 787 return err 788 } 789 } else { 790 if err := iprot.Skip(fieldTypeId); err != nil { 791 return err 792 } 793 } 794 issetRefType = true 795 case 2: 796 if fieldTypeId == thrift.I64 { 797 if err := p.ReadField2(iprot); err != nil { 798 return err 799 } 800 } else { 801 if err := iprot.Skip(fieldTypeId); err != nil { 802 return err 803 } 804 } 805 issetTraceIdLow = true 806 case 3: 807 if fieldTypeId == thrift.I64 { 808 if err := p.ReadField3(iprot); err != nil { 809 return err 810 } 811 } else { 812 if err := iprot.Skip(fieldTypeId); err != nil { 813 return err 814 } 815 } 816 issetTraceIdHigh = true 817 case 4: 818 if fieldTypeId == thrift.I64 { 819 if err := p.ReadField4(iprot); err != nil { 820 return err 821 } 822 } else { 823 if err := iprot.Skip(fieldTypeId); err != nil { 824 return err 825 } 826 } 827 issetSpanId = true 828 default: 829 if err := iprot.Skip(fieldTypeId); err != nil { 830 return err 831 } 832 } 833 if err := iprot.ReadFieldEnd(); err != nil { 834 return err 835 } 836 } 837 if err := iprot.ReadStructEnd(); err != nil { 838 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 839 } 840 if !issetRefType { 841 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set")) 842 } 843 if !issetTraceIdLow { 844 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) 845 } 846 if !issetTraceIdHigh { 847 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) 848 } 849 if !issetSpanId { 850 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) 851 } 852 return nil 853} 854 855func (p *SpanRef) ReadField1(iprot thrift.TProtocol) error { 856 if v, err := iprot.ReadI32(); err != nil { 857 return thrift.PrependError("error reading field 1: ", err) 858 } else { 859 temp := SpanRefType(v) 860 p.RefType = temp 861 } 862 return nil 863} 864 865func (p *SpanRef) ReadField2(iprot thrift.TProtocol) error { 866 if v, err := iprot.ReadI64(); err != nil { 867 return thrift.PrependError("error reading field 2: ", err) 868 } else { 869 p.TraceIdLow = v 870 } 871 return nil 872} 873 874func (p *SpanRef) ReadField3(iprot thrift.TProtocol) error { 875 if v, err := iprot.ReadI64(); err != nil { 876 return thrift.PrependError("error reading field 3: ", err) 877 } else { 878 p.TraceIdHigh = v 879 } 880 return nil 881} 882 883func (p *SpanRef) ReadField4(iprot thrift.TProtocol) error { 884 if v, err := iprot.ReadI64(); err != nil { 885 return thrift.PrependError("error reading field 4: ", err) 886 } else { 887 p.SpanId = v 888 } 889 return nil 890} 891 892func (p *SpanRef) Write(oprot thrift.TProtocol) error { 893 if err := oprot.WriteStructBegin("SpanRef"); err != nil { 894 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 895 } 896 if p != nil { 897 if err := p.writeField1(oprot); err != nil { 898 return err 899 } 900 if err := p.writeField2(oprot); err != nil { 901 return err 902 } 903 if err := p.writeField3(oprot); err != nil { 904 return err 905 } 906 if err := p.writeField4(oprot); err != nil { 907 return err 908 } 909 } 910 if err := oprot.WriteFieldStop(); err != nil { 911 return thrift.PrependError("write field stop error: ", err) 912 } 913 if err := oprot.WriteStructEnd(); err != nil { 914 return thrift.PrependError("write struct stop error: ", err) 915 } 916 return nil 917} 918 919func (p *SpanRef) writeField1(oprot thrift.TProtocol) (err error) { 920 if err := oprot.WriteFieldBegin("refType", thrift.I32, 1); err != nil { 921 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) 922 } 923 if err := oprot.WriteI32(int32(p.RefType)); err != nil { 924 return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) 925 } 926 if err := oprot.WriteFieldEnd(); err != nil { 927 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) 928 } 929 return err 930} 931 932func (p *SpanRef) writeField2(oprot thrift.TProtocol) (err error) { 933 if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 2); err != nil { 934 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) 935 } 936 if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { 937 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) 938 } 939 if err := oprot.WriteFieldEnd(); err != nil { 940 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) 941 } 942 return err 943} 944 945func (p *SpanRef) writeField3(oprot thrift.TProtocol) (err error) { 946 if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 3); err != nil { 947 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) 948 } 949 if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { 950 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) 951 } 952 if err := oprot.WriteFieldEnd(); err != nil { 953 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) 954 } 955 return err 956} 957 958func (p *SpanRef) writeField4(oprot thrift.TProtocol) (err error) { 959 if err := oprot.WriteFieldBegin("spanId", thrift.I64, 4); err != nil { 960 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) 961 } 962 if err := oprot.WriteI64(int64(p.SpanId)); err != nil { 963 return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) 964 } 965 if err := oprot.WriteFieldEnd(); err != nil { 966 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) 967 } 968 return err 969} 970 971func (p *SpanRef) String() string { 972 if p == nil { 973 return "<nil>" 974 } 975 return fmt.Sprintf("SpanRef(%+v)", *p) 976} 977 978// Attributes: 979// - TraceIdLow 980// - TraceIdHigh 981// - SpanId 982// - ParentSpanId 983// - OperationName 984// - References 985// - Flags 986// - StartTime 987// - Duration 988// - Tags 989// - Logs 990type Span struct { 991 TraceIdLow int64 `thrift:"traceIdLow,1,required" db:"traceIdLow" json:"traceIdLow"` 992 TraceIdHigh int64 `thrift:"traceIdHigh,2,required" db:"traceIdHigh" json:"traceIdHigh"` 993 SpanId int64 `thrift:"spanId,3,required" db:"spanId" json:"spanId"` 994 ParentSpanId int64 `thrift:"parentSpanId,4,required" db:"parentSpanId" json:"parentSpanId"` 995 OperationName string `thrift:"operationName,5,required" db:"operationName" json:"operationName"` 996 References []*SpanRef `thrift:"references,6" db:"references" json:"references,omitempty"` 997 Flags int32 `thrift:"flags,7,required" db:"flags" json:"flags"` 998 StartTime int64 `thrift:"startTime,8,required" db:"startTime" json:"startTime"` 999 Duration int64 `thrift:"duration,9,required" db:"duration" json:"duration"` 1000 Tags []*Tag `thrift:"tags,10" db:"tags" json:"tags,omitempty"` 1001 Logs []*Log `thrift:"logs,11" db:"logs" json:"logs,omitempty"` 1002} 1003 1004func NewSpan() *Span { 1005 return &Span{} 1006} 1007 1008func (p *Span) GetTraceIdLow() int64 { 1009 return p.TraceIdLow 1010} 1011 1012func (p *Span) GetTraceIdHigh() int64 { 1013 return p.TraceIdHigh 1014} 1015 1016func (p *Span) GetSpanId() int64 { 1017 return p.SpanId 1018} 1019 1020func (p *Span) GetParentSpanId() int64 { 1021 return p.ParentSpanId 1022} 1023 1024func (p *Span) GetOperationName() string { 1025 return p.OperationName 1026} 1027 1028var Span_References_DEFAULT []*SpanRef 1029 1030func (p *Span) GetReferences() []*SpanRef { 1031 return p.References 1032} 1033 1034func (p *Span) GetFlags() int32 { 1035 return p.Flags 1036} 1037 1038func (p *Span) GetStartTime() int64 { 1039 return p.StartTime 1040} 1041 1042func (p *Span) GetDuration() int64 { 1043 return p.Duration 1044} 1045 1046var Span_Tags_DEFAULT []*Tag 1047 1048func (p *Span) GetTags() []*Tag { 1049 return p.Tags 1050} 1051 1052var Span_Logs_DEFAULT []*Log 1053 1054func (p *Span) GetLogs() []*Log { 1055 return p.Logs 1056} 1057func (p *Span) IsSetReferences() bool { 1058 return p.References != nil 1059} 1060 1061func (p *Span) IsSetTags() bool { 1062 return p.Tags != nil 1063} 1064 1065func (p *Span) IsSetLogs() bool { 1066 return p.Logs != nil 1067} 1068 1069func (p *Span) Read(iprot thrift.TProtocol) error { 1070 if _, err := iprot.ReadStructBegin(); err != nil { 1071 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1072 } 1073 1074 var issetTraceIdLow bool = false 1075 var issetTraceIdHigh bool = false 1076 var issetSpanId bool = false 1077 var issetParentSpanId bool = false 1078 var issetOperationName bool = false 1079 var issetFlags bool = false 1080 var issetStartTime bool = false 1081 var issetDuration bool = false 1082 1083 for { 1084 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1085 if err != nil { 1086 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1087 } 1088 if fieldTypeId == thrift.STOP { 1089 break 1090 } 1091 switch fieldId { 1092 case 1: 1093 if fieldTypeId == thrift.I64 { 1094 if err := p.ReadField1(iprot); err != nil { 1095 return err 1096 } 1097 } else { 1098 if err := iprot.Skip(fieldTypeId); err != nil { 1099 return err 1100 } 1101 } 1102 issetTraceIdLow = true 1103 case 2: 1104 if fieldTypeId == thrift.I64 { 1105 if err := p.ReadField2(iprot); err != nil { 1106 return err 1107 } 1108 } else { 1109 if err := iprot.Skip(fieldTypeId); err != nil { 1110 return err 1111 } 1112 } 1113 issetTraceIdHigh = true 1114 case 3: 1115 if fieldTypeId == thrift.I64 { 1116 if err := p.ReadField3(iprot); err != nil { 1117 return err 1118 } 1119 } else { 1120 if err := iprot.Skip(fieldTypeId); err != nil { 1121 return err 1122 } 1123 } 1124 issetSpanId = true 1125 case 4: 1126 if fieldTypeId == thrift.I64 { 1127 if err := p.ReadField4(iprot); err != nil { 1128 return err 1129 } 1130 } else { 1131 if err := iprot.Skip(fieldTypeId); err != nil { 1132 return err 1133 } 1134 } 1135 issetParentSpanId = true 1136 case 5: 1137 if fieldTypeId == thrift.STRING { 1138 if err := p.ReadField5(iprot); err != nil { 1139 return err 1140 } 1141 } else { 1142 if err := iprot.Skip(fieldTypeId); err != nil { 1143 return err 1144 } 1145 } 1146 issetOperationName = true 1147 case 6: 1148 if fieldTypeId == thrift.LIST { 1149 if err := p.ReadField6(iprot); err != nil { 1150 return err 1151 } 1152 } else { 1153 if err := iprot.Skip(fieldTypeId); err != nil { 1154 return err 1155 } 1156 } 1157 case 7: 1158 if fieldTypeId == thrift.I32 { 1159 if err := p.ReadField7(iprot); err != nil { 1160 return err 1161 } 1162 } else { 1163 if err := iprot.Skip(fieldTypeId); err != nil { 1164 return err 1165 } 1166 } 1167 issetFlags = true 1168 case 8: 1169 if fieldTypeId == thrift.I64 { 1170 if err := p.ReadField8(iprot); err != nil { 1171 return err 1172 } 1173 } else { 1174 if err := iprot.Skip(fieldTypeId); err != nil { 1175 return err 1176 } 1177 } 1178 issetStartTime = true 1179 case 9: 1180 if fieldTypeId == thrift.I64 { 1181 if err := p.ReadField9(iprot); err != nil { 1182 return err 1183 } 1184 } else { 1185 if err := iprot.Skip(fieldTypeId); err != nil { 1186 return err 1187 } 1188 } 1189 issetDuration = true 1190 case 10: 1191 if fieldTypeId == thrift.LIST { 1192 if err := p.ReadField10(iprot); err != nil { 1193 return err 1194 } 1195 } else { 1196 if err := iprot.Skip(fieldTypeId); err != nil { 1197 return err 1198 } 1199 } 1200 case 11: 1201 if fieldTypeId == thrift.LIST { 1202 if err := p.ReadField11(iprot); err != nil { 1203 return err 1204 } 1205 } else { 1206 if err := iprot.Skip(fieldTypeId); err != nil { 1207 return err 1208 } 1209 } 1210 default: 1211 if err := iprot.Skip(fieldTypeId); err != nil { 1212 return err 1213 } 1214 } 1215 if err := iprot.ReadFieldEnd(); err != nil { 1216 return err 1217 } 1218 } 1219 if err := iprot.ReadStructEnd(); err != nil { 1220 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1221 } 1222 if !issetTraceIdLow { 1223 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) 1224 } 1225 if !issetTraceIdHigh { 1226 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) 1227 } 1228 if !issetSpanId { 1229 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) 1230 } 1231 if !issetParentSpanId { 1232 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set")) 1233 } 1234 if !issetOperationName { 1235 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set")) 1236 } 1237 if !issetFlags { 1238 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set")) 1239 } 1240 if !issetStartTime { 1241 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")) 1242 } 1243 if !issetDuration { 1244 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set")) 1245 } 1246 return nil 1247} 1248 1249func (p *Span) ReadField1(iprot thrift.TProtocol) error { 1250 if v, err := iprot.ReadI64(); err != nil { 1251 return thrift.PrependError("error reading field 1: ", err) 1252 } else { 1253 p.TraceIdLow = v 1254 } 1255 return nil 1256} 1257 1258func (p *Span) ReadField2(iprot thrift.TProtocol) error { 1259 if v, err := iprot.ReadI64(); err != nil { 1260 return thrift.PrependError("error reading field 2: ", err) 1261 } else { 1262 p.TraceIdHigh = v 1263 } 1264 return nil 1265} 1266 1267func (p *Span) ReadField3(iprot thrift.TProtocol) error { 1268 if v, err := iprot.ReadI64(); err != nil { 1269 return thrift.PrependError("error reading field 3: ", err) 1270 } else { 1271 p.SpanId = v 1272 } 1273 return nil 1274} 1275 1276func (p *Span) ReadField4(iprot thrift.TProtocol) error { 1277 if v, err := iprot.ReadI64(); err != nil { 1278 return thrift.PrependError("error reading field 4: ", err) 1279 } else { 1280 p.ParentSpanId = v 1281 } 1282 return nil 1283} 1284 1285func (p *Span) ReadField5(iprot thrift.TProtocol) error { 1286 if v, err := iprot.ReadString(); err != nil { 1287 return thrift.PrependError("error reading field 5: ", err) 1288 } else { 1289 p.OperationName = v 1290 } 1291 return nil 1292} 1293 1294func (p *Span) ReadField6(iprot thrift.TProtocol) error { 1295 _, size, err := iprot.ReadListBegin() 1296 if err != nil { 1297 return thrift.PrependError("error reading list begin: ", err) 1298 } 1299 tSlice := make([]*SpanRef, 0, size) 1300 p.References = tSlice 1301 for i := 0; i < size; i++ { 1302 _elem1 := &SpanRef{} 1303 if err := _elem1.Read(iprot); err != nil { 1304 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) 1305 } 1306 p.References = append(p.References, _elem1) 1307 } 1308 if err := iprot.ReadListEnd(); err != nil { 1309 return thrift.PrependError("error reading list end: ", err) 1310 } 1311 return nil 1312} 1313 1314func (p *Span) ReadField7(iprot thrift.TProtocol) error { 1315 if v, err := iprot.ReadI32(); err != nil { 1316 return thrift.PrependError("error reading field 7: ", err) 1317 } else { 1318 p.Flags = v 1319 } 1320 return nil 1321} 1322 1323func (p *Span) ReadField8(iprot thrift.TProtocol) error { 1324 if v, err := iprot.ReadI64(); err != nil { 1325 return thrift.PrependError("error reading field 8: ", err) 1326 } else { 1327 p.StartTime = v 1328 } 1329 return nil 1330} 1331 1332func (p *Span) ReadField9(iprot thrift.TProtocol) error { 1333 if v, err := iprot.ReadI64(); err != nil { 1334 return thrift.PrependError("error reading field 9: ", err) 1335 } else { 1336 p.Duration = v 1337 } 1338 return nil 1339} 1340 1341func (p *Span) ReadField10(iprot thrift.TProtocol) error { 1342 _, size, err := iprot.ReadListBegin() 1343 if err != nil { 1344 return thrift.PrependError("error reading list begin: ", err) 1345 } 1346 tSlice := make([]*Tag, 0, size) 1347 p.Tags = tSlice 1348 for i := 0; i < size; i++ { 1349 _elem2 := &Tag{} 1350 if err := _elem2.Read(iprot); err != nil { 1351 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) 1352 } 1353 p.Tags = append(p.Tags, _elem2) 1354 } 1355 if err := iprot.ReadListEnd(); err != nil { 1356 return thrift.PrependError("error reading list end: ", err) 1357 } 1358 return nil 1359} 1360 1361func (p *Span) ReadField11(iprot thrift.TProtocol) error { 1362 _, size, err := iprot.ReadListBegin() 1363 if err != nil { 1364 return thrift.PrependError("error reading list begin: ", err) 1365 } 1366 tSlice := make([]*Log, 0, size) 1367 p.Logs = tSlice 1368 for i := 0; i < size; i++ { 1369 _elem3 := &Log{} 1370 if err := _elem3.Read(iprot); err != nil { 1371 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) 1372 } 1373 p.Logs = append(p.Logs, _elem3) 1374 } 1375 if err := iprot.ReadListEnd(); err != nil { 1376 return thrift.PrependError("error reading list end: ", err) 1377 } 1378 return nil 1379} 1380 1381func (p *Span) Write(oprot thrift.TProtocol) error { 1382 if err := oprot.WriteStructBegin("Span"); err != nil { 1383 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1384 } 1385 if p != nil { 1386 if err := p.writeField1(oprot); err != nil { 1387 return err 1388 } 1389 if err := p.writeField2(oprot); err != nil { 1390 return err 1391 } 1392 if err := p.writeField3(oprot); err != nil { 1393 return err 1394 } 1395 if err := p.writeField4(oprot); err != nil { 1396 return err 1397 } 1398 if err := p.writeField5(oprot); err != nil { 1399 return err 1400 } 1401 if err := p.writeField6(oprot); err != nil { 1402 return err 1403 } 1404 if err := p.writeField7(oprot); err != nil { 1405 return err 1406 } 1407 if err := p.writeField8(oprot); err != nil { 1408 return err 1409 } 1410 if err := p.writeField9(oprot); err != nil { 1411 return err 1412 } 1413 if err := p.writeField10(oprot); err != nil { 1414 return err 1415 } 1416 if err := p.writeField11(oprot); err != nil { 1417 return err 1418 } 1419 } 1420 if err := oprot.WriteFieldStop(); err != nil { 1421 return thrift.PrependError("write field stop error: ", err) 1422 } 1423 if err := oprot.WriteStructEnd(); err != nil { 1424 return thrift.PrependError("write struct stop error: ", err) 1425 } 1426 return nil 1427} 1428 1429func (p *Span) writeField1(oprot thrift.TProtocol) (err error) { 1430 if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 1); err != nil { 1431 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) 1432 } 1433 if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { 1434 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) 1435 } 1436 if err := oprot.WriteFieldEnd(); err != nil { 1437 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) 1438 } 1439 return err 1440} 1441 1442func (p *Span) writeField2(oprot thrift.TProtocol) (err error) { 1443 if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 2); err != nil { 1444 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) 1445 } 1446 if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { 1447 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) 1448 } 1449 if err := oprot.WriteFieldEnd(); err != nil { 1450 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) 1451 } 1452 return err 1453} 1454 1455func (p *Span) writeField3(oprot thrift.TProtocol) (err error) { 1456 if err := oprot.WriteFieldBegin("spanId", thrift.I64, 3); err != nil { 1457 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) 1458 } 1459 if err := oprot.WriteI64(int64(p.SpanId)); err != nil { 1460 return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) 1461 } 1462 if err := oprot.WriteFieldEnd(); err != nil { 1463 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) 1464 } 1465 return err 1466} 1467 1468func (p *Span) writeField4(oprot thrift.TProtocol) (err error) { 1469 if err := oprot.WriteFieldBegin("parentSpanId", thrift.I64, 4); err != nil { 1470 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) 1471 } 1472 if err := oprot.WriteI64(int64(p.ParentSpanId)); err != nil { 1473 return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) 1474 } 1475 if err := oprot.WriteFieldEnd(); err != nil { 1476 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) 1477 } 1478 return err 1479} 1480 1481func (p *Span) writeField5(oprot thrift.TProtocol) (err error) { 1482 if err := oprot.WriteFieldBegin("operationName", thrift.STRING, 5); err != nil { 1483 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) 1484 } 1485 if err := oprot.WriteString(string(p.OperationName)); err != nil { 1486 return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) 1487 } 1488 if err := oprot.WriteFieldEnd(); err != nil { 1489 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) 1490 } 1491 return err 1492} 1493 1494func (p *Span) writeField6(oprot thrift.TProtocol) (err error) { 1495 if p.IsSetReferences() { 1496 if err := oprot.WriteFieldBegin("references", thrift.LIST, 6); err != nil { 1497 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) 1498 } 1499 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.References)); err != nil { 1500 return thrift.PrependError("error writing list begin: ", err) 1501 } 1502 for _, v := range p.References { 1503 if err := v.Write(oprot); err != nil { 1504 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1505 } 1506 } 1507 if err := oprot.WriteListEnd(); err != nil { 1508 return thrift.PrependError("error writing list end: ", err) 1509 } 1510 if err := oprot.WriteFieldEnd(); err != nil { 1511 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) 1512 } 1513 } 1514 return err 1515} 1516 1517func (p *Span) writeField7(oprot thrift.TProtocol) (err error) { 1518 if err := oprot.WriteFieldBegin("flags", thrift.I32, 7); err != nil { 1519 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) 1520 } 1521 if err := oprot.WriteI32(int32(p.Flags)); err != nil { 1522 return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) 1523 } 1524 if err := oprot.WriteFieldEnd(); err != nil { 1525 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) 1526 } 1527 return err 1528} 1529 1530func (p *Span) writeField8(oprot thrift.TProtocol) (err error) { 1531 if err := oprot.WriteFieldBegin("startTime", thrift.I64, 8); err != nil { 1532 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) 1533 } 1534 if err := oprot.WriteI64(int64(p.StartTime)); err != nil { 1535 return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) 1536 } 1537 if err := oprot.WriteFieldEnd(); err != nil { 1538 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) 1539 } 1540 return err 1541} 1542 1543func (p *Span) writeField9(oprot thrift.TProtocol) (err error) { 1544 if err := oprot.WriteFieldBegin("duration", thrift.I64, 9); err != nil { 1545 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) 1546 } 1547 if err := oprot.WriteI64(int64(p.Duration)); err != nil { 1548 return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) 1549 } 1550 if err := oprot.WriteFieldEnd(); err != nil { 1551 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) 1552 } 1553 return err 1554} 1555 1556func (p *Span) writeField10(oprot thrift.TProtocol) (err error) { 1557 if p.IsSetTags() { 1558 if err := oprot.WriteFieldBegin("tags", thrift.LIST, 10); err != nil { 1559 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) 1560 } 1561 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { 1562 return thrift.PrependError("error writing list begin: ", err) 1563 } 1564 for _, v := range p.Tags { 1565 if err := v.Write(oprot); err != nil { 1566 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1567 } 1568 } 1569 if err := oprot.WriteListEnd(); err != nil { 1570 return thrift.PrependError("error writing list end: ", err) 1571 } 1572 if err := oprot.WriteFieldEnd(); err != nil { 1573 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) 1574 } 1575 } 1576 return err 1577} 1578 1579func (p *Span) writeField11(oprot thrift.TProtocol) (err error) { 1580 if p.IsSetLogs() { 1581 if err := oprot.WriteFieldBegin("logs", thrift.LIST, 11); err != nil { 1582 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) 1583 } 1584 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Logs)); err != nil { 1585 return thrift.PrependError("error writing list begin: ", err) 1586 } 1587 for _, v := range p.Logs { 1588 if err := v.Write(oprot); err != nil { 1589 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1590 } 1591 } 1592 if err := oprot.WriteListEnd(); err != nil { 1593 return thrift.PrependError("error writing list end: ", err) 1594 } 1595 if err := oprot.WriteFieldEnd(); err != nil { 1596 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) 1597 } 1598 } 1599 return err 1600} 1601 1602func (p *Span) String() string { 1603 if p == nil { 1604 return "<nil>" 1605 } 1606 return fmt.Sprintf("Span(%+v)", *p) 1607} 1608 1609// Attributes: 1610// - ServiceName 1611// - Tags 1612type Process struct { 1613 ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"` 1614 Tags []*Tag `thrift:"tags,2" db:"tags" json:"tags,omitempty"` 1615} 1616 1617func NewProcess() *Process { 1618 return &Process{} 1619} 1620 1621func (p *Process) GetServiceName() string { 1622 return p.ServiceName 1623} 1624 1625var Process_Tags_DEFAULT []*Tag 1626 1627func (p *Process) GetTags() []*Tag { 1628 return p.Tags 1629} 1630func (p *Process) IsSetTags() bool { 1631 return p.Tags != nil 1632} 1633 1634func (p *Process) Read(iprot thrift.TProtocol) error { 1635 if _, err := iprot.ReadStructBegin(); err != nil { 1636 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1637 } 1638 1639 var issetServiceName bool = false 1640 1641 for { 1642 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1643 if err != nil { 1644 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1645 } 1646 if fieldTypeId == thrift.STOP { 1647 break 1648 } 1649 switch fieldId { 1650 case 1: 1651 if fieldTypeId == thrift.STRING { 1652 if err := p.ReadField1(iprot); err != nil { 1653 return err 1654 } 1655 } else { 1656 if err := iprot.Skip(fieldTypeId); err != nil { 1657 return err 1658 } 1659 } 1660 issetServiceName = true 1661 case 2: 1662 if fieldTypeId == thrift.LIST { 1663 if err := p.ReadField2(iprot); err != nil { 1664 return err 1665 } 1666 } else { 1667 if err := iprot.Skip(fieldTypeId); err != nil { 1668 return err 1669 } 1670 } 1671 default: 1672 if err := iprot.Skip(fieldTypeId); err != nil { 1673 return err 1674 } 1675 } 1676 if err := iprot.ReadFieldEnd(); err != nil { 1677 return err 1678 } 1679 } 1680 if err := iprot.ReadStructEnd(); err != nil { 1681 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1682 } 1683 if !issetServiceName { 1684 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set")) 1685 } 1686 return nil 1687} 1688 1689func (p *Process) ReadField1(iprot thrift.TProtocol) error { 1690 if v, err := iprot.ReadString(); err != nil { 1691 return thrift.PrependError("error reading field 1: ", err) 1692 } else { 1693 p.ServiceName = v 1694 } 1695 return nil 1696} 1697 1698func (p *Process) ReadField2(iprot thrift.TProtocol) error { 1699 _, size, err := iprot.ReadListBegin() 1700 if err != nil { 1701 return thrift.PrependError("error reading list begin: ", err) 1702 } 1703 tSlice := make([]*Tag, 0, size) 1704 p.Tags = tSlice 1705 for i := 0; i < size; i++ { 1706 _elem4 := &Tag{} 1707 if err := _elem4.Read(iprot); err != nil { 1708 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) 1709 } 1710 p.Tags = append(p.Tags, _elem4) 1711 } 1712 if err := iprot.ReadListEnd(); err != nil { 1713 return thrift.PrependError("error reading list end: ", err) 1714 } 1715 return nil 1716} 1717 1718func (p *Process) Write(oprot thrift.TProtocol) error { 1719 if err := oprot.WriteStructBegin("Process"); err != nil { 1720 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1721 } 1722 if p != nil { 1723 if err := p.writeField1(oprot); err != nil { 1724 return err 1725 } 1726 if err := p.writeField2(oprot); err != nil { 1727 return err 1728 } 1729 } 1730 if err := oprot.WriteFieldStop(); err != nil { 1731 return thrift.PrependError("write field stop error: ", err) 1732 } 1733 if err := oprot.WriteStructEnd(); err != nil { 1734 return thrift.PrependError("write struct stop error: ", err) 1735 } 1736 return nil 1737} 1738 1739func (p *Process) writeField1(oprot thrift.TProtocol) (err error) { 1740 if err := oprot.WriteFieldBegin("serviceName", thrift.STRING, 1); err != nil { 1741 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) 1742 } 1743 if err := oprot.WriteString(string(p.ServiceName)); err != nil { 1744 return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) 1745 } 1746 if err := oprot.WriteFieldEnd(); err != nil { 1747 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) 1748 } 1749 return err 1750} 1751 1752func (p *Process) writeField2(oprot thrift.TProtocol) (err error) { 1753 if p.IsSetTags() { 1754 if err := oprot.WriteFieldBegin("tags", thrift.LIST, 2); err != nil { 1755 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) 1756 } 1757 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { 1758 return thrift.PrependError("error writing list begin: ", err) 1759 } 1760 for _, v := range p.Tags { 1761 if err := v.Write(oprot); err != nil { 1762 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1763 } 1764 } 1765 if err := oprot.WriteListEnd(); err != nil { 1766 return thrift.PrependError("error writing list end: ", err) 1767 } 1768 if err := oprot.WriteFieldEnd(); err != nil { 1769 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) 1770 } 1771 } 1772 return err 1773} 1774 1775func (p *Process) String() string { 1776 if p == nil { 1777 return "<nil>" 1778 } 1779 return fmt.Sprintf("Process(%+v)", *p) 1780} 1781 1782// Attributes: 1783// - Process 1784// - Spans 1785type Batch struct { 1786 Process *Process `thrift:"process,1,required" db:"process" json:"process"` 1787 Spans []*Span `thrift:"spans,2,required" db:"spans" json:"spans"` 1788} 1789 1790func NewBatch() *Batch { 1791 return &Batch{} 1792} 1793 1794var Batch_Process_DEFAULT *Process 1795 1796func (p *Batch) GetProcess() *Process { 1797 if !p.IsSetProcess() { 1798 return Batch_Process_DEFAULT 1799 } 1800 return p.Process 1801} 1802 1803func (p *Batch) GetSpans() []*Span { 1804 return p.Spans 1805} 1806func (p *Batch) IsSetProcess() bool { 1807 return p.Process != nil 1808} 1809 1810func (p *Batch) Read(iprot thrift.TProtocol) error { 1811 if _, err := iprot.ReadStructBegin(); err != nil { 1812 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1813 } 1814 1815 var issetProcess bool = false 1816 var issetSpans bool = false 1817 1818 for { 1819 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1820 if err != nil { 1821 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1822 } 1823 if fieldTypeId == thrift.STOP { 1824 break 1825 } 1826 switch fieldId { 1827 case 1: 1828 if fieldTypeId == thrift.STRUCT { 1829 if err := p.ReadField1(iprot); err != nil { 1830 return err 1831 } 1832 } else { 1833 if err := iprot.Skip(fieldTypeId); err != nil { 1834 return err 1835 } 1836 } 1837 issetProcess = true 1838 case 2: 1839 if fieldTypeId == thrift.LIST { 1840 if err := p.ReadField2(iprot); err != nil { 1841 return err 1842 } 1843 } else { 1844 if err := iprot.Skip(fieldTypeId); err != nil { 1845 return err 1846 } 1847 } 1848 issetSpans = true 1849 default: 1850 if err := iprot.Skip(fieldTypeId); err != nil { 1851 return err 1852 } 1853 } 1854 if err := iprot.ReadFieldEnd(); err != nil { 1855 return err 1856 } 1857 } 1858 if err := iprot.ReadStructEnd(); err != nil { 1859 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1860 } 1861 if !issetProcess { 1862 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set")) 1863 } 1864 if !issetSpans { 1865 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set")) 1866 } 1867 return nil 1868} 1869 1870func (p *Batch) ReadField1(iprot thrift.TProtocol) error { 1871 p.Process = &Process{} 1872 if err := p.Process.Read(iprot); err != nil { 1873 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err) 1874 } 1875 return nil 1876} 1877 1878func (p *Batch) ReadField2(iprot thrift.TProtocol) error { 1879 _, size, err := iprot.ReadListBegin() 1880 if err != nil { 1881 return thrift.PrependError("error reading list begin: ", err) 1882 } 1883 tSlice := make([]*Span, 0, size) 1884 p.Spans = tSlice 1885 for i := 0; i < size; i++ { 1886 _elem5 := &Span{} 1887 if err := _elem5.Read(iprot); err != nil { 1888 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) 1889 } 1890 p.Spans = append(p.Spans, _elem5) 1891 } 1892 if err := iprot.ReadListEnd(); err != nil { 1893 return thrift.PrependError("error reading list end: ", err) 1894 } 1895 return nil 1896} 1897 1898func (p *Batch) Write(oprot thrift.TProtocol) error { 1899 if err := oprot.WriteStructBegin("Batch"); err != nil { 1900 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1901 } 1902 if p != nil { 1903 if err := p.writeField1(oprot); err != nil { 1904 return err 1905 } 1906 if err := p.writeField2(oprot); err != nil { 1907 return err 1908 } 1909 } 1910 if err := oprot.WriteFieldStop(); err != nil { 1911 return thrift.PrependError("write field stop error: ", err) 1912 } 1913 if err := oprot.WriteStructEnd(); err != nil { 1914 return thrift.PrependError("write struct stop error: ", err) 1915 } 1916 return nil 1917} 1918 1919func (p *Batch) writeField1(oprot thrift.TProtocol) (err error) { 1920 if err := oprot.WriteFieldBegin("process", thrift.STRUCT, 1); err != nil { 1921 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) 1922 } 1923 if err := p.Process.Write(oprot); err != nil { 1924 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err) 1925 } 1926 if err := oprot.WriteFieldEnd(); err != nil { 1927 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) 1928 } 1929 return err 1930} 1931 1932func (p *Batch) writeField2(oprot thrift.TProtocol) (err error) { 1933 if err := oprot.WriteFieldBegin("spans", thrift.LIST, 2); err != nil { 1934 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) 1935 } 1936 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { 1937 return thrift.PrependError("error writing list begin: ", err) 1938 } 1939 for _, v := range p.Spans { 1940 if err := v.Write(oprot); err != nil { 1941 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1942 } 1943 } 1944 if err := oprot.WriteListEnd(); err != nil { 1945 return thrift.PrependError("error writing list end: ", err) 1946 } 1947 if err := oprot.WriteFieldEnd(); err != nil { 1948 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) 1949 } 1950 return err 1951} 1952 1953func (p *Batch) String() string { 1954 if p == nil { 1955 return "<nil>" 1956 } 1957 return fmt.Sprintf("Batch(%+v)", *p) 1958} 1959 1960// Attributes: 1961// - Ok 1962type BatchSubmitResponse struct { 1963 Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"` 1964} 1965 1966func NewBatchSubmitResponse() *BatchSubmitResponse { 1967 return &BatchSubmitResponse{} 1968} 1969 1970func (p *BatchSubmitResponse) GetOk() bool { 1971 return p.Ok 1972} 1973func (p *BatchSubmitResponse) Read(iprot thrift.TProtocol) error { 1974 if _, err := iprot.ReadStructBegin(); err != nil { 1975 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1976 } 1977 1978 var issetOk bool = false 1979 1980 for { 1981 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1982 if err != nil { 1983 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1984 } 1985 if fieldTypeId == thrift.STOP { 1986 break 1987 } 1988 switch fieldId { 1989 case 1: 1990 if fieldTypeId == thrift.BOOL { 1991 if err := p.ReadField1(iprot); err != nil { 1992 return err 1993 } 1994 } else { 1995 if err := iprot.Skip(fieldTypeId); err != nil { 1996 return err 1997 } 1998 } 1999 issetOk = true 2000 default: 2001 if err := iprot.Skip(fieldTypeId); err != nil { 2002 return err 2003 } 2004 } 2005 if err := iprot.ReadFieldEnd(); err != nil { 2006 return err 2007 } 2008 } 2009 if err := iprot.ReadStructEnd(); err != nil { 2010 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2011 } 2012 if !issetOk { 2013 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set")) 2014 } 2015 return nil 2016} 2017 2018func (p *BatchSubmitResponse) ReadField1(iprot thrift.TProtocol) error { 2019 if v, err := iprot.ReadBool(); err != nil { 2020 return thrift.PrependError("error reading field 1: ", err) 2021 } else { 2022 p.Ok = v 2023 } 2024 return nil 2025} 2026 2027func (p *BatchSubmitResponse) Write(oprot thrift.TProtocol) error { 2028 if err := oprot.WriteStructBegin("BatchSubmitResponse"); err != nil { 2029 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2030 } 2031 if p != nil { 2032 if err := p.writeField1(oprot); err != nil { 2033 return err 2034 } 2035 } 2036 if err := oprot.WriteFieldStop(); err != nil { 2037 return thrift.PrependError("write field stop error: ", err) 2038 } 2039 if err := oprot.WriteStructEnd(); err != nil { 2040 return thrift.PrependError("write struct stop error: ", err) 2041 } 2042 return nil 2043} 2044 2045func (p *BatchSubmitResponse) writeField1(oprot thrift.TProtocol) (err error) { 2046 if err := oprot.WriteFieldBegin("ok", thrift.BOOL, 1); err != nil { 2047 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) 2048 } 2049 if err := oprot.WriteBool(bool(p.Ok)); err != nil { 2050 return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) 2051 } 2052 if err := oprot.WriteFieldEnd(); err != nil { 2053 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) 2054 } 2055 return err 2056} 2057 2058func (p *BatchSubmitResponse) String() string { 2059 if p == nil { 2060 return "<nil>" 2061 } 2062 return fmt.Sprintf("BatchSubmitResponse(%+v)", *p) 2063} 2064 2065type Collector interface { 2066 // Parameters: 2067 // - Batches 2068 SubmitBatches(ctx context.Context, batches []*Batch) (r []*BatchSubmitResponse, err error) 2069} 2070 2071type CollectorClient struct { 2072 c thrift.TClient 2073} 2074 2075// Deprecated: Use NewCollector instead 2076func NewCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CollectorClient { 2077 return &CollectorClient{ 2078 c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), 2079 } 2080} 2081 2082// Deprecated: Use NewCollector instead 2083func NewCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CollectorClient { 2084 return &CollectorClient{ 2085 c: thrift.NewTStandardClient(iprot, oprot), 2086 } 2087} 2088 2089func NewCollectorClient(c thrift.TClient) *CollectorClient { 2090 return &CollectorClient{ 2091 c: c, 2092 } 2093} 2094 2095// Parameters: 2096// - Batches 2097func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (r []*BatchSubmitResponse, err error) { 2098 var _args6 CollectorSubmitBatchesArgs 2099 _args6.Batches = batches 2100 var _result7 CollectorSubmitBatchesResult 2101 if err = p.c.Call(ctx, "submitBatches", &_args6, &_result7); err != nil { 2102 return 2103 } 2104 return _result7.GetSuccess(), nil 2105} 2106 2107type CollectorProcessor struct { 2108 processorMap map[string]thrift.TProcessorFunction 2109 handler Collector 2110} 2111 2112func (p *CollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { 2113 p.processorMap[key] = processor 2114} 2115 2116func (p *CollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { 2117 processor, ok = p.processorMap[key] 2118 return processor, ok 2119} 2120 2121func (p *CollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { 2122 return p.processorMap 2123} 2124 2125func NewCollectorProcessor(handler Collector) *CollectorProcessor { 2126 2127 self8 := &CollectorProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} 2128 self8.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler: handler} 2129 return self8 2130} 2131 2132func (p *CollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 2133 name, _, seqId, err := iprot.ReadMessageBegin() 2134 if err != nil { 2135 return false, err 2136 } 2137 if processor, ok := p.GetProcessorFunction(name); ok { 2138 return processor.Process(ctx, seqId, iprot, oprot) 2139 } 2140 iprot.Skip(thrift.STRUCT) 2141 iprot.ReadMessageEnd() 2142 x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) 2143 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) 2144 x9.Write(oprot) 2145 oprot.WriteMessageEnd() 2146 oprot.Flush(ctx) 2147 return false, x9 2148 2149} 2150 2151type collectorProcessorSubmitBatches struct { 2152 handler Collector 2153} 2154 2155func (p *collectorProcessorSubmitBatches) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 2156 args := CollectorSubmitBatchesArgs{} 2157 if err = args.Read(iprot); err != nil { 2158 iprot.ReadMessageEnd() 2159 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 2160 oprot.WriteMessageBegin("submitBatches", thrift.EXCEPTION, seqId) 2161 x.Write(oprot) 2162 oprot.WriteMessageEnd() 2163 oprot.Flush(ctx) 2164 return false, err 2165 } 2166 2167 iprot.ReadMessageEnd() 2168 result := CollectorSubmitBatchesResult{} 2169 var retval []*BatchSubmitResponse 2170 var err2 error 2171 if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil { 2172 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: "+err2.Error()) 2173 oprot.WriteMessageBegin("submitBatches", thrift.EXCEPTION, seqId) 2174 x.Write(oprot) 2175 oprot.WriteMessageEnd() 2176 oprot.Flush(ctx) 2177 return true, err2 2178 } else { 2179 result.Success = retval 2180 } 2181 if err2 = oprot.WriteMessageBegin("submitBatches", thrift.REPLY, seqId); err2 != nil { 2182 err = err2 2183 } 2184 if err2 = result.Write(oprot); err == nil && err2 != nil { 2185 err = err2 2186 } 2187 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 2188 err = err2 2189 } 2190 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 2191 err = err2 2192 } 2193 if err != nil { 2194 return 2195 } 2196 return true, err 2197} 2198 2199// HELPER FUNCTIONS AND STRUCTURES 2200 2201// Attributes: 2202// - Batches 2203type CollectorSubmitBatchesArgs struct { 2204 Batches []*Batch `thrift:"batches,1" db:"batches" json:"batches"` 2205} 2206 2207func NewCollectorSubmitBatchesArgs() *CollectorSubmitBatchesArgs { 2208 return &CollectorSubmitBatchesArgs{} 2209} 2210 2211func (p *CollectorSubmitBatchesArgs) GetBatches() []*Batch { 2212 return p.Batches 2213} 2214func (p *CollectorSubmitBatchesArgs) Read(iprot thrift.TProtocol) error { 2215 if _, err := iprot.ReadStructBegin(); err != nil { 2216 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2217 } 2218 2219 for { 2220 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 2221 if err != nil { 2222 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2223 } 2224 if fieldTypeId == thrift.STOP { 2225 break 2226 } 2227 switch fieldId { 2228 case 1: 2229 if fieldTypeId == thrift.LIST { 2230 if err := p.ReadField1(iprot); err != nil { 2231 return err 2232 } 2233 } else { 2234 if err := iprot.Skip(fieldTypeId); err != nil { 2235 return err 2236 } 2237 } 2238 default: 2239 if err := iprot.Skip(fieldTypeId); err != nil { 2240 return err 2241 } 2242 } 2243 if err := iprot.ReadFieldEnd(); err != nil { 2244 return err 2245 } 2246 } 2247 if err := iprot.ReadStructEnd(); err != nil { 2248 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2249 } 2250 return nil 2251} 2252 2253func (p *CollectorSubmitBatchesArgs) ReadField1(iprot thrift.TProtocol) error { 2254 _, size, err := iprot.ReadListBegin() 2255 if err != nil { 2256 return thrift.PrependError("error reading list begin: ", err) 2257 } 2258 tSlice := make([]*Batch, 0, size) 2259 p.Batches = tSlice 2260 for i := 0; i < size; i++ { 2261 _elem10 := &Batch{} 2262 if err := _elem10.Read(iprot); err != nil { 2263 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) 2264 } 2265 p.Batches = append(p.Batches, _elem10) 2266 } 2267 if err := iprot.ReadListEnd(); err != nil { 2268 return thrift.PrependError("error reading list end: ", err) 2269 } 2270 return nil 2271} 2272 2273func (p *CollectorSubmitBatchesArgs) Write(oprot thrift.TProtocol) error { 2274 if err := oprot.WriteStructBegin("submitBatches_args"); err != nil { 2275 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2276 } 2277 if p != nil { 2278 if err := p.writeField1(oprot); err != nil { 2279 return err 2280 } 2281 } 2282 if err := oprot.WriteFieldStop(); err != nil { 2283 return thrift.PrependError("write field stop error: ", err) 2284 } 2285 if err := oprot.WriteStructEnd(); err != nil { 2286 return thrift.PrependError("write struct stop error: ", err) 2287 } 2288 return nil 2289} 2290 2291func (p *CollectorSubmitBatchesArgs) writeField1(oprot thrift.TProtocol) (err error) { 2292 if err := oprot.WriteFieldBegin("batches", thrift.LIST, 1); err != nil { 2293 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err) 2294 } 2295 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Batches)); err != nil { 2296 return thrift.PrependError("error writing list begin: ", err) 2297 } 2298 for _, v := range p.Batches { 2299 if err := v.Write(oprot); err != nil { 2300 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 2301 } 2302 } 2303 if err := oprot.WriteListEnd(); err != nil { 2304 return thrift.PrependError("error writing list end: ", err) 2305 } 2306 if err := oprot.WriteFieldEnd(); err != nil { 2307 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err) 2308 } 2309 return err 2310} 2311 2312func (p *CollectorSubmitBatchesArgs) String() string { 2313 if p == nil { 2314 return "<nil>" 2315 } 2316 return fmt.Sprintf("CollectorSubmitBatchesArgs(%+v)", *p) 2317} 2318 2319// Attributes: 2320// - Success 2321type CollectorSubmitBatchesResult struct { 2322 Success []*BatchSubmitResponse `thrift:"success,0" db:"success" json:"success,omitempty"` 2323} 2324 2325func NewCollectorSubmitBatchesResult() *CollectorSubmitBatchesResult { 2326 return &CollectorSubmitBatchesResult{} 2327} 2328 2329var CollectorSubmitBatchesResult_Success_DEFAULT []*BatchSubmitResponse 2330 2331func (p *CollectorSubmitBatchesResult) GetSuccess() []*BatchSubmitResponse { 2332 return p.Success 2333} 2334func (p *CollectorSubmitBatchesResult) IsSetSuccess() bool { 2335 return p.Success != nil 2336} 2337 2338func (p *CollectorSubmitBatchesResult) Read(iprot thrift.TProtocol) error { 2339 if _, err := iprot.ReadStructBegin(); err != nil { 2340 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2341 } 2342 2343 for { 2344 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 2345 if err != nil { 2346 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2347 } 2348 if fieldTypeId == thrift.STOP { 2349 break 2350 } 2351 switch fieldId { 2352 case 0: 2353 if fieldTypeId == thrift.LIST { 2354 if err := p.ReadField0(iprot); err != nil { 2355 return err 2356 } 2357 } else { 2358 if err := iprot.Skip(fieldTypeId); err != nil { 2359 return err 2360 } 2361 } 2362 default: 2363 if err := iprot.Skip(fieldTypeId); err != nil { 2364 return err 2365 } 2366 } 2367 if err := iprot.ReadFieldEnd(); err != nil { 2368 return err 2369 } 2370 } 2371 if err := iprot.ReadStructEnd(); err != nil { 2372 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2373 } 2374 return nil 2375} 2376 2377func (p *CollectorSubmitBatchesResult) ReadField0(iprot thrift.TProtocol) error { 2378 _, size, err := iprot.ReadListBegin() 2379 if err != nil { 2380 return thrift.PrependError("error reading list begin: ", err) 2381 } 2382 tSlice := make([]*BatchSubmitResponse, 0, size) 2383 p.Success = tSlice 2384 for i := 0; i < size; i++ { 2385 _elem11 := &BatchSubmitResponse{} 2386 if err := _elem11.Read(iprot); err != nil { 2387 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) 2388 } 2389 p.Success = append(p.Success, _elem11) 2390 } 2391 if err := iprot.ReadListEnd(); err != nil { 2392 return thrift.PrependError("error reading list end: ", err) 2393 } 2394 return nil 2395} 2396 2397func (p *CollectorSubmitBatchesResult) Write(oprot thrift.TProtocol) error { 2398 if err := oprot.WriteStructBegin("submitBatches_result"); err != nil { 2399 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2400 } 2401 if p != nil { 2402 if err := p.writeField0(oprot); err != nil { 2403 return err 2404 } 2405 } 2406 if err := oprot.WriteFieldStop(); err != nil { 2407 return thrift.PrependError("write field stop error: ", err) 2408 } 2409 if err := oprot.WriteStructEnd(); err != nil { 2410 return thrift.PrependError("write struct stop error: ", err) 2411 } 2412 return nil 2413} 2414 2415func (p *CollectorSubmitBatchesResult) writeField0(oprot thrift.TProtocol) (err error) { 2416 if p.IsSetSuccess() { 2417 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { 2418 return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) 2419 } 2420 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { 2421 return thrift.PrependError("error writing list begin: ", err) 2422 } 2423 for _, v := range p.Success { 2424 if err := v.Write(oprot); err != nil { 2425 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 2426 } 2427 } 2428 if err := oprot.WriteListEnd(); err != nil { 2429 return thrift.PrependError("error writing list end: ", err) 2430 } 2431 if err := oprot.WriteFieldEnd(); err != nil { 2432 return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) 2433 } 2434 } 2435 return err 2436} 2437 2438func (p *CollectorSubmitBatchesResult) String() string { 2439 if p == nil { 2440 return "<nil>" 2441 } 2442 return fmt.Sprintf("CollectorSubmitBatchesResult(%+v)", *p) 2443} 2444