Exemplo n.º 1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, WorkerInfo struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(ID_FIELD_DESC);
      oprot.writeI64(struct.id);
      oprot.writeFieldEnd();
      if (struct.address != null) {
        oprot.writeFieldBegin(ADDRESS_FIELD_DESC);
        struct.address.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(LAST_CONTACT_SEC_FIELD_DESC);
      oprot.writeI32(struct.lastContactSec);
      oprot.writeFieldEnd();
      if (struct.state != null) {
        oprot.writeFieldBegin(STATE_FIELD_DESC);
        oprot.writeString(struct.state);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(CAPACITY_BYTES_FIELD_DESC);
      oprot.writeI64(struct.capacityBytes);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(USED_BYTES_FIELD_DESC);
      oprot.writeI64(struct.usedBytes);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(START_TIME_MS_FIELD_DESC);
      oprot.writeI64(struct.startTimeMs);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Exemplo n.º 2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, WorkerInfo struct)
        throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.id = iprot.readI64();
              struct.setIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ADDRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.address = new tachyon.thrift.NetAddress();
              struct.address.read(iprot);
              struct.setAddressIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // LAST_CONTACT_SEC
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.lastContactSec = iprot.readI32();
              struct.setLastContactSecIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // STATE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.state = iprot.readString();
              struct.setStateIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // CAPACITY_BYTES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.capacityBytes = iprot.readI64();
              struct.setCapacityBytesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // USED_BYTES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.usedBytes = iprot.readI64();
              struct.setUsedBytesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // START_TIME_MS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.startTimeMs = iprot.readI64();
              struct.setStartTimeMsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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