All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.iotdb.mpp.rpc.thrift.TRegionMigrateResult Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.iotdb.mpp.rpc.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2024-09-12")
public class TRegionMigrateResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRegionMigrateResult");

  private static final org.apache.thrift.protocol.TField REGION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("regionId", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField MIGRATE_RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("migrateResult", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField FAILED_NODE_AND_REASON_FIELD_DESC = new org.apache.thrift.protocol.TField("failedNodeAndReason", org.apache.thrift.protocol.TType.MAP, (short)3);
  private static final org.apache.thrift.protocol.TField TASK_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("taskStatus", org.apache.thrift.protocol.TType.I32, (short)4);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TRegionMigrateResultStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TRegionMigrateResultTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionId; // optional
  public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TSStatus migrateResult; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Map failedNodeAndReason; // optional
  /**
   * 
   * @see org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus
   */
  public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus taskStatus; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    REGION_ID((short)1, "regionId"),
    MIGRATE_RESULT((short)2, "migrateResult"),
    FAILED_NODE_AND_REASON((short)3, "failedNodeAndReason"),
    /**
     * 
     * @see org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus
     */
    TASK_STATUS((short)4, "taskStatus");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // REGION_ID
          return REGION_ID;
        case 2: // MIGRATE_RESULT
          return MIGRATE_RESULT;
        case 3: // FAILED_NODE_AND_REASON
          return FAILED_NODE_AND_REASON;
        case 4: // TASK_STATUS
          return TASK_STATUS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.REGION_ID,_Fields.MIGRATE_RESULT,_Fields.FAILED_NODE_AND_REASON};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.REGION_ID, new org.apache.thrift.meta_data.FieldMetaData("regionId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TConsensusGroupId.class)));
    tmpMap.put(_Fields.MIGRATE_RESULT, new org.apache.thrift.meta_data.FieldMetaData("migrateResult", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TSStatus.class)));
    tmpMap.put(_Fields.FAILED_NODE_AND_REASON, new org.apache.thrift.meta_data.FieldMetaData("failedNodeAndReason", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TDataNodeLocation.class), 
            new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType.class))));
    tmpMap.put(_Fields.TASK_STATUS, new org.apache.thrift.meta_data.FieldMetaData("taskStatus", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRegionMigrateResult.class, metaDataMap);
  }

  public TRegionMigrateResult() {
  }

  public TRegionMigrateResult(
    org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus taskStatus)
  {
    this();
    this.taskStatus = taskStatus;
  }

  /**
   * Performs a deep copy on other.
   */
  public TRegionMigrateResult(TRegionMigrateResult other) {
    if (other.isSetRegionId()) {
      this.regionId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId(other.regionId);
    }
    if (other.isSetMigrateResult()) {
      this.migrateResult = new org.apache.iotdb.common.rpc.thrift.TSStatus(other.migrateResult);
    }
    if (other.isSetFailedNodeAndReason()) {
      java.util.Map __this__failedNodeAndReason = new java.util.HashMap(other.failedNodeAndReason.size());
      for (java.util.Map.Entry other_element : other.failedNodeAndReason.entrySet()) {

        org.apache.iotdb.common.rpc.thrift.TDataNodeLocation other_element_key = other_element.getKey();
        org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType other_element_value = other_element.getValue();

        org.apache.iotdb.common.rpc.thrift.TDataNodeLocation __this__failedNodeAndReason_copy_key = new org.apache.iotdb.common.rpc.thrift.TDataNodeLocation(other_element_key);

        org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType __this__failedNodeAndReason_copy_value = other_element_value;

        __this__failedNodeAndReason.put(__this__failedNodeAndReason_copy_key, __this__failedNodeAndReason_copy_value);
      }
      this.failedNodeAndReason = __this__failedNodeAndReason;
    }
    if (other.isSetTaskStatus()) {
      this.taskStatus = other.taskStatus;
    }
  }

  public TRegionMigrateResult deepCopy() {
    return new TRegionMigrateResult(this);
  }

  @Override
  public void clear() {
    this.regionId = null;
    this.migrateResult = null;
    this.failedNodeAndReason = null;
    this.taskStatus = null;
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.iotdb.common.rpc.thrift.TConsensusGroupId getRegionId() {
    return this.regionId;
  }

  public TRegionMigrateResult setRegionId(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionId) {
    this.regionId = regionId;
    return this;
  }

  public void unsetRegionId() {
    this.regionId = null;
  }

  /** Returns true if field regionId is set (has been assigned a value) and false otherwise */
  public boolean isSetRegionId() {
    return this.regionId != null;
  }

  public void setRegionIdIsSet(boolean value) {
    if (!value) {
      this.regionId = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public org.apache.iotdb.common.rpc.thrift.TSStatus getMigrateResult() {
    return this.migrateResult;
  }

  public TRegionMigrateResult setMigrateResult(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TSStatus migrateResult) {
    this.migrateResult = migrateResult;
    return this;
  }

  public void unsetMigrateResult() {
    this.migrateResult = null;
  }

  /** Returns true if field migrateResult is set (has been assigned a value) and false otherwise */
  public boolean isSetMigrateResult() {
    return this.migrateResult != null;
  }

  public void setMigrateResultIsSet(boolean value) {
    if (!value) {
      this.migrateResult = null;
    }
  }

  public int getFailedNodeAndReasonSize() {
    return (this.failedNodeAndReason == null) ? 0 : this.failedNodeAndReason.size();
  }

  public void putToFailedNodeAndReason(org.apache.iotdb.common.rpc.thrift.TDataNodeLocation key, org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType val) {
    if (this.failedNodeAndReason == null) {
      this.failedNodeAndReason = new java.util.HashMap();
    }
    this.failedNodeAndReason.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map getFailedNodeAndReason() {
    return this.failedNodeAndReason;
  }

  public TRegionMigrateResult setFailedNodeAndReason(@org.apache.thrift.annotation.Nullable java.util.Map failedNodeAndReason) {
    this.failedNodeAndReason = failedNodeAndReason;
    return this;
  }

  public void unsetFailedNodeAndReason() {
    this.failedNodeAndReason = null;
  }

  /** Returns true if field failedNodeAndReason is set (has been assigned a value) and false otherwise */
  public boolean isSetFailedNodeAndReason() {
    return this.failedNodeAndReason != null;
  }

  public void setFailedNodeAndReasonIsSet(boolean value) {
    if (!value) {
      this.failedNodeAndReason = null;
    }
  }

  /**
   * 
   * @see org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus
   */
  @org.apache.thrift.annotation.Nullable
  public org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus getTaskStatus() {
    return this.taskStatus;
  }

  /**
   * 
   * @see org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus
   */
  public TRegionMigrateResult setTaskStatus(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus taskStatus) {
    this.taskStatus = taskStatus;
    return this;
  }

  public void unsetTaskStatus() {
    this.taskStatus = null;
  }

  /** Returns true if field taskStatus is set (has been assigned a value) and false otherwise */
  public boolean isSetTaskStatus() {
    return this.taskStatus != null;
  }

  public void setTaskStatusIsSet(boolean value) {
    if (!value) {
      this.taskStatus = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case REGION_ID:
      if (value == null) {
        unsetRegionId();
      } else {
        setRegionId((org.apache.iotdb.common.rpc.thrift.TConsensusGroupId)value);
      }
      break;

    case MIGRATE_RESULT:
      if (value == null) {
        unsetMigrateResult();
      } else {
        setMigrateResult((org.apache.iotdb.common.rpc.thrift.TSStatus)value);
      }
      break;

    case FAILED_NODE_AND_REASON:
      if (value == null) {
        unsetFailedNodeAndReason();
      } else {
        setFailedNodeAndReason((java.util.Map)value);
      }
      break;

    case TASK_STATUS:
      if (value == null) {
        unsetTaskStatus();
      } else {
        setTaskStatus((org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case REGION_ID:
      return getRegionId();

    case MIGRATE_RESULT:
      return getMigrateResult();

    case FAILED_NODE_AND_REASON:
      return getFailedNodeAndReason();

    case TASK_STATUS:
      return getTaskStatus();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case REGION_ID:
      return isSetRegionId();
    case MIGRATE_RESULT:
      return isSetMigrateResult();
    case FAILED_NODE_AND_REASON:
      return isSetFailedNodeAndReason();
    case TASK_STATUS:
      return isSetTaskStatus();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TRegionMigrateResult)
      return this.equals((TRegionMigrateResult)that);
    return false;
  }

  public boolean equals(TRegionMigrateResult that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_regionId = true && this.isSetRegionId();
    boolean that_present_regionId = true && that.isSetRegionId();
    if (this_present_regionId || that_present_regionId) {
      if (!(this_present_regionId && that_present_regionId))
        return false;
      if (!this.regionId.equals(that.regionId))
        return false;
    }

    boolean this_present_migrateResult = true && this.isSetMigrateResult();
    boolean that_present_migrateResult = true && that.isSetMigrateResult();
    if (this_present_migrateResult || that_present_migrateResult) {
      if (!(this_present_migrateResult && that_present_migrateResult))
        return false;
      if (!this.migrateResult.equals(that.migrateResult))
        return false;
    }

    boolean this_present_failedNodeAndReason = true && this.isSetFailedNodeAndReason();
    boolean that_present_failedNodeAndReason = true && that.isSetFailedNodeAndReason();
    if (this_present_failedNodeAndReason || that_present_failedNodeAndReason) {
      if (!(this_present_failedNodeAndReason && that_present_failedNodeAndReason))
        return false;
      if (!this.failedNodeAndReason.equals(that.failedNodeAndReason))
        return false;
    }

    boolean this_present_taskStatus = true && this.isSetTaskStatus();
    boolean that_present_taskStatus = true && that.isSetTaskStatus();
    if (this_present_taskStatus || that_present_taskStatus) {
      if (!(this_present_taskStatus && that_present_taskStatus))
        return false;
      if (!this.taskStatus.equals(that.taskStatus))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetRegionId()) ? 131071 : 524287);
    if (isSetRegionId())
      hashCode = hashCode * 8191 + regionId.hashCode();

    hashCode = hashCode * 8191 + ((isSetMigrateResult()) ? 131071 : 524287);
    if (isSetMigrateResult())
      hashCode = hashCode * 8191 + migrateResult.hashCode();

    hashCode = hashCode * 8191 + ((isSetFailedNodeAndReason()) ? 131071 : 524287);
    if (isSetFailedNodeAndReason())
      hashCode = hashCode * 8191 + failedNodeAndReason.hashCode();

    hashCode = hashCode * 8191 + ((isSetTaskStatus()) ? 131071 : 524287);
    if (isSetTaskStatus())
      hashCode = hashCode * 8191 + taskStatus.getValue();

    return hashCode;
  }

  @Override
  public int compareTo(TRegionMigrateResult other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetRegionId(), other.isSetRegionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRegionId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.regionId, other.regionId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMigrateResult(), other.isSetMigrateResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMigrateResult()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.migrateResult, other.migrateResult);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFailedNodeAndReason(), other.isSetFailedNodeAndReason());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFailedNodeAndReason()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedNodeAndReason, other.failedNodeAndReason);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTaskStatus(), other.isSetTaskStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskStatus, other.taskStatus);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TRegionMigrateResult(");
    boolean first = true;

    if (isSetRegionId()) {
      sb.append("regionId:");
      if (this.regionId == null) {
        sb.append("null");
      } else {
        sb.append(this.regionId);
      }
      first = false;
    }
    if (isSetMigrateResult()) {
      if (!first) sb.append(", ");
      sb.append("migrateResult:");
      if (this.migrateResult == null) {
        sb.append("null");
      } else {
        sb.append(this.migrateResult);
      }
      first = false;
    }
    if (isSetFailedNodeAndReason()) {
      if (!first) sb.append(", ");
      sb.append("failedNodeAndReason:");
      if (this.failedNodeAndReason == null) {
        sb.append("null");
      } else {
        sb.append(this.failedNodeAndReason);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("taskStatus:");
    if (this.taskStatus == null) {
      sb.append("null");
    } else {
      sb.append(this.taskStatus);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (taskStatus == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'taskStatus' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (regionId != null) {
      regionId.validate();
    }
    if (migrateResult != null) {
      migrateResult.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TRegionMigrateResultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TRegionMigrateResultStandardScheme getScheme() {
      return new TRegionMigrateResultStandardScheme();
    }
  }

  private static class TRegionMigrateResultStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TRegionMigrateResult 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: // REGION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.regionId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
              struct.regionId.read(iprot);
              struct.setRegionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MIGRATE_RESULT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.migrateResult = new org.apache.iotdb.common.rpc.thrift.TSStatus();
              struct.migrateResult.read(iprot);
              struct.setMigrateResultIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // FAILED_NODE_AND_REASON
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
                struct.failedNodeAndReason = new java.util.HashMap(2*_map0.size);
                @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TDataNodeLocation _key1;
                @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType _val2;
                for (int _i3 = 0; _i3 < _map0.size; ++_i3)
                {
                  _key1 = new org.apache.iotdb.common.rpc.thrift.TDataNodeLocation();
                  _key1.read(iprot);
                  _val2 = org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType.findByValue(iprot.readI32());
                  struct.failedNodeAndReason.put(_key1, _val2);
                }
                iprot.readMapEnd();
              }
              struct.setFailedNodeAndReasonIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TASK_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.taskStatus = org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus.findByValue(iprot.readI32());
              struct.setTaskStatusIsSet(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();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TRegionMigrateResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.regionId != null) {
        if (struct.isSetRegionId()) {
          oprot.writeFieldBegin(REGION_ID_FIELD_DESC);
          struct.regionId.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.migrateResult != null) {
        if (struct.isSetMigrateResult()) {
          oprot.writeFieldBegin(MIGRATE_RESULT_FIELD_DESC);
          struct.migrateResult.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.failedNodeAndReason != null) {
        if (struct.isSetFailedNodeAndReason()) {
          oprot.writeFieldBegin(FAILED_NODE_AND_REASON_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.I32, struct.failedNodeAndReason.size()));
            for (java.util.Map.Entry _iter4 : struct.failedNodeAndReason.entrySet())
            {
              _iter4.getKey().write(oprot);
              oprot.writeI32(_iter4.getValue().getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.taskStatus != null) {
        oprot.writeFieldBegin(TASK_STATUS_FIELD_DESC);
        oprot.writeI32(struct.taskStatus.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TRegionMigrateResultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TRegionMigrateResultTupleScheme getScheme() {
      return new TRegionMigrateResultTupleScheme();
    }
  }

  private static class TRegionMigrateResultTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TRegionMigrateResult struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.taskStatus.getValue());
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetRegionId()) {
        optionals.set(0);
      }
      if (struct.isSetMigrateResult()) {
        optionals.set(1);
      }
      if (struct.isSetFailedNodeAndReason()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetRegionId()) {
        struct.regionId.write(oprot);
      }
      if (struct.isSetMigrateResult()) {
        struct.migrateResult.write(oprot);
      }
      if (struct.isSetFailedNodeAndReason()) {
        {
          oprot.writeI32(struct.failedNodeAndReason.size());
          for (java.util.Map.Entry _iter5 : struct.failedNodeAndReason.entrySet())
          {
            _iter5.getKey().write(oprot);
            oprot.writeI32(_iter5.getValue().getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TRegionMigrateResult struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.taskStatus = org.apache.iotdb.common.rpc.thrift.TRegionMaintainTaskStatus.findByValue(iprot.readI32());
      struct.setTaskStatusIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.regionId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
        struct.regionId.read(iprot);
        struct.setRegionIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.migrateResult = new org.apache.iotdb.common.rpc.thrift.TSStatus();
        struct.migrateResult.read(iprot);
        struct.setMigrateResultIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TMap _map6 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.I32); 
          struct.failedNodeAndReason = new java.util.HashMap(2*_map6.size);
          @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TDataNodeLocation _key7;
          @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType _val8;
          for (int _i9 = 0; _i9 < _map6.size; ++_i9)
          {
            _key7 = new org.apache.iotdb.common.rpc.thrift.TDataNodeLocation();
            _key7.read(iprot);
            _val8 = org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType.findByValue(iprot.readI32());
            struct.failedNodeAndReason.put(_key7, _val8);
          }
        }
        struct.setFailedNodeAndReasonIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy