read method

void read(
  1. TProtocol iprot
)
override

Reads the TObject from the given input protocol.

Implementation

read(TProtocol iprot) {
  TField field;
  iprot.readStructBegin();
  while (true) {
    field = iprot.readFieldBegin();
    if (field.type == TType.STOP) {
      break;
    }
    switch (field.id) {
      case HOSTADDR:
        if (field.type == TType.STRUCT) {
          this.hostAddr = new t_nebula.HostAddr();
          this.hostAddr?.read(iprot);
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case STATUS:
        if (field.type == TType.I32) {
          this.status = iprot.readI32();
          this.__isset_status = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case LEADER_PARTS:
        if (field.type == TType.MAP) {
          {
            TMap _map12 = iprot.readMapBegin();
            this.leader_parts = new Map<Int8List, List<int>>();
            for (int _i13 = 0; _i13 < _map12.length; ++_i13) {
              Int8List _key14;
              List<int> _val15;
              _key14 = iprot.readBinary();
              {
                TList _list16 = iprot.readListBegin();
                _val15 = <int>[];
                for (int _i17 = 0; _i17 < _list16.length; ++_i17) {
                  int _elem18;
                  _elem18 = iprot.readI32();
                  _val15.add(_elem18);
                }
                iprot.readListEnd();
              }
              this.leader_parts?[_key14] = _val15;
            }
            iprot.readMapEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case ALL_PARTS:
        if (field.type == TType.MAP) {
          {
            TMap _map19 = iprot.readMapBegin();
            this.all_parts = new Map<Int8List, List<int>>();
            for (int _i20 = 0; _i20 < _map19.length; ++_i20) {
              Int8List _key21;
              List<int> _val22;
              _key21 = iprot.readBinary();
              {
                TList _list23 = iprot.readListBegin();
                _val22 = <int>[];
                for (int _i24 = 0; _i24 < _list23.length; ++_i24) {
                  int _elem25;
                  _elem25 = iprot.readI32();
                  _val22.add(_elem25);
                }
                iprot.readListEnd();
              }
              this.all_parts?[_key21] = _val22;
            }
            iprot.readMapEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case ROLE:
        if (field.type == TType.I32) {
          this.role = iprot.readI32();
          this.__isset_role = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case GIT_INFO_SHA:
        if (field.type == TType.STRING) {
          this.git_info_sha = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case ZONE_NAME:
        if (field.type == TType.STRING) {
          this.zone_name = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case VERSION:
        if (field.type == TType.STRING) {
          this.version = iprot.readBinary();
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      default:
        TProtocolUtil.skip(iprot, field.type);
        break;
    }
    iprot.readFieldEnd();
  }
  iprot.readStructEnd();

  // check for required fields of primitive type, which can't be checked in the validate method
  validate();
}