MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / Read

Method Read

common/common.go:1504–1560  ·  view source on GitHub ↗
(ctx context.Context, iprot thrift.TProtocol)

Source from the content-addressed store, hash-verified

1502}
1503
1504func (p *TRegionReplicaSet) Read(ctx context.Context, iprot thrift.TProtocol) error {
1505 if _, err := iprot.ReadStructBegin(ctx); err != nil {
1506 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1507 }
1508
1509 var issetRegionId bool = false;
1510 var issetDataNodeLocations bool = false;
1511
1512 for {
1513 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
1514 if err != nil {
1515 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1516 }
1517 if fieldTypeId == thrift.STOP { break; }
1518 switch fieldId {
1519 case 1:
1520 if fieldTypeId == thrift.STRUCT {
1521 if err := p.ReadField1(ctx, iprot); err != nil {
1522 return err
1523 }
1524 issetRegionId = true
1525 } else {
1526 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1527 return err
1528 }
1529 }
1530 case 2:
1531 if fieldTypeId == thrift.LIST {
1532 if err := p.ReadField2(ctx, iprot); err != nil {
1533 return err
1534 }
1535 issetDataNodeLocations = true
1536 } else {
1537 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1538 return err
1539 }
1540 }
1541 default:
1542 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1543 return err
1544 }
1545 }
1546 if err := iprot.ReadFieldEnd(ctx); err != nil {
1547 return err
1548 }
1549 }
1550 if err := iprot.ReadStructEnd(ctx); err != nil {
1551 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1552 }
1553 if !issetRegionId{
1554 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RegionId is not set"));
1555 }
1556 if !issetDataNodeLocations{
1557 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataNodeLocations is not set"));
1558 }
1559 return nil
1560}
1561

Callers

nothing calls this directly

Calls 2

ReadField1Method · 0.95
ReadField2Method · 0.95

Tested by

no test coverage detected