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

org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeResponse Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import com.facebook.presto.hive.$internal.org.slf4j.Logger;
import com.facebook.presto.hive.$internal.org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class HeartbeatTxnRangeResponse 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("HeartbeatTxnRangeResponse");

  private static final org.apache.thrift.protocol.TField ABORTED_FIELD_DESC = new org.apache.thrift.protocol.TField("aborted", org.apache.thrift.protocol.TType.SET, (short)1);
  private static final org.apache.thrift.protocol.TField NOSUCH_FIELD_DESC = new org.apache.thrift.protocol.TField("nosuch", org.apache.thrift.protocol.TType.SET, (short)2);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new HeartbeatTxnRangeResponseStandardSchemeFactory());
    schemes.put(TupleScheme.class, new HeartbeatTxnRangeResponseTupleSchemeFactory());
  }

  private Set aborted; // required
  private Set nosuch; // 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 {
    ABORTED((short)1, "aborted"),
    NOSUCH((short)2, "nosuch");

    private static final Map byName = new HashMap();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ABORTED
          return ABORTED;
        case 2: // NOSUCH
          return NOSUCH;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ABORTED, new org.apache.thrift.meta_data.FieldMetaData("aborted", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.NOSUCH, new org.apache.thrift.meta_data.FieldMetaData("nosuch", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HeartbeatTxnRangeResponse.class, metaDataMap);
  }

  public HeartbeatTxnRangeResponse() {
  }

  public HeartbeatTxnRangeResponse(
    Set aborted,
    Set nosuch)
  {
    this();
    this.aborted = aborted;
    this.nosuch = nosuch;
  }

  /**
   * Performs a deep copy on other.
   */
  public HeartbeatTxnRangeResponse(HeartbeatTxnRangeResponse other) {
    if (other.isSetAborted()) {
      Set __this__aborted = new HashSet(other.aborted);
      this.aborted = __this__aborted;
    }
    if (other.isSetNosuch()) {
      Set __this__nosuch = new HashSet(other.nosuch);
      this.nosuch = __this__nosuch;
    }
  }

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

  @Override
  public void clear() {
    this.aborted = null;
    this.nosuch = null;
  }

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

  public java.util.Iterator getAbortedIterator() {
    return (this.aborted == null) ? null : this.aborted.iterator();
  }

  public void addToAborted(long elem) {
    if (this.aborted == null) {
      this.aborted = new HashSet();
    }
    this.aborted.add(elem);
  }

  public Set getAborted() {
    return this.aborted;
  }

  public void setAborted(Set aborted) {
    this.aborted = aborted;
  }

  public void unsetAborted() {
    this.aborted = null;
  }

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

  public void setAbortedIsSet(boolean value) {
    if (!value) {
      this.aborted = null;
    }
  }

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

  public java.util.Iterator getNosuchIterator() {
    return (this.nosuch == null) ? null : this.nosuch.iterator();
  }

  public void addToNosuch(long elem) {
    if (this.nosuch == null) {
      this.nosuch = new HashSet();
    }
    this.nosuch.add(elem);
  }

  public Set getNosuch() {
    return this.nosuch;
  }

  public void setNosuch(Set nosuch) {
    this.nosuch = nosuch;
  }

  public void unsetNosuch() {
    this.nosuch = null;
  }

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

  public void setNosuchIsSet(boolean value) {
    if (!value) {
      this.nosuch = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ABORTED:
      if (value == null) {
        unsetAborted();
      } else {
        setAborted((Set)value);
      }
      break;

    case NOSUCH:
      if (value == null) {
        unsetNosuch();
      } else {
        setNosuch((Set)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ABORTED:
      return getAborted();

    case NOSUCH:
      return getNosuch();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case ABORTED:
      return isSetAborted();
    case NOSUCH:
      return isSetNosuch();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof HeartbeatTxnRangeResponse)
      return this.equals((HeartbeatTxnRangeResponse)that);
    return false;
  }

  public boolean equals(HeartbeatTxnRangeResponse that) {
    if (that == null)
      return false;

    boolean this_present_aborted = true && this.isSetAborted();
    boolean that_present_aborted = true && that.isSetAborted();
    if (this_present_aborted || that_present_aborted) {
      if (!(this_present_aborted && that_present_aborted))
        return false;
      if (!this.aborted.equals(that.aborted))
        return false;
    }

    boolean this_present_nosuch = true && this.isSetNosuch();
    boolean that_present_nosuch = true && that.isSetNosuch();
    if (this_present_nosuch || that_present_nosuch) {
      if (!(this_present_nosuch && that_present_nosuch))
        return false;
      if (!this.nosuch.equals(that.nosuch))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_aborted = true && (isSetAborted());
    list.add(present_aborted);
    if (present_aborted)
      list.add(aborted);

    boolean present_nosuch = true && (isSetNosuch());
    list.add(present_nosuch);
    if (present_nosuch)
      list.add(nosuch);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetAborted()).compareTo(other.isSetAborted());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAborted()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aborted, other.aborted);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNosuch()).compareTo(other.isSetNosuch());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNosuch()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nosuch, other.nosuch);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("HeartbeatTxnRangeResponse(");
    boolean first = true;

    sb.append("aborted:");
    if (this.aborted == null) {
      sb.append("null");
    } else {
      sb.append(this.aborted);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("nosuch:");
    if (this.nosuch == null) {
      sb.append("null");
    } else {
      sb.append(this.nosuch);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetAborted()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'aborted' is unset! Struct:" + toString());
    }

    if (!isSetNosuch()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'nosuch' is unset! Struct:" + toString());
    }

    // 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, ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class HeartbeatTxnRangeResponseStandardSchemeFactory implements SchemeFactory {
    public HeartbeatTxnRangeResponseStandardScheme getScheme() {
      return new HeartbeatTxnRangeResponseStandardScheme();
    }
  }

  private static class HeartbeatTxnRangeResponseStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, HeartbeatTxnRangeResponse 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: // ABORTED
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set666 = iprot.readSetBegin();
                struct.aborted = new HashSet(2*_set666.size);
                long _elem667;
                for (int _i668 = 0; _i668 < _set666.size; ++_i668)
                {
                  _elem667 = iprot.readI64();
                  struct.aborted.add(_elem667);
                }
                iprot.readSetEnd();
              }
              struct.setAbortedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NOSUCH
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set669 = iprot.readSetBegin();
                struct.nosuch = new HashSet(2*_set669.size);
                long _elem670;
                for (int _i671 = 0; _i671 < _set669.size; ++_i671)
                {
                  _elem670 = iprot.readI64();
                  struct.nosuch.add(_elem670);
                }
                iprot.readSetEnd();
              }
              struct.setNosuchIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.aborted != null) {
        oprot.writeFieldBegin(ABORTED_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.aborted.size()));
          for (long _iter672 : struct.aborted)
          {
            oprot.writeI64(_iter672);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.nosuch != null) {
        oprot.writeFieldBegin(NOSUCH_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.nosuch.size()));
          for (long _iter673 : struct.nosuch)
          {
            oprot.writeI64(_iter673);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class HeartbeatTxnRangeResponseTupleSchemeFactory implements SchemeFactory {
    public HeartbeatTxnRangeResponseTupleScheme getScheme() {
      return new HeartbeatTxnRangeResponseTupleScheme();
    }
  }

  private static class HeartbeatTxnRangeResponseTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, HeartbeatTxnRangeResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      {
        oprot.writeI32(struct.aborted.size());
        for (long _iter674 : struct.aborted)
        {
          oprot.writeI64(_iter674);
        }
      }
      {
        oprot.writeI32(struct.nosuch.size());
        for (long _iter675 : struct.nosuch)
        {
          oprot.writeI64(_iter675);
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, HeartbeatTxnRangeResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TSet _set676 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, iprot.readI32());
        struct.aborted = new HashSet(2*_set676.size);
        long _elem677;
        for (int _i678 = 0; _i678 < _set676.size; ++_i678)
        {
          _elem677 = iprot.readI64();
          struct.aborted.add(_elem677);
        }
      }
      struct.setAbortedIsSet(true);
      {
        org.apache.thrift.protocol.TSet _set679 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, iprot.readI32());
        struct.nosuch = new HashSet(2*_set679.size);
        long _elem680;
        for (int _i681 = 0; _i681 < _set679.size; ++_i681)
        {
          _elem680 = iprot.readI64();
          struct.nosuch.add(_elem680);
        }
      }
      struct.setNosuchIsSet(true);
    }
  }

}