
org.apache.iotdb.cluster.rpc.thrift.HeartBeatResponse Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.14.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.iotdb.cluster.rpc.thrift;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2022-07-31")
public class HeartBeatResponse 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("HeartBeatResponse");
private static final org.apache.thrift.protocol.TField TERM_FIELD_DESC = new org.apache.thrift.protocol.TField("term", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField LAST_LOG_INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("lastLogIndex", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField LAST_LOG_TERM_FIELD_DESC = new org.apache.thrift.protocol.TField("lastLogTerm", org.apache.thrift.protocol.TType.I64, (short)3);
private static final org.apache.thrift.protocol.TField FOLLOWER_FIELD_DESC = new org.apache.thrift.protocol.TField("follower", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final org.apache.thrift.protocol.TField FOLLOWER_IDENTIFIER_FIELD_DESC = new org.apache.thrift.protocol.TField("followerIdentifier", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField REQUIRE_PARTITION_TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("requirePartitionTable", org.apache.thrift.protocol.TType.BOOL, (short)6);
private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRUCT, (short)7);
private static final org.apache.thrift.protocol.TField INSTALLING_SNAPSHOT_FIELD_DESC = new org.apache.thrift.protocol.TField("installingSnapshot", org.apache.thrift.protocol.TType.BOOL, (short)8);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new HeartBeatResponseStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new HeartBeatResponseTupleSchemeFactory();
public long term; // required
public long lastLogIndex; // optional
public long lastLogTerm; // optional
public @org.apache.thrift.annotation.Nullable Node follower; // optional
public int followerIdentifier; // optional
public boolean requirePartitionTable; // required
public @org.apache.thrift.annotation.Nullable Node header; // optional
public boolean installingSnapshot; // 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 {
TERM((short)1, "term"),
LAST_LOG_INDEX((short)2, "lastLogIndex"),
LAST_LOG_TERM((short)3, "lastLogTerm"),
FOLLOWER((short)4, "follower"),
FOLLOWER_IDENTIFIER((short)5, "followerIdentifier"),
REQUIRE_PARTITION_TABLE((short)6, "requirePartitionTable"),
HEADER((short)7, "header"),
INSTALLING_SNAPSHOT((short)8, "installingSnapshot");
private static final java.util.Map byName = new java.util.HashMap();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TERM
return TERM;
case 2: // LAST_LOG_INDEX
return LAST_LOG_INDEX;
case 3: // LAST_LOG_TERM
return LAST_LOG_TERM;
case 4: // FOLLOWER
return FOLLOWER;
case 5: // FOLLOWER_IDENTIFIER
return FOLLOWER_IDENTIFIER;
case 6: // REQUIRE_PARTITION_TABLE
return REQUIRE_PARTITION_TABLE;
case 7: // HEADER
return HEADER;
case 8: // INSTALLING_SNAPSHOT
return INSTALLING_SNAPSHOT;
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 __TERM_ISSET_ID = 0;
private static final int __LASTLOGINDEX_ISSET_ID = 1;
private static final int __LASTLOGTERM_ISSET_ID = 2;
private static final int __FOLLOWERIDENTIFIER_ISSET_ID = 3;
private static final int __REQUIREPARTITIONTABLE_ISSET_ID = 4;
private static final int __INSTALLINGSNAPSHOT_ISSET_ID = 5;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.LAST_LOG_INDEX,_Fields.LAST_LOG_TERM,_Fields.FOLLOWER,_Fields.FOLLOWER_IDENTIFIER,_Fields.HEADER};
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.TERM, new org.apache.thrift.meta_data.FieldMetaData("term", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "long")));
tmpMap.put(_Fields.LAST_LOG_INDEX, new org.apache.thrift.meta_data.FieldMetaData("lastLogIndex", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "long")));
tmpMap.put(_Fields.LAST_LOG_TERM, new org.apache.thrift.meta_data.FieldMetaData("lastLogTerm", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "long")));
tmpMap.put(_Fields.FOLLOWER, new org.apache.thrift.meta_data.FieldMetaData("follower", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "Node")));
tmpMap.put(_Fields.FOLLOWER_IDENTIFIER, new org.apache.thrift.meta_data.FieldMetaData("followerIdentifier", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "int")));
tmpMap.put(_Fields.REQUIRE_PARTITION_TABLE, new org.apache.thrift.meta_data.FieldMetaData("requirePartitionTable", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "Node")));
tmpMap.put(_Fields.INSTALLING_SNAPSHOT, new org.apache.thrift.meta_data.FieldMetaData("installingSnapshot", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HeartBeatResponse.class, metaDataMap);
}
public HeartBeatResponse() {
}
public HeartBeatResponse(
long term,
boolean requirePartitionTable,
boolean installingSnapshot)
{
this();
this.term = term;
setTermIsSet(true);
this.requirePartitionTable = requirePartitionTable;
setRequirePartitionTableIsSet(true);
this.installingSnapshot = installingSnapshot;
setInstallingSnapshotIsSet(true);
}
/**
* Performs a deep copy on other.
*/
public HeartBeatResponse(HeartBeatResponse other) {
__isset_bitfield = other.__isset_bitfield;
this.term = other.term;
this.lastLogIndex = other.lastLogIndex;
this.lastLogTerm = other.lastLogTerm;
if (other.isSetFollower()) {
this.follower = new Node(other.follower);
}
this.followerIdentifier = other.followerIdentifier;
this.requirePartitionTable = other.requirePartitionTable;
if (other.isSetHeader()) {
this.header = new Node(other.header);
}
this.installingSnapshot = other.installingSnapshot;
}
public HeartBeatResponse deepCopy() {
return new HeartBeatResponse(this);
}
@Override
public void clear() {
setTermIsSet(false);
this.term = 0;
setLastLogIndexIsSet(false);
this.lastLogIndex = 0;
setLastLogTermIsSet(false);
this.lastLogTerm = 0;
this.follower = null;
setFollowerIdentifierIsSet(false);
this.followerIdentifier = 0;
setRequirePartitionTableIsSet(false);
this.requirePartitionTable = false;
this.header = null;
setInstallingSnapshotIsSet(false);
this.installingSnapshot = false;
}
public long getTerm() {
return this.term;
}
public HeartBeatResponse setTerm(long term) {
this.term = term;
setTermIsSet(true);
return this;
}
public void unsetTerm() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TERM_ISSET_ID);
}
/** Returns true if field term is set (has been assigned a value) and false otherwise */
public boolean isSetTerm() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TERM_ISSET_ID);
}
public void setTermIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __TERM_ISSET_ID, value);
}
public long getLastLogIndex() {
return this.lastLogIndex;
}
public HeartBeatResponse setLastLogIndex(long lastLogIndex) {
this.lastLogIndex = lastLogIndex;
setLastLogIndexIsSet(true);
return this;
}
public void unsetLastLogIndex() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LASTLOGINDEX_ISSET_ID);
}
/** Returns true if field lastLogIndex is set (has been assigned a value) and false otherwise */
public boolean isSetLastLogIndex() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LASTLOGINDEX_ISSET_ID);
}
public void setLastLogIndexIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LASTLOGINDEX_ISSET_ID, value);
}
public long getLastLogTerm() {
return this.lastLogTerm;
}
public HeartBeatResponse setLastLogTerm(long lastLogTerm) {
this.lastLogTerm = lastLogTerm;
setLastLogTermIsSet(true);
return this;
}
public void unsetLastLogTerm() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LASTLOGTERM_ISSET_ID);
}
/** Returns true if field lastLogTerm is set (has been assigned a value) and false otherwise */
public boolean isSetLastLogTerm() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LASTLOGTERM_ISSET_ID);
}
public void setLastLogTermIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LASTLOGTERM_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public Node getFollower() {
return this.follower;
}
public HeartBeatResponse setFollower(@org.apache.thrift.annotation.Nullable Node follower) {
this.follower = follower;
return this;
}
public void unsetFollower() {
this.follower = null;
}
/** Returns true if field follower is set (has been assigned a value) and false otherwise */
public boolean isSetFollower() {
return this.follower != null;
}
public void setFollowerIsSet(boolean value) {
if (!value) {
this.follower = null;
}
}
public int getFollowerIdentifier() {
return this.followerIdentifier;
}
public HeartBeatResponse setFollowerIdentifier(int followerIdentifier) {
this.followerIdentifier = followerIdentifier;
setFollowerIdentifierIsSet(true);
return this;
}
public void unsetFollowerIdentifier() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __FOLLOWERIDENTIFIER_ISSET_ID);
}
/** Returns true if field followerIdentifier is set (has been assigned a value) and false otherwise */
public boolean isSetFollowerIdentifier() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __FOLLOWERIDENTIFIER_ISSET_ID);
}
public void setFollowerIdentifierIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __FOLLOWERIDENTIFIER_ISSET_ID, value);
}
public boolean isRequirePartitionTable() {
return this.requirePartitionTable;
}
public HeartBeatResponse setRequirePartitionTable(boolean requirePartitionTable) {
this.requirePartitionTable = requirePartitionTable;
setRequirePartitionTableIsSet(true);
return this;
}
public void unsetRequirePartitionTable() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __REQUIREPARTITIONTABLE_ISSET_ID);
}
/** Returns true if field requirePartitionTable is set (has been assigned a value) and false otherwise */
public boolean isSetRequirePartitionTable() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __REQUIREPARTITIONTABLE_ISSET_ID);
}
public void setRequirePartitionTableIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __REQUIREPARTITIONTABLE_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public Node getHeader() {
return this.header;
}
public HeartBeatResponse setHeader(@org.apache.thrift.annotation.Nullable Node header) {
this.header = header;
return this;
}
public void unsetHeader() {
this.header = null;
}
/** Returns true if field header is set (has been assigned a value) and false otherwise */
public boolean isSetHeader() {
return this.header != null;
}
public void setHeaderIsSet(boolean value) {
if (!value) {
this.header = null;
}
}
public boolean isInstallingSnapshot() {
return this.installingSnapshot;
}
public HeartBeatResponse setInstallingSnapshot(boolean installingSnapshot) {
this.installingSnapshot = installingSnapshot;
setInstallingSnapshotIsSet(true);
return this;
}
public void unsetInstallingSnapshot() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INSTALLINGSNAPSHOT_ISSET_ID);
}
/** Returns true if field installingSnapshot is set (has been assigned a value) and false otherwise */
public boolean isSetInstallingSnapshot() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INSTALLINGSNAPSHOT_ISSET_ID);
}
public void setInstallingSnapshotIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INSTALLINGSNAPSHOT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case TERM:
if (value == null) {
unsetTerm();
} else {
setTerm((java.lang.Long)value);
}
break;
case LAST_LOG_INDEX:
if (value == null) {
unsetLastLogIndex();
} else {
setLastLogIndex((java.lang.Long)value);
}
break;
case LAST_LOG_TERM:
if (value == null) {
unsetLastLogTerm();
} else {
setLastLogTerm((java.lang.Long)value);
}
break;
case FOLLOWER:
if (value == null) {
unsetFollower();
} else {
setFollower((Node)value);
}
break;
case FOLLOWER_IDENTIFIER:
if (value == null) {
unsetFollowerIdentifier();
} else {
setFollowerIdentifier((java.lang.Integer)value);
}
break;
case REQUIRE_PARTITION_TABLE:
if (value == null) {
unsetRequirePartitionTable();
} else {
setRequirePartitionTable((java.lang.Boolean)value);
}
break;
case HEADER:
if (value == null) {
unsetHeader();
} else {
setHeader((Node)value);
}
break;
case INSTALLING_SNAPSHOT:
if (value == null) {
unsetInstallingSnapshot();
} else {
setInstallingSnapshot((java.lang.Boolean)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case TERM:
return getTerm();
case LAST_LOG_INDEX:
return getLastLogIndex();
case LAST_LOG_TERM:
return getLastLogTerm();
case FOLLOWER:
return getFollower();
case FOLLOWER_IDENTIFIER:
return getFollowerIdentifier();
case REQUIRE_PARTITION_TABLE:
return isRequirePartitionTable();
case HEADER:
return getHeader();
case INSTALLING_SNAPSHOT:
return isInstallingSnapshot();
}
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 TERM:
return isSetTerm();
case LAST_LOG_INDEX:
return isSetLastLogIndex();
case LAST_LOG_TERM:
return isSetLastLogTerm();
case FOLLOWER:
return isSetFollower();
case FOLLOWER_IDENTIFIER:
return isSetFollowerIdentifier();
case REQUIRE_PARTITION_TABLE:
return isSetRequirePartitionTable();
case HEADER:
return isSetHeader();
case INSTALLING_SNAPSHOT:
return isSetInstallingSnapshot();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof HeartBeatResponse)
return this.equals((HeartBeatResponse)that);
return false;
}
public boolean equals(HeartBeatResponse that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_term = true;
boolean that_present_term = true;
if (this_present_term || that_present_term) {
if (!(this_present_term && that_present_term))
return false;
if (this.term != that.term)
return false;
}
boolean this_present_lastLogIndex = true && this.isSetLastLogIndex();
boolean that_present_lastLogIndex = true && that.isSetLastLogIndex();
if (this_present_lastLogIndex || that_present_lastLogIndex) {
if (!(this_present_lastLogIndex && that_present_lastLogIndex))
return false;
if (this.lastLogIndex != that.lastLogIndex)
return false;
}
boolean this_present_lastLogTerm = true && this.isSetLastLogTerm();
boolean that_present_lastLogTerm = true && that.isSetLastLogTerm();
if (this_present_lastLogTerm || that_present_lastLogTerm) {
if (!(this_present_lastLogTerm && that_present_lastLogTerm))
return false;
if (this.lastLogTerm != that.lastLogTerm)
return false;
}
boolean this_present_follower = true && this.isSetFollower();
boolean that_present_follower = true && that.isSetFollower();
if (this_present_follower || that_present_follower) {
if (!(this_present_follower && that_present_follower))
return false;
if (!this.follower.equals(that.follower))
return false;
}
boolean this_present_followerIdentifier = true && this.isSetFollowerIdentifier();
boolean that_present_followerIdentifier = true && that.isSetFollowerIdentifier();
if (this_present_followerIdentifier || that_present_followerIdentifier) {
if (!(this_present_followerIdentifier && that_present_followerIdentifier))
return false;
if (this.followerIdentifier != that.followerIdentifier)
return false;
}
boolean this_present_requirePartitionTable = true;
boolean that_present_requirePartitionTable = true;
if (this_present_requirePartitionTable || that_present_requirePartitionTable) {
if (!(this_present_requirePartitionTable && that_present_requirePartitionTable))
return false;
if (this.requirePartitionTable != that.requirePartitionTable)
return false;
}
boolean this_present_header = true && this.isSetHeader();
boolean that_present_header = true && that.isSetHeader();
if (this_present_header || that_present_header) {
if (!(this_present_header && that_present_header))
return false;
if (!this.header.equals(that.header))
return false;
}
boolean this_present_installingSnapshot = true;
boolean that_present_installingSnapshot = true;
if (this_present_installingSnapshot || that_present_installingSnapshot) {
if (!(this_present_installingSnapshot && that_present_installingSnapshot))
return false;
if (this.installingSnapshot != that.installingSnapshot)
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(term);
hashCode = hashCode * 8191 + ((isSetLastLogIndex()) ? 131071 : 524287);
if (isSetLastLogIndex())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(lastLogIndex);
hashCode = hashCode * 8191 + ((isSetLastLogTerm()) ? 131071 : 524287);
if (isSetLastLogTerm())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(lastLogTerm);
hashCode = hashCode * 8191 + ((isSetFollower()) ? 131071 : 524287);
if (isSetFollower())
hashCode = hashCode * 8191 + follower.hashCode();
hashCode = hashCode * 8191 + ((isSetFollowerIdentifier()) ? 131071 : 524287);
if (isSetFollowerIdentifier())
hashCode = hashCode * 8191 + followerIdentifier;
hashCode = hashCode * 8191 + ((requirePartitionTable) ? 131071 : 524287);
hashCode = hashCode * 8191 + ((isSetHeader()) ? 131071 : 524287);
if (isSetHeader())
hashCode = hashCode * 8191 + header.hashCode();
hashCode = hashCode * 8191 + ((installingSnapshot) ? 131071 : 524287);
return hashCode;
}
@Override
public int compareTo(HeartBeatResponse other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetTerm(), other.isSetTerm());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTerm()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.term, other.term);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetLastLogIndex(), other.isSetLastLogIndex());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLastLogIndex()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastLogIndex, other.lastLogIndex);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetLastLogTerm(), other.isSetLastLogTerm());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLastLogTerm()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastLogTerm, other.lastLogTerm);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetFollower(), other.isSetFollower());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFollower()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.follower, other.follower);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetFollowerIdentifier(), other.isSetFollowerIdentifier());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFollowerIdentifier()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.followerIdentifier, other.followerIdentifier);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetRequirePartitionTable(), other.isSetRequirePartitionTable());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRequirePartitionTable()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requirePartitionTable, other.requirePartitionTable);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetHeader(), other.isSetHeader());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHeader()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, other.header);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetInstallingSnapshot(), other.isSetInstallingSnapshot());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetInstallingSnapshot()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.installingSnapshot, other.installingSnapshot);
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("HeartBeatResponse(");
boolean first = true;
sb.append("term:");
sb.append(this.term);
first = false;
if (isSetLastLogIndex()) {
if (!first) sb.append(", ");
sb.append("lastLogIndex:");
sb.append(this.lastLogIndex);
first = false;
}
if (isSetLastLogTerm()) {
if (!first) sb.append(", ");
sb.append("lastLogTerm:");
sb.append(this.lastLogTerm);
first = false;
}
if (isSetFollower()) {
if (!first) sb.append(", ");
sb.append("follower:");
if (this.follower == null) {
sb.append("null");
} else {
sb.append(this.follower);
}
first = false;
}
if (isSetFollowerIdentifier()) {
if (!first) sb.append(", ");
sb.append("followerIdentifier:");
sb.append(this.followerIdentifier);
first = false;
}
if (!first) sb.append(", ");
sb.append("requirePartitionTable:");
sb.append(this.requirePartitionTable);
first = false;
if (isSetHeader()) {
if (!first) sb.append(", ");
sb.append("header:");
if (this.header == null) {
sb.append("null");
} else {
sb.append(this.header);
}
first = false;
}
if (!first) sb.append(", ");
sb.append("installingSnapshot:");
sb.append(this.installingSnapshot);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// alas, we cannot check 'term' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'requirePartitionTable' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'installingSnapshot' 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 HeartBeatResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public HeartBeatResponseStandardScheme getScheme() {
return new HeartBeatResponseStandardScheme();
}
}
private static class HeartBeatResponseStandardScheme extends org.apache.thrift.scheme.StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, HeartBeatResponse 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: // TERM
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.term = iprot.readI64();
struct.setTermIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // LAST_LOG_INDEX
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.lastLogIndex = iprot.readI64();
struct.setLastLogIndexIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // LAST_LOG_TERM
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.lastLogTerm = iprot.readI64();
struct.setLastLogTermIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // FOLLOWER
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.follower = new Node();
struct.follower.read(iprot);
struct.setFollowerIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // FOLLOWER_IDENTIFIER
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.followerIdentifier = iprot.readI32();
struct.setFollowerIdentifierIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // REQUIRE_PARTITION_TABLE
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.requirePartitionTable = iprot.readBool();
struct.setRequirePartitionTableIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // HEADER
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.header = new Node();
struct.header.read(iprot);
struct.setHeaderIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // INSTALLING_SNAPSHOT
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.installingSnapshot = iprot.readBool();
struct.setInstallingSnapshotIsSet(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.isSetTerm()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'term' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetRequirePartitionTable()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'requirePartitionTable' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetInstallingSnapshot()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'installingSnapshot' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, HeartBeatResponse struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(TERM_FIELD_DESC);
oprot.writeI64(struct.term);
oprot.writeFieldEnd();
if (struct.isSetLastLogIndex()) {
oprot.writeFieldBegin(LAST_LOG_INDEX_FIELD_DESC);
oprot.writeI64(struct.lastLogIndex);
oprot.writeFieldEnd();
}
if (struct.isSetLastLogTerm()) {
oprot.writeFieldBegin(LAST_LOG_TERM_FIELD_DESC);
oprot.writeI64(struct.lastLogTerm);
oprot.writeFieldEnd();
}
if (struct.follower != null) {
if (struct.isSetFollower()) {
oprot.writeFieldBegin(FOLLOWER_FIELD_DESC);
struct.follower.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.isSetFollowerIdentifier()) {
oprot.writeFieldBegin(FOLLOWER_IDENTIFIER_FIELD_DESC);
oprot.writeI32(struct.followerIdentifier);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(REQUIRE_PARTITION_TABLE_FIELD_DESC);
oprot.writeBool(struct.requirePartitionTable);
oprot.writeFieldEnd();
if (struct.header != null) {
if (struct.isSetHeader()) {
oprot.writeFieldBegin(HEADER_FIELD_DESC);
struct.header.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldBegin(INSTALLING_SNAPSHOT_FIELD_DESC);
oprot.writeBool(struct.installingSnapshot);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class HeartBeatResponseTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public HeartBeatResponseTupleScheme getScheme() {
return new HeartBeatResponseTupleScheme();
}
}
private static class HeartBeatResponseTupleScheme extends org.apache.thrift.scheme.TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, HeartBeatResponse struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
oprot.writeI64(struct.term);
oprot.writeBool(struct.requirePartitionTable);
oprot.writeBool(struct.installingSnapshot);
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetLastLogIndex()) {
optionals.set(0);
}
if (struct.isSetLastLogTerm()) {
optionals.set(1);
}
if (struct.isSetFollower()) {
optionals.set(2);
}
if (struct.isSetFollowerIdentifier()) {
optionals.set(3);
}
if (struct.isSetHeader()) {
optionals.set(4);
}
oprot.writeBitSet(optionals, 5);
if (struct.isSetLastLogIndex()) {
oprot.writeI64(struct.lastLogIndex);
}
if (struct.isSetLastLogTerm()) {
oprot.writeI64(struct.lastLogTerm);
}
if (struct.isSetFollower()) {
struct.follower.write(oprot);
}
if (struct.isSetFollowerIdentifier()) {
oprot.writeI32(struct.followerIdentifier);
}
if (struct.isSetHeader()) {
struct.header.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, HeartBeatResponse struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.term = iprot.readI64();
struct.setTermIsSet(true);
struct.requirePartitionTable = iprot.readBool();
struct.setRequirePartitionTableIsSet(true);
struct.installingSnapshot = iprot.readBool();
struct.setInstallingSnapshotIsSet(true);
java.util.BitSet incoming = iprot.readBitSet(5);
if (incoming.get(0)) {
struct.lastLogIndex = iprot.readI64();
struct.setLastLogIndexIsSet(true);
}
if (incoming.get(1)) {
struct.lastLogTerm = iprot.readI64();
struct.setLastLogTermIsSet(true);
}
if (incoming.get(2)) {
struct.follower = new Node();
struct.follower.read(iprot);
struct.setFollowerIsSet(true);
}
if (incoming.get(3)) {
struct.followerIdentifier = iprot.readI32();
struct.setFollowerIdentifierIsSet(true);
}
if (incoming.get(4)) {
struct.header = new Node();
struct.header.read(iprot);
struct.setHeaderIsSet(true);
}
}
}
private static S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy