TSnapshotRequest.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TSnapshotRequest implements org.apache.thrift.TBase<TSnapshotRequest, TSnapshotRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TSnapshotRequest> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSnapshotRequest");

  private static final org.apache.thrift.protocol.TField TABLET_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tablet_id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField SCHEMA_HASH_FIELD_DESC = new org.apache.thrift.protocol.TField("schema_hash", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField VERSION_HASH_FIELD_DESC = new org.apache.thrift.protocol.TField("version_hash", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField TIMEOUT_FIELD_DESC = new org.apache.thrift.protocol.TField("timeout", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField MISSING_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("missing_version", org.apache.thrift.protocol.TType.LIST, (short)6);
  private static final org.apache.thrift.protocol.TField LIST_FILES_FIELD_DESC = new org.apache.thrift.protocol.TField("list_files", org.apache.thrift.protocol.TType.BOOL, (short)7);
  private static final org.apache.thrift.protocol.TField ALLOW_INCREMENTAL_CLONE_FIELD_DESC = new org.apache.thrift.protocol.TField("allow_incremental_clone", org.apache.thrift.protocol.TType.BOOL, (short)8);
  private static final org.apache.thrift.protocol.TField PREFERRED_SNAPSHOT_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("preferred_snapshot_version", org.apache.thrift.protocol.TType.I32, (short)9);
  private static final org.apache.thrift.protocol.TField IS_COPY_TABLET_TASK_FIELD_DESC = new org.apache.thrift.protocol.TField("is_copy_tablet_task", org.apache.thrift.protocol.TType.BOOL, (short)10);
  private static final org.apache.thrift.protocol.TField START_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("start_version", org.apache.thrift.protocol.TType.I64, (short)11);
  private static final org.apache.thrift.protocol.TField END_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("end_version", org.apache.thrift.protocol.TType.I64, (short)12);
  private static final org.apache.thrift.protocol.TField IS_COPY_BINLOG_FIELD_DESC = new org.apache.thrift.protocol.TField("is_copy_binlog", org.apache.thrift.protocol.TType.BOOL, (short)13);
  private static final org.apache.thrift.protocol.TField REF_TABLET_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("ref_tablet_id", org.apache.thrift.protocol.TType.I64, (short)14);

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

  public long tablet_id; // required
  public int schema_hash; // required
  public long version; // optional
  public long version_hash; // optional
  public long timeout; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> missing_version; // optional
  public boolean list_files; // optional
  public boolean allow_incremental_clone; // optional
  public int preferred_snapshot_version; // optional
  public boolean is_copy_tablet_task; // optional
  public long start_version; // optional
  public long end_version; // optional
  public boolean is_copy_binlog; // optional
  public long ref_tablet_id; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    TABLET_ID((short)1, "tablet_id"),
    SCHEMA_HASH((short)2, "schema_hash"),
    VERSION((short)3, "version"),
    VERSION_HASH((short)4, "version_hash"),
    TIMEOUT((short)5, "timeout"),
    MISSING_VERSION((short)6, "missing_version"),
    LIST_FILES((short)7, "list_files"),
    ALLOW_INCREMENTAL_CLONE((short)8, "allow_incremental_clone"),
    PREFERRED_SNAPSHOT_VERSION((short)9, "preferred_snapshot_version"),
    IS_COPY_TABLET_TASK((short)10, "is_copy_tablet_task"),
    START_VERSION((short)11, "start_version"),
    END_VERSION((short)12, "end_version"),
    IS_COPY_BINLOG((short)13, "is_copy_binlog"),
    REF_TABLET_ID((short)14, "ref_tablet_id");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    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: // TABLET_ID
          return TABLET_ID;
        case 2: // SCHEMA_HASH
          return SCHEMA_HASH;
        case 3: // VERSION
          return VERSION;
        case 4: // VERSION_HASH
          return VERSION_HASH;
        case 5: // TIMEOUT
          return TIMEOUT;
        case 6: // MISSING_VERSION
          return MISSING_VERSION;
        case 7: // LIST_FILES
          return LIST_FILES;
        case 8: // ALLOW_INCREMENTAL_CLONE
          return ALLOW_INCREMENTAL_CLONE;
        case 9: // PREFERRED_SNAPSHOT_VERSION
          return PREFERRED_SNAPSHOT_VERSION;
        case 10: // IS_COPY_TABLET_TASK
          return IS_COPY_TABLET_TASK;
        case 11: // START_VERSION
          return START_VERSION;
        case 12: // END_VERSION
          return END_VERSION;
        case 13: // IS_COPY_BINLOG
          return IS_COPY_BINLOG;
        case 14: // REF_TABLET_ID
          return REF_TABLET_ID;
        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 __TABLET_ID_ISSET_ID = 0;
  private static final int __SCHEMA_HASH_ISSET_ID = 1;
  private static final int __VERSION_ISSET_ID = 2;
  private static final int __VERSION_HASH_ISSET_ID = 3;
  private static final int __TIMEOUT_ISSET_ID = 4;
  private static final int __LIST_FILES_ISSET_ID = 5;
  private static final int __ALLOW_INCREMENTAL_CLONE_ISSET_ID = 6;
  private static final int __PREFERRED_SNAPSHOT_VERSION_ISSET_ID = 7;
  private static final int __IS_COPY_TABLET_TASK_ISSET_ID = 8;
  private static final int __START_VERSION_ISSET_ID = 9;
  private static final int __END_VERSION_ISSET_ID = 10;
  private static final int __IS_COPY_BINLOG_ISSET_ID = 11;
  private static final int __REF_TABLET_ID_ISSET_ID = 12;
  private short __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.VERSION,_Fields.VERSION_HASH,_Fields.TIMEOUT,_Fields.MISSING_VERSION,_Fields.LIST_FILES,_Fields.ALLOW_INCREMENTAL_CLONE,_Fields.PREFERRED_SNAPSHOT_VERSION,_Fields.IS_COPY_TABLET_TASK,_Fields.START_VERSION,_Fields.END_VERSION,_Fields.IS_COPY_BINLOG,_Fields.REF_TABLET_ID};
  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.TABLET_ID, new org.apache.thrift.meta_data.FieldMetaData("tablet_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TTabletId")));
    tmpMap.put(_Fields.SCHEMA_HASH, new org.apache.thrift.meta_data.FieldMetaData("schema_hash", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TSchemaHash")));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TVersion")));
    tmpMap.put(_Fields.VERSION_HASH, new org.apache.thrift.meta_data.FieldMetaData("version_hash", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TVersionHash")));
    tmpMap.put(_Fields.TIMEOUT, new org.apache.thrift.meta_data.FieldMetaData("timeout", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MISSING_VERSION, new org.apache.thrift.meta_data.FieldMetaData("missing_version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64            , "TVersion"))));
    tmpMap.put(_Fields.LIST_FILES, new org.apache.thrift.meta_data.FieldMetaData("list_files", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.ALLOW_INCREMENTAL_CLONE, new org.apache.thrift.meta_data.FieldMetaData("allow_incremental_clone", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.PREFERRED_SNAPSHOT_VERSION, new org.apache.thrift.meta_data.FieldMetaData("preferred_snapshot_version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.IS_COPY_TABLET_TASK, new org.apache.thrift.meta_data.FieldMetaData("is_copy_tablet_task", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.START_VERSION, new org.apache.thrift.meta_data.FieldMetaData("start_version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TVersion")));
    tmpMap.put(_Fields.END_VERSION, new org.apache.thrift.meta_data.FieldMetaData("end_version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TVersion")));
    tmpMap.put(_Fields.IS_COPY_BINLOG, new org.apache.thrift.meta_data.FieldMetaData("is_copy_binlog", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.REF_TABLET_ID, new org.apache.thrift.meta_data.FieldMetaData("ref_tablet_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TTabletId")));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSnapshotRequest.class, metaDataMap);
  }

  public TSnapshotRequest() {
    this.preferred_snapshot_version = 4;

  }

  public TSnapshotRequest(
    long tablet_id,
    int schema_hash)
  {
    this();
    this.tablet_id = tablet_id;
    setTabletIdIsSet(true);
    this.schema_hash = schema_hash;
    setSchemaHashIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSnapshotRequest(TSnapshotRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    this.tablet_id = other.tablet_id;
    this.schema_hash = other.schema_hash;
    this.version = other.version;
    this.version_hash = other.version_hash;
    this.timeout = other.timeout;
    if (other.isSetMissingVersion()) {
      java.util.List<java.lang.Long> __this__missing_version = new java.util.ArrayList<java.lang.Long>(other.missing_version.size());
      for (java.lang.Long other_element : other.missing_version) {
        __this__missing_version.add(other_element);
      }
      this.missing_version = __this__missing_version;
    }
    this.list_files = other.list_files;
    this.allow_incremental_clone = other.allow_incremental_clone;
    this.preferred_snapshot_version = other.preferred_snapshot_version;
    this.is_copy_tablet_task = other.is_copy_tablet_task;
    this.start_version = other.start_version;
    this.end_version = other.end_version;
    this.is_copy_binlog = other.is_copy_binlog;
    this.ref_tablet_id = other.ref_tablet_id;
  }

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

  @Override
  public void clear() {
    setTabletIdIsSet(false);
    this.tablet_id = 0;
    setSchemaHashIsSet(false);
    this.schema_hash = 0;
    setVersionIsSet(false);
    this.version = 0;
    setVersionHashIsSet(false);
    this.version_hash = 0;
    setTimeoutIsSet(false);
    this.timeout = 0;
    this.missing_version = null;
    setListFilesIsSet(false);
    this.list_files = false;
    setAllowIncrementalCloneIsSet(false);
    this.allow_incremental_clone = false;
    this.preferred_snapshot_version = 4;

    setIsCopyTabletTaskIsSet(false);
    this.is_copy_tablet_task = false;
    setStartVersionIsSet(false);
    this.start_version = 0;
    setEndVersionIsSet(false);
    this.end_version = 0;
    setIsCopyBinlogIsSet(false);
    this.is_copy_binlog = false;
    setRefTabletIdIsSet(false);
    this.ref_tablet_id = 0;
  }

  public long getTabletId() {
    return this.tablet_id;
  }

  public TSnapshotRequest setTabletId(long tablet_id) {
    this.tablet_id = tablet_id;
    setTabletIdIsSet(true);
    return this;
  }

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

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

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

  public int getSchemaHash() {
    return this.schema_hash;
  }

  public TSnapshotRequest setSchemaHash(int schema_hash) {
    this.schema_hash = schema_hash;
    setSchemaHashIsSet(true);
    return this;
  }

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

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

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

  public long getVersion() {
    return this.version;
  }

  public TSnapshotRequest setVersion(long version) {
    this.version = version;
    setVersionIsSet(true);
    return this;
  }

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

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

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

  public long getVersionHash() {
    return this.version_hash;
  }

  public TSnapshotRequest setVersionHash(long version_hash) {
    this.version_hash = version_hash;
    setVersionHashIsSet(true);
    return this;
  }

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

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

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

  public long getTimeout() {
    return this.timeout;
  }

  public TSnapshotRequest setTimeout(long timeout) {
    this.timeout = timeout;
    setTimeoutIsSet(true);
    return this;
  }

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

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getMissingVersionIterator() {
    return (this.missing_version == null) ? null : this.missing_version.iterator();
  }

  public void addToMissingVersion(long elem) {
    if (this.missing_version == null) {
      this.missing_version = new java.util.ArrayList<java.lang.Long>();
    }
    this.missing_version.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getMissingVersion() {
    return this.missing_version;
  }

  public TSnapshotRequest setMissingVersion(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> missing_version) {
    this.missing_version = missing_version;
    return this;
  }

  public void unsetMissingVersion() {
    this.missing_version = null;
  }

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

  public void setMissingVersionIsSet(boolean value) {
    if (!value) {
      this.missing_version = null;
    }
  }

  public boolean isListFiles() {
    return this.list_files;
  }

  public TSnapshotRequest setListFiles(boolean list_files) {
    this.list_files = list_files;
    setListFilesIsSet(true);
    return this;
  }

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

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

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

  public boolean isAllowIncrementalClone() {
    return this.allow_incremental_clone;
  }

  public TSnapshotRequest setAllowIncrementalClone(boolean allow_incremental_clone) {
    this.allow_incremental_clone = allow_incremental_clone;
    setAllowIncrementalCloneIsSet(true);
    return this;
  }

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

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

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

  public int getPreferredSnapshotVersion() {
    return this.preferred_snapshot_version;
  }

  public TSnapshotRequest setPreferredSnapshotVersion(int preferred_snapshot_version) {
    this.preferred_snapshot_version = preferred_snapshot_version;
    setPreferredSnapshotVersionIsSet(true);
    return this;
  }

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

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

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

  public boolean isIsCopyTabletTask() {
    return this.is_copy_tablet_task;
  }

  public TSnapshotRequest setIsCopyTabletTask(boolean is_copy_tablet_task) {
    this.is_copy_tablet_task = is_copy_tablet_task;
    setIsCopyTabletTaskIsSet(true);
    return this;
  }

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

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

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

  public long getStartVersion() {
    return this.start_version;
  }

  public TSnapshotRequest setStartVersion(long start_version) {
    this.start_version = start_version;
    setStartVersionIsSet(true);
    return this;
  }

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

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

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

  public long getEndVersion() {
    return this.end_version;
  }

  public TSnapshotRequest setEndVersion(long end_version) {
    this.end_version = end_version;
    setEndVersionIsSet(true);
    return this;
  }

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

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

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

  public boolean isIsCopyBinlog() {
    return this.is_copy_binlog;
  }

  public TSnapshotRequest setIsCopyBinlog(boolean is_copy_binlog) {
    this.is_copy_binlog = is_copy_binlog;
    setIsCopyBinlogIsSet(true);
    return this;
  }

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

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

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

  public long getRefTabletId() {
    return this.ref_tablet_id;
  }

  public TSnapshotRequest setRefTabletId(long ref_tablet_id) {
    this.ref_tablet_id = ref_tablet_id;
    setRefTabletIdIsSet(true);
    return this;
  }

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

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TABLET_ID:
      if (value == null) {
        unsetTabletId();
      } else {
        setTabletId((java.lang.Long)value);
      }
      break;

    case SCHEMA_HASH:
      if (value == null) {
        unsetSchemaHash();
      } else {
        setSchemaHash((java.lang.Integer)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((java.lang.Long)value);
      }
      break;

    case VERSION_HASH:
      if (value == null) {
        unsetVersionHash();
      } else {
        setVersionHash((java.lang.Long)value);
      }
      break;

    case TIMEOUT:
      if (value == null) {
        unsetTimeout();
      } else {
        setTimeout((java.lang.Long)value);
      }
      break;

    case MISSING_VERSION:
      if (value == null) {
        unsetMissingVersion();
      } else {
        setMissingVersion((java.util.List<java.lang.Long>)value);
      }
      break;

    case LIST_FILES:
      if (value == null) {
        unsetListFiles();
      } else {
        setListFiles((java.lang.Boolean)value);
      }
      break;

    case ALLOW_INCREMENTAL_CLONE:
      if (value == null) {
        unsetAllowIncrementalClone();
      } else {
        setAllowIncrementalClone((java.lang.Boolean)value);
      }
      break;

    case PREFERRED_SNAPSHOT_VERSION:
      if (value == null) {
        unsetPreferredSnapshotVersion();
      } else {
        setPreferredSnapshotVersion((java.lang.Integer)value);
      }
      break;

    case IS_COPY_TABLET_TASK:
      if (value == null) {
        unsetIsCopyTabletTask();
      } else {
        setIsCopyTabletTask((java.lang.Boolean)value);
      }
      break;

    case START_VERSION:
      if (value == null) {
        unsetStartVersion();
      } else {
        setStartVersion((java.lang.Long)value);
      }
      break;

    case END_VERSION:
      if (value == null) {
        unsetEndVersion();
      } else {
        setEndVersion((java.lang.Long)value);
      }
      break;

    case IS_COPY_BINLOG:
      if (value == null) {
        unsetIsCopyBinlog();
      } else {
        setIsCopyBinlog((java.lang.Boolean)value);
      }
      break;

    case REF_TABLET_ID:
      if (value == null) {
        unsetRefTabletId();
      } else {
        setRefTabletId((java.lang.Long)value);
      }
      break;

    }
  }

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

    case SCHEMA_HASH:
      return getSchemaHash();

    case VERSION:
      return getVersion();

    case VERSION_HASH:
      return getVersionHash();

    case TIMEOUT:
      return getTimeout();

    case MISSING_VERSION:
      return getMissingVersion();

    case LIST_FILES:
      return isListFiles();

    case ALLOW_INCREMENTAL_CLONE:
      return isAllowIncrementalClone();

    case PREFERRED_SNAPSHOT_VERSION:
      return getPreferredSnapshotVersion();

    case IS_COPY_TABLET_TASK:
      return isIsCopyTabletTask();

    case START_VERSION:
      return getStartVersion();

    case END_VERSION:
      return getEndVersion();

    case IS_COPY_BINLOG:
      return isIsCopyBinlog();

    case REF_TABLET_ID:
      return getRefTabletId();

    }
    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 TABLET_ID:
      return isSetTabletId();
    case SCHEMA_HASH:
      return isSetSchemaHash();
    case VERSION:
      return isSetVersion();
    case VERSION_HASH:
      return isSetVersionHash();
    case TIMEOUT:
      return isSetTimeout();
    case MISSING_VERSION:
      return isSetMissingVersion();
    case LIST_FILES:
      return isSetListFiles();
    case ALLOW_INCREMENTAL_CLONE:
      return isSetAllowIncrementalClone();
    case PREFERRED_SNAPSHOT_VERSION:
      return isSetPreferredSnapshotVersion();
    case IS_COPY_TABLET_TASK:
      return isSetIsCopyTabletTask();
    case START_VERSION:
      return isSetStartVersion();
    case END_VERSION:
      return isSetEndVersion();
    case IS_COPY_BINLOG:
      return isSetIsCopyBinlog();
    case REF_TABLET_ID:
      return isSetRefTabletId();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_tablet_id = true;
    boolean that_present_tablet_id = true;
    if (this_present_tablet_id || that_present_tablet_id) {
      if (!(this_present_tablet_id && that_present_tablet_id))
        return false;
      if (this.tablet_id != that.tablet_id)
        return false;
    }

    boolean this_present_schema_hash = true;
    boolean that_present_schema_hash = true;
    if (this_present_schema_hash || that_present_schema_hash) {
      if (!(this_present_schema_hash && that_present_schema_hash))
        return false;
      if (this.schema_hash != that.schema_hash)
        return false;
    }

    boolean this_present_version = true && this.isSetVersion();
    boolean that_present_version = true && that.isSetVersion();
    if (this_present_version || that_present_version) {
      if (!(this_present_version && that_present_version))
        return false;
      if (this.version != that.version)
        return false;
    }

    boolean this_present_version_hash = true && this.isSetVersionHash();
    boolean that_present_version_hash = true && that.isSetVersionHash();
    if (this_present_version_hash || that_present_version_hash) {
      if (!(this_present_version_hash && that_present_version_hash))
        return false;
      if (this.version_hash != that.version_hash)
        return false;
    }

    boolean this_present_timeout = true && this.isSetTimeout();
    boolean that_present_timeout = true && that.isSetTimeout();
    if (this_present_timeout || that_present_timeout) {
      if (!(this_present_timeout && that_present_timeout))
        return false;
      if (this.timeout != that.timeout)
        return false;
    }

    boolean this_present_missing_version = true && this.isSetMissingVersion();
    boolean that_present_missing_version = true && that.isSetMissingVersion();
    if (this_present_missing_version || that_present_missing_version) {
      if (!(this_present_missing_version && that_present_missing_version))
        return false;
      if (!this.missing_version.equals(that.missing_version))
        return false;
    }

    boolean this_present_list_files = true && this.isSetListFiles();
    boolean that_present_list_files = true && that.isSetListFiles();
    if (this_present_list_files || that_present_list_files) {
      if (!(this_present_list_files && that_present_list_files))
        return false;
      if (this.list_files != that.list_files)
        return false;
    }

    boolean this_present_allow_incremental_clone = true && this.isSetAllowIncrementalClone();
    boolean that_present_allow_incremental_clone = true && that.isSetAllowIncrementalClone();
    if (this_present_allow_incremental_clone || that_present_allow_incremental_clone) {
      if (!(this_present_allow_incremental_clone && that_present_allow_incremental_clone))
        return false;
      if (this.allow_incremental_clone != that.allow_incremental_clone)
        return false;
    }

    boolean this_present_preferred_snapshot_version = true && this.isSetPreferredSnapshotVersion();
    boolean that_present_preferred_snapshot_version = true && that.isSetPreferredSnapshotVersion();
    if (this_present_preferred_snapshot_version || that_present_preferred_snapshot_version) {
      if (!(this_present_preferred_snapshot_version && that_present_preferred_snapshot_version))
        return false;
      if (this.preferred_snapshot_version != that.preferred_snapshot_version)
        return false;
    }

    boolean this_present_is_copy_tablet_task = true && this.isSetIsCopyTabletTask();
    boolean that_present_is_copy_tablet_task = true && that.isSetIsCopyTabletTask();
    if (this_present_is_copy_tablet_task || that_present_is_copy_tablet_task) {
      if (!(this_present_is_copy_tablet_task && that_present_is_copy_tablet_task))
        return false;
      if (this.is_copy_tablet_task != that.is_copy_tablet_task)
        return false;
    }

    boolean this_present_start_version = true && this.isSetStartVersion();
    boolean that_present_start_version = true && that.isSetStartVersion();
    if (this_present_start_version || that_present_start_version) {
      if (!(this_present_start_version && that_present_start_version))
        return false;
      if (this.start_version != that.start_version)
        return false;
    }

    boolean this_present_end_version = true && this.isSetEndVersion();
    boolean that_present_end_version = true && that.isSetEndVersion();
    if (this_present_end_version || that_present_end_version) {
      if (!(this_present_end_version && that_present_end_version))
        return false;
      if (this.end_version != that.end_version)
        return false;
    }

    boolean this_present_is_copy_binlog = true && this.isSetIsCopyBinlog();
    boolean that_present_is_copy_binlog = true && that.isSetIsCopyBinlog();
    if (this_present_is_copy_binlog || that_present_is_copy_binlog) {
      if (!(this_present_is_copy_binlog && that_present_is_copy_binlog))
        return false;
      if (this.is_copy_binlog != that.is_copy_binlog)
        return false;
    }

    boolean this_present_ref_tablet_id = true && this.isSetRefTabletId();
    boolean that_present_ref_tablet_id = true && that.isSetRefTabletId();
    if (this_present_ref_tablet_id || that_present_ref_tablet_id) {
      if (!(this_present_ref_tablet_id && that_present_ref_tablet_id))
        return false;
      if (this.ref_tablet_id != that.ref_tablet_id)
        return false;
    }

    return true;
  }

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

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

    hashCode = hashCode * 8191 + schema_hash;

    hashCode = hashCode * 8191 + ((isSetVersion()) ? 131071 : 524287);
    if (isSetVersion())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(version);

    hashCode = hashCode * 8191 + ((isSetVersionHash()) ? 131071 : 524287);
    if (isSetVersionHash())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(version_hash);

    hashCode = hashCode * 8191 + ((isSetTimeout()) ? 131071 : 524287);
    if (isSetTimeout())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(timeout);

    hashCode = hashCode * 8191 + ((isSetMissingVersion()) ? 131071 : 524287);
    if (isSetMissingVersion())
      hashCode = hashCode * 8191 + missing_version.hashCode();

    hashCode = hashCode * 8191 + ((isSetListFiles()) ? 131071 : 524287);
    if (isSetListFiles())
      hashCode = hashCode * 8191 + ((list_files) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetAllowIncrementalClone()) ? 131071 : 524287);
    if (isSetAllowIncrementalClone())
      hashCode = hashCode * 8191 + ((allow_incremental_clone) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetPreferredSnapshotVersion()) ? 131071 : 524287);
    if (isSetPreferredSnapshotVersion())
      hashCode = hashCode * 8191 + preferred_snapshot_version;

    hashCode = hashCode * 8191 + ((isSetIsCopyTabletTask()) ? 131071 : 524287);
    if (isSetIsCopyTabletTask())
      hashCode = hashCode * 8191 + ((is_copy_tablet_task) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetStartVersion()) ? 131071 : 524287);
    if (isSetStartVersion())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(start_version);

    hashCode = hashCode * 8191 + ((isSetEndVersion()) ? 131071 : 524287);
    if (isSetEndVersion())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(end_version);

    hashCode = hashCode * 8191 + ((isSetIsCopyBinlog()) ? 131071 : 524287);
    if (isSetIsCopyBinlog())
      hashCode = hashCode * 8191 + ((is_copy_binlog) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetRefTabletId()) ? 131071 : 524287);
    if (isSetRefTabletId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(ref_tablet_id);

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetTabletId(), other.isSetTabletId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTabletId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablet_id, other.tablet_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSchemaHash(), other.isSetSchemaHash());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSchemaHash()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schema_hash, other.schema_hash);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetVersion(), other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetVersionHash(), other.isSetVersionHash());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersionHash()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version_hash, other.version_hash);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetTimeout(), other.isSetTimeout());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeout()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeout, other.timeout);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMissingVersion(), other.isSetMissingVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMissingVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.missing_version, other.missing_version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetListFiles(), other.isSetListFiles());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetListFiles()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.list_files, other.list_files);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetAllowIncrementalClone(), other.isSetAllowIncrementalClone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAllowIncrementalClone()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.allow_incremental_clone, other.allow_incremental_clone);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPreferredSnapshotVersion(), other.isSetPreferredSnapshotVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPreferredSnapshotVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.preferred_snapshot_version, other.preferred_snapshot_version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsCopyTabletTask(), other.isSetIsCopyTabletTask());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCopyTabletTask()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_copy_tablet_task, other.is_copy_tablet_task);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStartVersion(), other.isSetStartVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_version, other.start_version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEndVersion(), other.isSetEndVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_version, other.end_version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsCopyBinlog(), other.isSetIsCopyBinlog());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCopyBinlog()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_copy_binlog, other.is_copy_binlog);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRefTabletId(), other.isSetRefTabletId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRefTabletId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref_tablet_id, other.ref_tablet_id);
      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("TSnapshotRequest(");
    boolean first = true;

    sb.append("tablet_id:");
    sb.append(this.tablet_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("schema_hash:");
    sb.append(this.schema_hash);
    first = false;
    if (isSetVersion()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      sb.append(this.version);
      first = false;
    }
    if (isSetVersionHash()) {
      if (!first) sb.append(", ");
      sb.append("version_hash:");
      sb.append(this.version_hash);
      first = false;
    }
    if (isSetTimeout()) {
      if (!first) sb.append(", ");
      sb.append("timeout:");
      sb.append(this.timeout);
      first = false;
    }
    if (isSetMissingVersion()) {
      if (!first) sb.append(", ");
      sb.append("missing_version:");
      if (this.missing_version == null) {
        sb.append("null");
      } else {
        sb.append(this.missing_version);
      }
      first = false;
    }
    if (isSetListFiles()) {
      if (!first) sb.append(", ");
      sb.append("list_files:");
      sb.append(this.list_files);
      first = false;
    }
    if (isSetAllowIncrementalClone()) {
      if (!first) sb.append(", ");
      sb.append("allow_incremental_clone:");
      sb.append(this.allow_incremental_clone);
      first = false;
    }
    if (isSetPreferredSnapshotVersion()) {
      if (!first) sb.append(", ");
      sb.append("preferred_snapshot_version:");
      sb.append(this.preferred_snapshot_version);
      first = false;
    }
    if (isSetIsCopyTabletTask()) {
      if (!first) sb.append(", ");
      sb.append("is_copy_tablet_task:");
      sb.append(this.is_copy_tablet_task);
      first = false;
    }
    if (isSetStartVersion()) {
      if (!first) sb.append(", ");
      sb.append("start_version:");
      sb.append(this.start_version);
      first = false;
    }
    if (isSetEndVersion()) {
      if (!first) sb.append(", ");
      sb.append("end_version:");
      sb.append(this.end_version);
      first = false;
    }
    if (isSetIsCopyBinlog()) {
      if (!first) sb.append(", ");
      sb.append("is_copy_binlog:");
      sb.append(this.is_copy_binlog);
      first = false;
    }
    if (isSetRefTabletId()) {
      if (!first) sb.append(", ");
      sb.append("ref_tablet_id:");
      sb.append(this.ref_tablet_id);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'tablet_id' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'schema_hash' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

  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 TSnapshotRequestStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSnapshotRequestStandardScheme getScheme() {
      return new TSnapshotRequestStandardScheme();
    }
  }

  private static class TSnapshotRequestStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSnapshotRequest> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSnapshotRequest 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: // TABLET_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.tablet_id = iprot.readI64();
              struct.setTabletIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SCHEMA_HASH
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.schema_hash = iprot.readI32();
              struct.setSchemaHashIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.version = iprot.readI64();
              struct.setVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // VERSION_HASH
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.version_hash = iprot.readI64();
              struct.setVersionHashIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TIMEOUT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeout = iprot.readI64();
              struct.setTimeoutIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // MISSING_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list210 = iprot.readListBegin();
                struct.missing_version = new java.util.ArrayList<java.lang.Long>(_list210.size);
                long _elem211;
                for (int _i212 = 0; _i212 < _list210.size; ++_i212)
                {
                  _elem211 = iprot.readI64();
                  struct.missing_version.add(_elem211);
                }
                iprot.readListEnd();
              }
              struct.setMissingVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // LIST_FILES
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.list_files = iprot.readBool();
              struct.setListFilesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // ALLOW_INCREMENTAL_CLONE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.allow_incremental_clone = iprot.readBool();
              struct.setAllowIncrementalCloneIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // PREFERRED_SNAPSHOT_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.preferred_snapshot_version = iprot.readI32();
              struct.setPreferredSnapshotVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // IS_COPY_TABLET_TASK
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_copy_tablet_task = iprot.readBool();
              struct.setIsCopyTabletTaskIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // START_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.start_version = iprot.readI64();
              struct.setStartVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // END_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.end_version = iprot.readI64();
              struct.setEndVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // IS_COPY_BINLOG
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_copy_binlog = iprot.readBool();
              struct.setIsCopyBinlogIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // REF_TABLET_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.ref_tablet_id = iprot.readI64();
              struct.setRefTabletIdIsSet(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.isSetTabletId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'tablet_id' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetSchemaHash()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'schema_hash' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(TABLET_ID_FIELD_DESC);
      oprot.writeI64(struct.tablet_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(SCHEMA_HASH_FIELD_DESC);
      oprot.writeI32(struct.schema_hash);
      oprot.writeFieldEnd();
      if (struct.isSetVersion()) {
        oprot.writeFieldBegin(VERSION_FIELD_DESC);
        oprot.writeI64(struct.version);
        oprot.writeFieldEnd();
      }
      if (struct.isSetVersionHash()) {
        oprot.writeFieldBegin(VERSION_HASH_FIELD_DESC);
        oprot.writeI64(struct.version_hash);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimeout()) {
        oprot.writeFieldBegin(TIMEOUT_FIELD_DESC);
        oprot.writeI64(struct.timeout);
        oprot.writeFieldEnd();
      }
      if (struct.missing_version != null) {
        if (struct.isSetMissingVersion()) {
          oprot.writeFieldBegin(MISSING_VERSION_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.missing_version.size()));
            for (long _iter213 : struct.missing_version)
            {
              oprot.writeI64(_iter213);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetListFiles()) {
        oprot.writeFieldBegin(LIST_FILES_FIELD_DESC);
        oprot.writeBool(struct.list_files);
        oprot.writeFieldEnd();
      }
      if (struct.isSetAllowIncrementalClone()) {
        oprot.writeFieldBegin(ALLOW_INCREMENTAL_CLONE_FIELD_DESC);
        oprot.writeBool(struct.allow_incremental_clone);
        oprot.writeFieldEnd();
      }
      if (struct.isSetPreferredSnapshotVersion()) {
        oprot.writeFieldBegin(PREFERRED_SNAPSHOT_VERSION_FIELD_DESC);
        oprot.writeI32(struct.preferred_snapshot_version);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsCopyTabletTask()) {
        oprot.writeFieldBegin(IS_COPY_TABLET_TASK_FIELD_DESC);
        oprot.writeBool(struct.is_copy_tablet_task);
        oprot.writeFieldEnd();
      }
      if (struct.isSetStartVersion()) {
        oprot.writeFieldBegin(START_VERSION_FIELD_DESC);
        oprot.writeI64(struct.start_version);
        oprot.writeFieldEnd();
      }
      if (struct.isSetEndVersion()) {
        oprot.writeFieldBegin(END_VERSION_FIELD_DESC);
        oprot.writeI64(struct.end_version);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsCopyBinlog()) {
        oprot.writeFieldBegin(IS_COPY_BINLOG_FIELD_DESC);
        oprot.writeBool(struct.is_copy_binlog);
        oprot.writeFieldEnd();
      }
      if (struct.isSetRefTabletId()) {
        oprot.writeFieldBegin(REF_TABLET_ID_FIELD_DESC);
        oprot.writeI64(struct.ref_tablet_id);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSnapshotRequestTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSnapshotRequest> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSnapshotRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.tablet_id);
      oprot.writeI32(struct.schema_hash);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetVersion()) {
        optionals.set(0);
      }
      if (struct.isSetVersionHash()) {
        optionals.set(1);
      }
      if (struct.isSetTimeout()) {
        optionals.set(2);
      }
      if (struct.isSetMissingVersion()) {
        optionals.set(3);
      }
      if (struct.isSetListFiles()) {
        optionals.set(4);
      }
      if (struct.isSetAllowIncrementalClone()) {
        optionals.set(5);
      }
      if (struct.isSetPreferredSnapshotVersion()) {
        optionals.set(6);
      }
      if (struct.isSetIsCopyTabletTask()) {
        optionals.set(7);
      }
      if (struct.isSetStartVersion()) {
        optionals.set(8);
      }
      if (struct.isSetEndVersion()) {
        optionals.set(9);
      }
      if (struct.isSetIsCopyBinlog()) {
        optionals.set(10);
      }
      if (struct.isSetRefTabletId()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetVersion()) {
        oprot.writeI64(struct.version);
      }
      if (struct.isSetVersionHash()) {
        oprot.writeI64(struct.version_hash);
      }
      if (struct.isSetTimeout()) {
        oprot.writeI64(struct.timeout);
      }
      if (struct.isSetMissingVersion()) {
        {
          oprot.writeI32(struct.missing_version.size());
          for (long _iter214 : struct.missing_version)
          {
            oprot.writeI64(_iter214);
          }
        }
      }
      if (struct.isSetListFiles()) {
        oprot.writeBool(struct.list_files);
      }
      if (struct.isSetAllowIncrementalClone()) {
        oprot.writeBool(struct.allow_incremental_clone);
      }
      if (struct.isSetPreferredSnapshotVersion()) {
        oprot.writeI32(struct.preferred_snapshot_version);
      }
      if (struct.isSetIsCopyTabletTask()) {
        oprot.writeBool(struct.is_copy_tablet_task);
      }
      if (struct.isSetStartVersion()) {
        oprot.writeI64(struct.start_version);
      }
      if (struct.isSetEndVersion()) {
        oprot.writeI64(struct.end_version);
      }
      if (struct.isSetIsCopyBinlog()) {
        oprot.writeBool(struct.is_copy_binlog);
      }
      if (struct.isSetRefTabletId()) {
        oprot.writeI64(struct.ref_tablet_id);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSnapshotRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.tablet_id = iprot.readI64();
      struct.setTabletIdIsSet(true);
      struct.schema_hash = iprot.readI32();
      struct.setSchemaHashIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.version = iprot.readI64();
        struct.setVersionIsSet(true);
      }
      if (incoming.get(1)) {
        struct.version_hash = iprot.readI64();
        struct.setVersionHashIsSet(true);
      }
      if (incoming.get(2)) {
        struct.timeout = iprot.readI64();
        struct.setTimeoutIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TList _list215 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.missing_version = new java.util.ArrayList<java.lang.Long>(_list215.size);
          long _elem216;
          for (int _i217 = 0; _i217 < _list215.size; ++_i217)
          {
            _elem216 = iprot.readI64();
            struct.missing_version.add(_elem216);
          }
        }
        struct.setMissingVersionIsSet(true);
      }
      if (incoming.get(4)) {
        struct.list_files = iprot.readBool();
        struct.setListFilesIsSet(true);
      }
      if (incoming.get(5)) {
        struct.allow_incremental_clone = iprot.readBool();
        struct.setAllowIncrementalCloneIsSet(true);
      }
      if (incoming.get(6)) {
        struct.preferred_snapshot_version = iprot.readI32();
        struct.setPreferredSnapshotVersionIsSet(true);
      }
      if (incoming.get(7)) {
        struct.is_copy_tablet_task = iprot.readBool();
        struct.setIsCopyTabletTaskIsSet(true);
      }
      if (incoming.get(8)) {
        struct.start_version = iprot.readI64();
        struct.setStartVersionIsSet(true);
      }
      if (incoming.get(9)) {
        struct.end_version = iprot.readI64();
        struct.setEndVersionIsSet(true);
      }
      if (incoming.get(10)) {
        struct.is_copy_binlog = iprot.readBool();
        struct.setIsCopyBinlogIsSet(true);
      }
      if (incoming.get(11)) {
        struct.ref_tablet_id = iprot.readI64();
        struct.setRefTabletIdIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> 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();
  }
}