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

com.xiaomi.infra.galaxy.sds.thrift.StreamStatus Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaomi.infra.galaxy.sds.thrift;

import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;

import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-2")
public class StreamStatus implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("StreamStatus");

  private static final libthrift091.protocol.TField CREATE_TIMESTAMP_FIELD_DESC = new libthrift091.protocol.TField("createTimestamp", libthrift091.protocol.TType.I64, (short)1);
  private static final libthrift091.protocol.TField STREAM_STATE_FIELD_DESC = new libthrift091.protocol.TField("streamState", libthrift091.protocol.TType.I32, (short)2);
  private static final libthrift091.protocol.TField MESSAGE_NUMBER_FIELD_DESC = new libthrift091.protocol.TField("messageNumber", libthrift091.protocol.TType.I64, (short)3);
  private static final libthrift091.protocol.TField MESSAGE_BYTES_FIELD_DESC = new libthrift091.protocol.TField("messageBytes", libthrift091.protocol.TType.I64, (short)4);
  private static final libthrift091.protocol.TField PARTITION_STATES_FIELD_DESC = new libthrift091.protocol.TField("partitionStates", libthrift091.protocol.TType.LIST, (short)5);

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

  /**
   * Create Timestamp for this stream
   * 
   */
  public long createTimestamp; // optional
  /**
   * Stream state
   * 
   * 
   * @see StreamState
   */
  public StreamState streamState; // optional
  /**
   * The message number in this stream(include all partitions)
   * 
   */
  public long messageNumber; // optional
  /**
   * The message bytes in this stream(include all partitions)
   * 
   */
  public long messageBytes; // optional
  /**
   * All partition state for this partition
   * 
   */
  public List partitionStates; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements libthrift091.TFieldIdEnum {
    /**
     * Create Timestamp for this stream
     * 
     */
    CREATE_TIMESTAMP((short)1, "createTimestamp"),
    /**
     * Stream state
     * 
     * 
     * @see StreamState
     */
    STREAM_STATE((short)2, "streamState"),
    /**
     * The message number in this stream(include all partitions)
     * 
     */
    MESSAGE_NUMBER((short)3, "messageNumber"),
    /**
     * The message bytes in this stream(include all partitions)
     * 
     */
    MESSAGE_BYTES((short)4, "messageBytes"),
    /**
     * All partition state for this partition
     * 
     */
    PARTITION_STATES((short)5, "partitionStates");

    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: // CREATE_TIMESTAMP
          return CREATE_TIMESTAMP;
        case 2: // STREAM_STATE
          return STREAM_STATE;
        case 3: // MESSAGE_NUMBER
          return MESSAGE_NUMBER;
        case 4: // MESSAGE_BYTES
          return MESSAGE_BYTES;
        case 5: // PARTITION_STATES
          return PARTITION_STATES;
        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
  private static final int __CREATETIMESTAMP_ISSET_ID = 0;
  private static final int __MESSAGENUMBER_ISSET_ID = 1;
  private static final int __MESSAGEBYTES_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.CREATE_TIMESTAMP,_Fields.STREAM_STATE,_Fields.MESSAGE_NUMBER,_Fields.MESSAGE_BYTES,_Fields.PARTITION_STATES};
  public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.CREATE_TIMESTAMP, new libthrift091.meta_data.FieldMetaData("createTimestamp", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I64)));
    tmpMap.put(_Fields.STREAM_STATE, new libthrift091.meta_data.FieldMetaData("streamState", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, StreamState.class)));
    tmpMap.put(_Fields.MESSAGE_NUMBER, new libthrift091.meta_data.FieldMetaData("messageNumber", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I64)));
    tmpMap.put(_Fields.MESSAGE_BYTES, new libthrift091.meta_data.FieldMetaData("messageBytes", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I64)));
    tmpMap.put(_Fields.PARTITION_STATES, new libthrift091.meta_data.FieldMetaData("partitionStates", libthrift091.TFieldRequirementType.OPTIONAL, 
        new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST, 
            new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, PartitionState.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(StreamStatus.class, metaDataMap);
  }

  public StreamStatus() {
  }

  /**
   * Performs a deep copy on other.
   */
  public StreamStatus(StreamStatus other) {
    __isset_bitfield = other.__isset_bitfield;
    this.createTimestamp = other.createTimestamp;
    if (other.isSetStreamState()) {
      this.streamState = other.streamState;
    }
    this.messageNumber = other.messageNumber;
    this.messageBytes = other.messageBytes;
    if (other.isSetPartitionStates()) {
      List __this__partitionStates = new ArrayList(other.partitionStates.size());
      for (PartitionState other_element : other.partitionStates) {
        __this__partitionStates.add(new PartitionState(other_element));
      }
      this.partitionStates = __this__partitionStates;
    }
  }

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

  @Override
  public void clear() {
    setCreateTimestampIsSet(false);
    this.createTimestamp = 0;
    this.streamState = null;
    setMessageNumberIsSet(false);
    this.messageNumber = 0;
    setMessageBytesIsSet(false);
    this.messageBytes = 0;
    this.partitionStates = null;
  }

  /**
   * Create Timestamp for this stream
   * 
   */
  public long getCreateTimestamp() {
    return this.createTimestamp;
  }

  /**
   * Create Timestamp for this stream
   * 
   */
  public StreamStatus setCreateTimestamp(long createTimestamp) {
    this.createTimestamp = createTimestamp;
    setCreateTimestampIsSet(true);
    return this;
  }

  public void unsetCreateTimestamp() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIMESTAMP_ISSET_ID);
  }

  /** Returns true if field createTimestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetCreateTimestamp() {
    return EncodingUtils.testBit(__isset_bitfield, __CREATETIMESTAMP_ISSET_ID);
  }

  public void setCreateTimestampIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIMESTAMP_ISSET_ID, value);
  }

  /**
   * Stream state
   * 
   * 
   * @see StreamState
   */
  public StreamState getStreamState() {
    return this.streamState;
  }

  /**
   * Stream state
   * 
   * 
   * @see StreamState
   */
  public StreamStatus setStreamState(StreamState streamState) {
    this.streamState = streamState;
    return this;
  }

  public void unsetStreamState() {
    this.streamState = null;
  }

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

  public void setStreamStateIsSet(boolean value) {
    if (!value) {
      this.streamState = null;
    }
  }

  /**
   * The message number in this stream(include all partitions)
   * 
   */
  public long getMessageNumber() {
    return this.messageNumber;
  }

  /**
   * The message number in this stream(include all partitions)
   * 
   */
  public StreamStatus setMessageNumber(long messageNumber) {
    this.messageNumber = messageNumber;
    setMessageNumberIsSet(true);
    return this;
  }

  public void unsetMessageNumber() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MESSAGENUMBER_ISSET_ID);
  }

  /** Returns true if field messageNumber is set (has been assigned a value) and false otherwise */
  public boolean isSetMessageNumber() {
    return EncodingUtils.testBit(__isset_bitfield, __MESSAGENUMBER_ISSET_ID);
  }

  public void setMessageNumberIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MESSAGENUMBER_ISSET_ID, value);
  }

  /**
   * The message bytes in this stream(include all partitions)
   * 
   */
  public long getMessageBytes() {
    return this.messageBytes;
  }

  /**
   * The message bytes in this stream(include all partitions)
   * 
   */
  public StreamStatus setMessageBytes(long messageBytes) {
    this.messageBytes = messageBytes;
    setMessageBytesIsSet(true);
    return this;
  }

  public void unsetMessageBytes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MESSAGEBYTES_ISSET_ID);
  }

  /** Returns true if field messageBytes is set (has been assigned a value) and false otherwise */
  public boolean isSetMessageBytes() {
    return EncodingUtils.testBit(__isset_bitfield, __MESSAGEBYTES_ISSET_ID);
  }

  public void setMessageBytesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MESSAGEBYTES_ISSET_ID, value);
  }

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

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

  public void addToPartitionStates(PartitionState elem) {
    if (this.partitionStates == null) {
      this.partitionStates = new ArrayList();
    }
    this.partitionStates.add(elem);
  }

  /**
   * All partition state for this partition
   * 
   */
  public List getPartitionStates() {
    return this.partitionStates;
  }

  /**
   * All partition state for this partition
   * 
   */
  public StreamStatus setPartitionStates(List partitionStates) {
    this.partitionStates = partitionStates;
    return this;
  }

  public void unsetPartitionStates() {
    this.partitionStates = null;
  }

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

  public void setPartitionStatesIsSet(boolean value) {
    if (!value) {
      this.partitionStates = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CREATE_TIMESTAMP:
      if (value == null) {
        unsetCreateTimestamp();
      } else {
        setCreateTimestamp((Long)value);
      }
      break;

    case STREAM_STATE:
      if (value == null) {
        unsetStreamState();
      } else {
        setStreamState((StreamState)value);
      }
      break;

    case MESSAGE_NUMBER:
      if (value == null) {
        unsetMessageNumber();
      } else {
        setMessageNumber((Long)value);
      }
      break;

    case MESSAGE_BYTES:
      if (value == null) {
        unsetMessageBytes();
      } else {
        setMessageBytes((Long)value);
      }
      break;

    case PARTITION_STATES:
      if (value == null) {
        unsetPartitionStates();
      } else {
        setPartitionStates((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case CREATE_TIMESTAMP:
      return Long.valueOf(getCreateTimestamp());

    case STREAM_STATE:
      return getStreamState();

    case MESSAGE_NUMBER:
      return Long.valueOf(getMessageNumber());

    case MESSAGE_BYTES:
      return Long.valueOf(getMessageBytes());

    case PARTITION_STATES:
      return getPartitionStates();

    }
    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 CREATE_TIMESTAMP:
      return isSetCreateTimestamp();
    case STREAM_STATE:
      return isSetStreamState();
    case MESSAGE_NUMBER:
      return isSetMessageNumber();
    case MESSAGE_BYTES:
      return isSetMessageBytes();
    case PARTITION_STATES:
      return isSetPartitionStates();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_createTimestamp = true && this.isSetCreateTimestamp();
    boolean that_present_createTimestamp = true && that.isSetCreateTimestamp();
    if (this_present_createTimestamp || that_present_createTimestamp) {
      if (!(this_present_createTimestamp && that_present_createTimestamp))
        return false;
      if (this.createTimestamp != that.createTimestamp)
        return false;
    }

    boolean this_present_streamState = true && this.isSetStreamState();
    boolean that_present_streamState = true && that.isSetStreamState();
    if (this_present_streamState || that_present_streamState) {
      if (!(this_present_streamState && that_present_streamState))
        return false;
      if (!this.streamState.equals(that.streamState))
        return false;
    }

    boolean this_present_messageNumber = true && this.isSetMessageNumber();
    boolean that_present_messageNumber = true && that.isSetMessageNumber();
    if (this_present_messageNumber || that_present_messageNumber) {
      if (!(this_present_messageNumber && that_present_messageNumber))
        return false;
      if (this.messageNumber != that.messageNumber)
        return false;
    }

    boolean this_present_messageBytes = true && this.isSetMessageBytes();
    boolean that_present_messageBytes = true && that.isSetMessageBytes();
    if (this_present_messageBytes || that_present_messageBytes) {
      if (!(this_present_messageBytes && that_present_messageBytes))
        return false;
      if (this.messageBytes != that.messageBytes)
        return false;
    }

    boolean this_present_partitionStates = true && this.isSetPartitionStates();
    boolean that_present_partitionStates = true && that.isSetPartitionStates();
    if (this_present_partitionStates || that_present_partitionStates) {
      if (!(this_present_partitionStates && that_present_partitionStates))
        return false;
      if (!this.partitionStates.equals(that.partitionStates))
        return false;
    }

    return true;
  }

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

    boolean present_createTimestamp = true && (isSetCreateTimestamp());
    list.add(present_createTimestamp);
    if (present_createTimestamp)
      list.add(createTimestamp);

    boolean present_streamState = true && (isSetStreamState());
    list.add(present_streamState);
    if (present_streamState)
      list.add(streamState.getValue());

    boolean present_messageNumber = true && (isSetMessageNumber());
    list.add(present_messageNumber);
    if (present_messageNumber)
      list.add(messageNumber);

    boolean present_messageBytes = true && (isSetMessageBytes());
    list.add(present_messageBytes);
    if (present_messageBytes)
      list.add(messageBytes);

    boolean present_partitionStates = true && (isSetPartitionStates());
    list.add(present_partitionStates);
    if (present_partitionStates)
      list.add(partitionStates);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetCreateTimestamp()).compareTo(other.isSetCreateTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreateTimestamp()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.createTimestamp, other.createTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStreamState()).compareTo(other.isSetStreamState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStreamState()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.streamState, other.streamState);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMessageNumber()).compareTo(other.isSetMessageNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessageNumber()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.messageNumber, other.messageNumber);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMessageBytes()).compareTo(other.isSetMessageBytes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessageBytes()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.messageBytes, other.messageBytes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPartitionStates()).compareTo(other.isSetPartitionStates());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartitionStates()) {
      lastComparison = libthrift091.TBaseHelper.compareTo(this.partitionStates, other.partitionStates);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

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

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

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

    if (isSetCreateTimestamp()) {
      sb.append("createTimestamp:");
      sb.append(this.createTimestamp);
      first = false;
    }
    if (isSetStreamState()) {
      if (!first) sb.append(", ");
      sb.append("streamState:");
      if (this.streamState == null) {
        sb.append("null");
      } else {
        sb.append(this.streamState);
      }
      first = false;
    }
    if (isSetMessageNumber()) {
      if (!first) sb.append(", ");
      sb.append("messageNumber:");
      sb.append(this.messageNumber);
      first = false;
    }
    if (isSetMessageBytes()) {
      if (!first) sb.append(", ");
      sb.append("messageBytes:");
      sb.append(this.messageBytes);
      first = false;
    }
    if (isSetPartitionStates()) {
      if (!first) sb.append(", ");
      sb.append("partitionStates:");
      if (this.partitionStates == null) {
        sb.append("null");
      } else {
        sb.append(this.partitionStates);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws libthrift091.TException {
    // check for required fields
    // check for sub-struct validity
  }

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, 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 libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
    } catch (libthrift091.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class StreamStatusStandardSchemeFactory implements SchemeFactory {
    public StreamStatusStandardScheme getScheme() {
      return new StreamStatusStandardScheme();
    }
  }

  private static class StreamStatusStandardScheme extends StandardScheme {

    public void read(libthrift091.protocol.TProtocol iprot, StreamStatus struct) throws libthrift091.TException {
      libthrift091.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == libthrift091.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // CREATE_TIMESTAMP
            if (schemeField.type == libthrift091.protocol.TType.I64) {
              struct.createTimestamp = iprot.readI64();
              struct.setCreateTimestampIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STREAM_STATE
            if (schemeField.type == libthrift091.protocol.TType.I32) {
              struct.streamState = com.xiaomi.infra.galaxy.sds.thrift.StreamState.findByValue(iprot.readI32());
              struct.setStreamStateIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // MESSAGE_NUMBER
            if (schemeField.type == libthrift091.protocol.TType.I64) {
              struct.messageNumber = iprot.readI64();
              struct.setMessageNumberIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // MESSAGE_BYTES
            if (schemeField.type == libthrift091.protocol.TType.I64) {
              struct.messageBytes = iprot.readI64();
              struct.setMessageBytesIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // PARTITION_STATES
            if (schemeField.type == libthrift091.protocol.TType.LIST) {
              {
                libthrift091.protocol.TList _list96 = iprot.readListBegin();
                struct.partitionStates = new ArrayList(_list96.size);
                PartitionState _elem97;
                for (int _i98 = 0; _i98 < _list96.size; ++_i98)
                {
                  _elem97 = new PartitionState();
                  _elem97.read(iprot);
                  struct.partitionStates.add(_elem97);
                }
                iprot.readListEnd();
              }
              struct.setPartitionStatesIsSet(true);
            } else { 
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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

    public void write(libthrift091.protocol.TProtocol oprot, StreamStatus struct) throws libthrift091.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetCreateTimestamp()) {
        oprot.writeFieldBegin(CREATE_TIMESTAMP_FIELD_DESC);
        oprot.writeI64(struct.createTimestamp);
        oprot.writeFieldEnd();
      }
      if (struct.streamState != null) {
        if (struct.isSetStreamState()) {
          oprot.writeFieldBegin(STREAM_STATE_FIELD_DESC);
          oprot.writeI32(struct.streamState.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetMessageNumber()) {
        oprot.writeFieldBegin(MESSAGE_NUMBER_FIELD_DESC);
        oprot.writeI64(struct.messageNumber);
        oprot.writeFieldEnd();
      }
      if (struct.isSetMessageBytes()) {
        oprot.writeFieldBegin(MESSAGE_BYTES_FIELD_DESC);
        oprot.writeI64(struct.messageBytes);
        oprot.writeFieldEnd();
      }
      if (struct.partitionStates != null) {
        if (struct.isSetPartitionStates()) {
          oprot.writeFieldBegin(PARTITION_STATES_FIELD_DESC);
          {
            oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, struct.partitionStates.size()));
            for (PartitionState _iter99 : struct.partitionStates)
            {
              _iter99.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class StreamStatusTupleSchemeFactory implements SchemeFactory {
    public StreamStatusTupleScheme getScheme() {
      return new StreamStatusTupleScheme();
    }
  }

  private static class StreamStatusTupleScheme extends TupleScheme {

    @Override
    public void write(libthrift091.protocol.TProtocol prot, StreamStatus struct) throws libthrift091.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetCreateTimestamp()) {
        optionals.set(0);
      }
      if (struct.isSetStreamState()) {
        optionals.set(1);
      }
      if (struct.isSetMessageNumber()) {
        optionals.set(2);
      }
      if (struct.isSetMessageBytes()) {
        optionals.set(3);
      }
      if (struct.isSetPartitionStates()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetCreateTimestamp()) {
        oprot.writeI64(struct.createTimestamp);
      }
      if (struct.isSetStreamState()) {
        oprot.writeI32(struct.streamState.getValue());
      }
      if (struct.isSetMessageNumber()) {
        oprot.writeI64(struct.messageNumber);
      }
      if (struct.isSetMessageBytes()) {
        oprot.writeI64(struct.messageBytes);
      }
      if (struct.isSetPartitionStates()) {
        {
          oprot.writeI32(struct.partitionStates.size());
          for (PartitionState _iter100 : struct.partitionStates)
          {
            _iter100.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(libthrift091.protocol.TProtocol prot, StreamStatus struct) throws libthrift091.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.createTimestamp = iprot.readI64();
        struct.setCreateTimestampIsSet(true);
      }
      if (incoming.get(1)) {
        struct.streamState = com.xiaomi.infra.galaxy.sds.thrift.StreamState.findByValue(iprot.readI32());
        struct.setStreamStateIsSet(true);
      }
      if (incoming.get(2)) {
        struct.messageNumber = iprot.readI64();
        struct.setMessageNumberIsSet(true);
      }
      if (incoming.get(3)) {
        struct.messageBytes = iprot.readI64();
        struct.setMessageBytesIsSet(true);
      }
      if (incoming.get(4)) {
        {
          libthrift091.protocol.TList _list101 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, iprot.readI32());
          struct.partitionStates = new ArrayList(_list101.size);
          PartitionState _elem102;
          for (int _i103 = 0; _i103 < _list101.size; ++_i103)
          {
            _elem102 = new PartitionState();
            _elem102.read(iprot);
            struct.partitionStates.add(_elem102);
          }
        }
        struct.setPartitionStatesIsSet(true);
      }
    }
  }

}