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 ROLE:
        if (field.type == TType.I32) {
          this.role = iprot.readI32();
          this.__isset_role = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case HOST:
        if (field.type == TType.STRUCT) {
          this.host = new t_nebula.HostAddr();
          this.host?.read(iprot);
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case CLUSTER_ID:
        if (field.type == TType.I64) {
          this.cluster_id = iprot.readI64();
          this.__isset_cluster_id = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case LEADER_PARTIDS:
        if (field.type == TType.MAP) {
          {
            TMap _map152 = iprot.readMapBegin();
            this.leader_partIds = new Map<int, List<LeaderInfo>>();
            for (int _i153 = 0; _i153 < _map152.length; ++_i153) {
              int _key154;
              List<LeaderInfo> _val155;
              _key154 = iprot.readI32();
              {
                TList _list156 = iprot.readListBegin();
                _val155 = <LeaderInfo>[];
                for (int _i157 = 0; _i157 < _list156.length; ++_i157) {
                  LeaderInfo _elem158;
                  _elem158 = new LeaderInfo();
                  _elem158.read(iprot);
                  _val155.add(_elem158);
                }
                iprot.readListEnd();
              }
              this.leader_partIds?[_key154] = _val155;
            }
            iprot.readMapEnd();
          }
        } 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 DISK_PARTS:
        if (field.type == TType.MAP) {
          {
            TMap _map159 = iprot.readMapBegin();
            this.disk_parts = new Map<int, Map<Int8List, PartitionList>>();
            for (int _i160 = 0; _i160 < _map159.length; ++_i160) {
              int _key161;
              Map<Int8List, PartitionList> _val162;
              _key161 = iprot.readI32();
              {
                TMap _map163 = iprot.readMapBegin();
                _val162 = new Map<Int8List, PartitionList>();
                for (int _i164 = 0; _i164 < _map163.length; ++_i164) {
                  Int8List _key165;
                  PartitionList _val166;
                  _key165 = iprot.readBinary();
                  _val166 = new PartitionList();
                  _val166.read(iprot);
                  _val162[_key165] = _val166;
                }
                iprot.readMapEnd();
              }
              this.disk_parts?[_key161] = _val162;
            }
            iprot.readMapEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case DIR:
        if (field.type == TType.STRUCT) {
          this.dir = new t_nebula.DirInfo();
          this.dir?.read(iprot);
        } 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();
}