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

org.apache.iotdb.consensus.multileader.thrift.TSendSnapshotFragmentReq 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.consensus.multileader.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2022-10-14")
public class TSendSnapshotFragmentReq 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("TSendSnapshotFragmentReq");

  private static final org.apache.thrift.protocol.TField CONSENSUS_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("consensusGroupId", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField SNAPSHOT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("snapshotId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField FILE_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("filePath", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField CHUNK_LENGTH_FIELD_DESC = new org.apache.thrift.protocol.TField("chunkLength", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField FILE_CHUNK_FIELD_DESC = new org.apache.thrift.protocol.TField("fileChunk", org.apache.thrift.protocol.TType.STRING, (short)5);

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

  public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String snapshotId; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String filePath; // required
  public long chunkLength; // required
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer fileChunk; // 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 {
    CONSENSUS_GROUP_ID((short)1, "consensusGroupId"),
    SNAPSHOT_ID((short)2, "snapshotId"),
    FILE_PATH((short)3, "filePath"),
    CHUNK_LENGTH((short)4, "chunkLength"),
    FILE_CHUNK((short)5, "fileChunk");

    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: // CONSENSUS_GROUP_ID
          return CONSENSUS_GROUP_ID;
        case 2: // SNAPSHOT_ID
          return SNAPSHOT_ID;
        case 3: // FILE_PATH
          return FILE_PATH;
        case 4: // CHUNK_LENGTH
          return CHUNK_LENGTH;
        case 5: // FILE_CHUNK
          return FILE_CHUNK;
        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 int __CHUNKLENGTH_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  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.CONSENSUS_GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("consensusGroupId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TConsensusGroupId.class)));
    tmpMap.put(_Fields.SNAPSHOT_ID, new org.apache.thrift.meta_data.FieldMetaData("snapshotId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FILE_PATH, new org.apache.thrift.meta_data.FieldMetaData("filePath", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CHUNK_LENGTH, new org.apache.thrift.meta_data.FieldMetaData("chunkLength", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FILE_CHUNK, new org.apache.thrift.meta_data.FieldMetaData("fileChunk", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSendSnapshotFragmentReq.class, metaDataMap);
  }

  public TSendSnapshotFragmentReq() {
  }

  public TSendSnapshotFragmentReq(
    org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId,
    java.lang.String snapshotId,
    java.lang.String filePath,
    long chunkLength,
    java.nio.ByteBuffer fileChunk)
  {
    this();
    this.consensusGroupId = consensusGroupId;
    this.snapshotId = snapshotId;
    this.filePath = filePath;
    this.chunkLength = chunkLength;
    setChunkLengthIsSet(true);
    this.fileChunk = org.apache.thrift.TBaseHelper.copyBinary(fileChunk);
  }

  /**
   * Performs a deep copy on other.
   */
  public TSendSnapshotFragmentReq(TSendSnapshotFragmentReq other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetConsensusGroupId()) {
      this.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId(other.consensusGroupId);
    }
    if (other.isSetSnapshotId()) {
      this.snapshotId = other.snapshotId;
    }
    if (other.isSetFilePath()) {
      this.filePath = other.filePath;
    }
    this.chunkLength = other.chunkLength;
    if (other.isSetFileChunk()) {
      this.fileChunk = org.apache.thrift.TBaseHelper.copyBinary(other.fileChunk);
    }
  }

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

  @Override
  public void clear() {
    this.consensusGroupId = null;
    this.snapshotId = null;
    this.filePath = null;
    setChunkLengthIsSet(false);
    this.chunkLength = 0;
    this.fileChunk = null;
  }

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

  public TSendSnapshotFragmentReq setConsensusGroupId(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId) {
    this.consensusGroupId = consensusGroupId;
    return this;
  }

  public void unsetConsensusGroupId() {
    this.consensusGroupId = null;
  }

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

  public void setConsensusGroupIdIsSet(boolean value) {
    if (!value) {
      this.consensusGroupId = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getSnapshotId() {
    return this.snapshotId;
  }

  public TSendSnapshotFragmentReq setSnapshotId(@org.apache.thrift.annotation.Nullable java.lang.String snapshotId) {
    this.snapshotId = snapshotId;
    return this;
  }

  public void unsetSnapshotId() {
    this.snapshotId = null;
  }

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

  public void setSnapshotIdIsSet(boolean value) {
    if (!value) {
      this.snapshotId = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFilePath() {
    return this.filePath;
  }

  public TSendSnapshotFragmentReq setFilePath(@org.apache.thrift.annotation.Nullable java.lang.String filePath) {
    this.filePath = filePath;
    return this;
  }

  public void unsetFilePath() {
    this.filePath = null;
  }

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

  public void setFilePathIsSet(boolean value) {
    if (!value) {
      this.filePath = null;
    }
  }

  public long getChunkLength() {
    return this.chunkLength;
  }

  public TSendSnapshotFragmentReq setChunkLength(long chunkLength) {
    this.chunkLength = chunkLength;
    setChunkLengthIsSet(true);
    return this;
  }

  public void unsetChunkLength() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CHUNKLENGTH_ISSET_ID);
  }

  /** Returns true if field chunkLength is set (has been assigned a value) and false otherwise */
  public boolean isSetChunkLength() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CHUNKLENGTH_ISSET_ID);
  }

  public void setChunkLengthIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CHUNKLENGTH_ISSET_ID, value);
  }

  public byte[] getFileChunk() {
    setFileChunk(org.apache.thrift.TBaseHelper.rightSize(fileChunk));
    return fileChunk == null ? null : fileChunk.array();
  }

  public java.nio.ByteBuffer bufferForFileChunk() {
    return org.apache.thrift.TBaseHelper.copyBinary(fileChunk);
  }

  public TSendSnapshotFragmentReq setFileChunk(byte[] fileChunk) {
    this.fileChunk = fileChunk == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(fileChunk.clone());
    return this;
  }

  public TSendSnapshotFragmentReq setFileChunk(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer fileChunk) {
    this.fileChunk = org.apache.thrift.TBaseHelper.copyBinary(fileChunk);
    return this;
  }

  public void unsetFileChunk() {
    this.fileChunk = null;
  }

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

  public void setFileChunkIsSet(boolean value) {
    if (!value) {
      this.fileChunk = null;
    }
  }

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

    case SNAPSHOT_ID:
      if (value == null) {
        unsetSnapshotId();
      } else {
        setSnapshotId((java.lang.String)value);
      }
      break;

    case FILE_PATH:
      if (value == null) {
        unsetFilePath();
      } else {
        setFilePath((java.lang.String)value);
      }
      break;

    case CHUNK_LENGTH:
      if (value == null) {
        unsetChunkLength();
      } else {
        setChunkLength((java.lang.Long)value);
      }
      break;

    case FILE_CHUNK:
      if (value == null) {
        unsetFileChunk();
      } else {
        if (value instanceof byte[]) {
          setFileChunk((byte[])value);
        } else {
          setFileChunk((java.nio.ByteBuffer)value);
        }
      }
      break;

    }
  }

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

    case SNAPSHOT_ID:
      return getSnapshotId();

    case FILE_PATH:
      return getFilePath();

    case CHUNK_LENGTH:
      return getChunkLength();

    case FILE_CHUNK:
      return getFileChunk();

    }
    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 CONSENSUS_GROUP_ID:
      return isSetConsensusGroupId();
    case SNAPSHOT_ID:
      return isSetSnapshotId();
    case FILE_PATH:
      return isSetFilePath();
    case CHUNK_LENGTH:
      return isSetChunkLength();
    case FILE_CHUNK:
      return isSetFileChunk();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_consensusGroupId = true && this.isSetConsensusGroupId();
    boolean that_present_consensusGroupId = true && that.isSetConsensusGroupId();
    if (this_present_consensusGroupId || that_present_consensusGroupId) {
      if (!(this_present_consensusGroupId && that_present_consensusGroupId))
        return false;
      if (!this.consensusGroupId.equals(that.consensusGroupId))
        return false;
    }

    boolean this_present_snapshotId = true && this.isSetSnapshotId();
    boolean that_present_snapshotId = true && that.isSetSnapshotId();
    if (this_present_snapshotId || that_present_snapshotId) {
      if (!(this_present_snapshotId && that_present_snapshotId))
        return false;
      if (!this.snapshotId.equals(that.snapshotId))
        return false;
    }

    boolean this_present_filePath = true && this.isSetFilePath();
    boolean that_present_filePath = true && that.isSetFilePath();
    if (this_present_filePath || that_present_filePath) {
      if (!(this_present_filePath && that_present_filePath))
        return false;
      if (!this.filePath.equals(that.filePath))
        return false;
    }

    boolean this_present_chunkLength = true;
    boolean that_present_chunkLength = true;
    if (this_present_chunkLength || that_present_chunkLength) {
      if (!(this_present_chunkLength && that_present_chunkLength))
        return false;
      if (this.chunkLength != that.chunkLength)
        return false;
    }

    boolean this_present_fileChunk = true && this.isSetFileChunk();
    boolean that_present_fileChunk = true && that.isSetFileChunk();
    if (this_present_fileChunk || that_present_fileChunk) {
      if (!(this_present_fileChunk && that_present_fileChunk))
        return false;
      if (!this.fileChunk.equals(that.fileChunk))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetConsensusGroupId()) ? 131071 : 524287);
    if (isSetConsensusGroupId())
      hashCode = hashCode * 8191 + consensusGroupId.hashCode();

    hashCode = hashCode * 8191 + ((isSetSnapshotId()) ? 131071 : 524287);
    if (isSetSnapshotId())
      hashCode = hashCode * 8191 + snapshotId.hashCode();

    hashCode = hashCode * 8191 + ((isSetFilePath()) ? 131071 : 524287);
    if (isSetFilePath())
      hashCode = hashCode * 8191 + filePath.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(chunkLength);

    hashCode = hashCode * 8191 + ((isSetFileChunk()) ? 131071 : 524287);
    if (isSetFileChunk())
      hashCode = hashCode * 8191 + fileChunk.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetConsensusGroupId(), other.isSetConsensusGroupId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConsensusGroupId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consensusGroupId, other.consensusGroupId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSnapshotId(), other.isSetSnapshotId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSnapshotId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.snapshotId, other.snapshotId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFilePath(), other.isSetFilePath());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFilePath()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filePath, other.filePath);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetChunkLength(), other.isSetChunkLength());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChunkLength()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.chunkLength, other.chunkLength);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFileChunk(), other.isSetFileChunk());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFileChunk()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fileChunk, other.fileChunk);
      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("TSendSnapshotFragmentReq(");
    boolean first = true;

    sb.append("consensusGroupId:");
    if (this.consensusGroupId == null) {
      sb.append("null");
    } else {
      sb.append(this.consensusGroupId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("snapshotId:");
    if (this.snapshotId == null) {
      sb.append("null");
    } else {
      sb.append(this.snapshotId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("filePath:");
    if (this.filePath == null) {
      sb.append("null");
    } else {
      sb.append(this.filePath);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("chunkLength:");
    sb.append(this.chunkLength);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fileChunk:");
    if (this.fileChunk == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.fileChunk, sb);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (consensusGroupId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'consensusGroupId' was not present! Struct: " + toString());
    }
    if (snapshotId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'snapshotId' was not present! Struct: " + toString());
    }
    if (filePath == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'filePath' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'chunkLength' because it's a primitive and you chose the non-beans generator.
    if (fileChunk == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'fileChunk' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (consensusGroupId != null) {
      consensusGroupId.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 {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      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 TSendSnapshotFragmentReqStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSendSnapshotFragmentReqStandardScheme getScheme() {
      return new TSendSnapshotFragmentReqStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSendSnapshotFragmentReq 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: // CONSENSUS_GROUP_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
              struct.consensusGroupId.read(iprot);
              struct.setConsensusGroupIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SNAPSHOT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.snapshotId = iprot.readString();
              struct.setSnapshotIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // FILE_PATH
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.filePath = iprot.readString();
              struct.setFilePathIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // CHUNK_LENGTH
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.chunkLength = iprot.readI64();
              struct.setChunkLengthIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FILE_CHUNK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fileChunk = iprot.readBinary();
              struct.setFileChunkIsSet(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
      if (!struct.isSetChunkLength()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'chunkLength' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.consensusGroupId != null) {
        oprot.writeFieldBegin(CONSENSUS_GROUP_ID_FIELD_DESC);
        struct.consensusGroupId.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.snapshotId != null) {
        oprot.writeFieldBegin(SNAPSHOT_ID_FIELD_DESC);
        oprot.writeString(struct.snapshotId);
        oprot.writeFieldEnd();
      }
      if (struct.filePath != null) {
        oprot.writeFieldBegin(FILE_PATH_FIELD_DESC);
        oprot.writeString(struct.filePath);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(CHUNK_LENGTH_FIELD_DESC);
      oprot.writeI64(struct.chunkLength);
      oprot.writeFieldEnd();
      if (struct.fileChunk != null) {
        oprot.writeFieldBegin(FILE_CHUNK_FIELD_DESC);
        oprot.writeBinary(struct.fileChunk);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSendSnapshotFragmentReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.consensusGroupId.write(oprot);
      oprot.writeString(struct.snapshotId);
      oprot.writeString(struct.filePath);
      oprot.writeI64(struct.chunkLength);
      oprot.writeBinary(struct.fileChunk);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSendSnapshotFragmentReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
      struct.consensusGroupId.read(iprot);
      struct.setConsensusGroupIdIsSet(true);
      struct.snapshotId = iprot.readString();
      struct.setSnapshotIdIsSet(true);
      struct.filePath = iprot.readString();
      struct.setFilePathIsSet(true);
      struct.chunkLength = iprot.readI64();
      struct.setChunkLengthIsSet(true);
      struct.fileChunk = iprot.readBinary();
      struct.setFileChunkIsSet(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 - 2025 Weber Informatics LLC | Privacy Policy