TBackend.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 TBackend implements org.apache.thrift.TBase<TBackend, TBackend._Fields>, java.io.Serializable, Cloneable, Comparable<TBackend> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBackend");
private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField BE_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("be_port", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField HTTP_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("http_port", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField BRPC_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("brpc_port", org.apache.thrift.protocol.TType.I32, (short)4);
private static final org.apache.thrift.protocol.TField IS_ALIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("is_alive", org.apache.thrift.protocol.TType.BOOL, (short)5);
private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)6);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TBackendStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TBackendTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable java.lang.String host; // required
public int be_port; // required
public int http_port; // required
public int brpc_port; // optional
public boolean is_alive; // optional
public long 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 {
HOST((short)1, "host"),
BE_PORT((short)2, "be_port"),
HTTP_PORT((short)3, "http_port"),
BRPC_PORT((short)4, "brpc_port"),
IS_ALIVE((short)5, "is_alive"),
ID((short)6, "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: // HOST
return HOST;
case 2: // BE_PORT
return BE_PORT;
case 3: // HTTP_PORT
return HTTP_PORT;
case 4: // BRPC_PORT
return BRPC_PORT;
case 5: // IS_ALIVE
return IS_ALIVE;
case 6: // ID
return 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 __BE_PORT_ISSET_ID = 0;
private static final int __HTTP_PORT_ISSET_ID = 1;
private static final int __BRPC_PORT_ISSET_ID = 2;
private static final int __IS_ALIVE_ISSET_ID = 3;
private static final int __ID_ISSET_ID = 4;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.BRPC_PORT,_Fields.IS_ALIVE,_Fields.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.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.BE_PORT, new org.apache.thrift.meta_data.FieldMetaData("be_port", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "TPort")));
tmpMap.put(_Fields.HTTP_PORT, new org.apache.thrift.meta_data.FieldMetaData("http_port", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "TPort")));
tmpMap.put(_Fields.BRPC_PORT, new org.apache.thrift.meta_data.FieldMetaData("brpc_port", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "TPort")));
tmpMap.put(_Fields.IS_ALIVE, new org.apache.thrift.meta_data.FieldMetaData("is_alive", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBackend.class, metaDataMap);
}
public TBackend() {
}
public TBackend(
java.lang.String host,
int be_port,
int http_port)
{
this();
this.host = host;
this.be_port = be_port;
setBePortIsSet(true);
this.http_port = http_port;
setHttpPortIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TBackend(TBackend other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetHost()) {
this.host = other.host;
}
this.be_port = other.be_port;
this.http_port = other.http_port;
this.brpc_port = other.brpc_port;
this.is_alive = other.is_alive;
this.id = other.id;
}
public TBackend deepCopy() {
return new TBackend(this);
}
@Override
public void clear() {
this.host = null;
setBePortIsSet(false);
this.be_port = 0;
setHttpPortIsSet(false);
this.http_port = 0;
setBrpcPortIsSet(false);
this.brpc_port = 0;
setIsAliveIsSet(false);
this.is_alive = false;
setIdIsSet(false);
this.id = 0;
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getHost() {
return this.host;
}
public TBackend setHost(@org.apache.thrift.annotation.Nullable java.lang.String host) {
this.host = host;
return this;
}
public void unsetHost() {
this.host = null;
}
/** Returns true if field host is set (has been assigned a value) and false otherwise */
public boolean isSetHost() {
return this.host != null;
}
public void setHostIsSet(boolean value) {
if (!value) {
this.host = null;
}
}
public int getBePort() {
return this.be_port;
}
public TBackend setBePort(int be_port) {
this.be_port = be_port;
setBePortIsSet(true);
return this;
}
public void unsetBePort() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BE_PORT_ISSET_ID);
}
/** Returns true if field be_port is set (has been assigned a value) and false otherwise */
public boolean isSetBePort() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BE_PORT_ISSET_ID);
}
public void setBePortIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BE_PORT_ISSET_ID, value);
}
public int getHttpPort() {
return this.http_port;
}
public TBackend setHttpPort(int http_port) {
this.http_port = http_port;
setHttpPortIsSet(true);
return this;
}
public void unsetHttpPort() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __HTTP_PORT_ISSET_ID);
}
/** Returns true if field http_port is set (has been assigned a value) and false otherwise */
public boolean isSetHttpPort() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __HTTP_PORT_ISSET_ID);
}
public void setHttpPortIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __HTTP_PORT_ISSET_ID, value);
}
public int getBrpcPort() {
return this.brpc_port;
}
public TBackend setBrpcPort(int brpc_port) {
this.brpc_port = brpc_port;
setBrpcPortIsSet(true);
return this;
}
public void unsetBrpcPort() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BRPC_PORT_ISSET_ID);
}
/** Returns true if field brpc_port is set (has been assigned a value) and false otherwise */
public boolean isSetBrpcPort() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BRPC_PORT_ISSET_ID);
}
public void setBrpcPortIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BRPC_PORT_ISSET_ID, value);
}
public boolean isIsAlive() {
return this.is_alive;
}
public TBackend setIsAlive(boolean is_alive) {
this.is_alive = is_alive;
setIsAliveIsSet(true);
return this;
}
public void unsetIsAlive() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __IS_ALIVE_ISSET_ID);
}
/** Returns true if field is_alive is set (has been assigned a value) and false otherwise */
public boolean isSetIsAlive() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __IS_ALIVE_ISSET_ID);
}
public void setIsAliveIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __IS_ALIVE_ISSET_ID, value);
}
public long getId() {
return this.id;
}
public TBackend setId(long id) {
this.id = id;
setIdIsSet(true);
return this;
}
public void unsetId() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
}
/** Returns true if field id is set (has been assigned a value) and false otherwise */
public boolean isSetId() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
}
public void setIdIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case HOST:
if (value == null) {
unsetHost();
} else {
setHost((java.lang.String)value);
}
break;
case BE_PORT:
if (value == null) {
unsetBePort();
} else {
setBePort((java.lang.Integer)value);
}
break;
case HTTP_PORT:
if (value == null) {
unsetHttpPort();
} else {
setHttpPort((java.lang.Integer)value);
}
break;
case BRPC_PORT:
if (value == null) {
unsetBrpcPort();
} else {
setBrpcPort((java.lang.Integer)value);
}
break;
case IS_ALIVE:
if (value == null) {
unsetIsAlive();
} else {
setIsAlive((java.lang.Boolean)value);
}
break;
case ID:
if (value == null) {
unsetId();
} else {
setId((java.lang.Long)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case HOST:
return getHost();
case BE_PORT:
return getBePort();
case HTTP_PORT:
return getHttpPort();
case BRPC_PORT:
return getBrpcPort();
case IS_ALIVE:
return isIsAlive();
case ID:
return getId();
}
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 HOST:
return isSetHost();
case BE_PORT:
return isSetBePort();
case HTTP_PORT:
return isSetHttpPort();
case BRPC_PORT:
return isSetBrpcPort();
case IS_ALIVE:
return isSetIsAlive();
case ID:
return isSetId();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof TBackend)
return this.equals((TBackend)that);
return false;
}
public boolean equals(TBackend that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_host = true && this.isSetHost();
boolean that_present_host = true && that.isSetHost();
if (this_present_host || that_present_host) {
if (!(this_present_host && that_present_host))
return false;
if (!this.host.equals(that.host))
return false;
}
boolean this_present_be_port = true;
boolean that_present_be_port = true;
if (this_present_be_port || that_present_be_port) {
if (!(this_present_be_port && that_present_be_port))
return false;
if (this.be_port != that.be_port)
return false;
}
boolean this_present_http_port = true;
boolean that_present_http_port = true;
if (this_present_http_port || that_present_http_port) {
if (!(this_present_http_port && that_present_http_port))
return false;
if (this.http_port != that.http_port)
return false;
}
boolean this_present_brpc_port = true && this.isSetBrpcPort();
boolean that_present_brpc_port = true && that.isSetBrpcPort();
if (this_present_brpc_port || that_present_brpc_port) {
if (!(this_present_brpc_port && that_present_brpc_port))
return false;
if (this.brpc_port != that.brpc_port)
return false;
}
boolean this_present_is_alive = true && this.isSetIsAlive();
boolean that_present_is_alive = true && that.isSetIsAlive();
if (this_present_is_alive || that_present_is_alive) {
if (!(this_present_is_alive && that_present_is_alive))
return false;
if (this.is_alive != that.is_alive)
return false;
}
boolean this_present_id = true && this.isSetId();
boolean that_present_id = true && that.isSetId();
if (this_present_id || that_present_id) {
if (!(this_present_id && that_present_id))
return false;
if (this.id != that.id)
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetHost()) ? 131071 : 524287);
if (isSetHost())
hashCode = hashCode * 8191 + host.hashCode();
hashCode = hashCode * 8191 + be_port;
hashCode = hashCode * 8191 + http_port;
hashCode = hashCode * 8191 + ((isSetBrpcPort()) ? 131071 : 524287);
if (isSetBrpcPort())
hashCode = hashCode * 8191 + brpc_port;
hashCode = hashCode * 8191 + ((isSetIsAlive()) ? 131071 : 524287);
if (isSetIsAlive())
hashCode = hashCode * 8191 + ((is_alive) ? 131071 : 524287);
hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
if (isSetId())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);
return hashCode;
}
@Override
public int compareTo(TBackend other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetHost(), other.isSetHost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHost()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetBePort(), other.isSetBePort());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBePort()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.be_port, other.be_port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetHttpPort(), other.isSetHttpPort());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHttpPort()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.http_port, other.http_port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetBrpcPort(), other.isSetBrpcPort());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBrpcPort()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.brpc_port, other.brpc_port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetIsAlive(), other.isSetIsAlive());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIsAlive()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_alive, other.is_alive);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.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("TBackend(");
boolean first = true;
sb.append("host:");
if (this.host == null) {
sb.append("null");
} else {
sb.append(this.host);
}
first = false;
if (!first) sb.append(", ");
sb.append("be_port:");
sb.append(this.be_port);
first = false;
if (!first) sb.append(", ");
sb.append("http_port:");
sb.append(this.http_port);
first = false;
if (isSetBrpcPort()) {
if (!first) sb.append(", ");
sb.append("brpc_port:");
sb.append(this.brpc_port);
first = false;
}
if (isSetIsAlive()) {
if (!first) sb.append(", ");
sb.append("is_alive:");
sb.append(this.is_alive);
first = false;
}
if (isSetId()) {
if (!first) sb.append(", ");
sb.append("id:");
sb.append(this.id);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (host == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'host' was not present! Struct: " + toString());
}
// alas, we cannot check 'be_port' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'http_port' 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 TBackendStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TBackendStandardScheme getScheme() {
return new TBackendStandardScheme();
}
}
private static class TBackendStandardScheme extends org.apache.thrift.scheme.StandardScheme<TBackend> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TBackend 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: // HOST
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // BE_PORT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.be_port = iprot.readI32();
struct.setBePortIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // HTTP_PORT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.http_port = iprot.readI32();
struct.setHttpPortIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // BRPC_PORT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.brpc_port = iprot.readI32();
struct.setBrpcPortIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // IS_ALIVE
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.is_alive = iprot.readBool();
struct.setIsAliveIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.id = iprot.readI64();
struct.setIdIsSet(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.isSetBePort()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'be_port' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetHttpPort()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'http_port' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TBackend struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.host != null) {
oprot.writeFieldBegin(HOST_FIELD_DESC);
oprot.writeString(struct.host);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(BE_PORT_FIELD_DESC);
oprot.writeI32(struct.be_port);
oprot.writeFieldEnd();
oprot.writeFieldBegin(HTTP_PORT_FIELD_DESC);
oprot.writeI32(struct.http_port);
oprot.writeFieldEnd();
if (struct.isSetBrpcPort()) {
oprot.writeFieldBegin(BRPC_PORT_FIELD_DESC);
oprot.writeI32(struct.brpc_port);
oprot.writeFieldEnd();
}
if (struct.isSetIsAlive()) {
oprot.writeFieldBegin(IS_ALIVE_FIELD_DESC);
oprot.writeBool(struct.is_alive);
oprot.writeFieldEnd();
}
if (struct.isSetId()) {
oprot.writeFieldBegin(ID_FIELD_DESC);
oprot.writeI64(struct.id);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TBackendTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TBackendTupleScheme getScheme() {
return new TBackendTupleScheme();
}
}
private static class TBackendTupleScheme extends org.apache.thrift.scheme.TupleScheme<TBackend> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TBackend struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
oprot.writeString(struct.host);
oprot.writeI32(struct.be_port);
oprot.writeI32(struct.http_port);
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetBrpcPort()) {
optionals.set(0);
}
if (struct.isSetIsAlive()) {
optionals.set(1);
}
if (struct.isSetId()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetBrpcPort()) {
oprot.writeI32(struct.brpc_port);
}
if (struct.isSetIsAlive()) {
oprot.writeBool(struct.is_alive);
}
if (struct.isSetId()) {
oprot.writeI64(struct.id);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TBackend struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.host = iprot.readString();
struct.setHostIsSet(true);
struct.be_port = iprot.readI32();
struct.setBePortIsSet(true);
struct.http_port = iprot.readI32();
struct.setHttpPortIsSet(true);
java.util.BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.brpc_port = iprot.readI32();
struct.setBrpcPortIsSet(true);
}
if (incoming.get(1)) {
struct.is_alive = iprot.readBool();
struct.setIsAliveIsSet(true);
}
if (incoming.get(2)) {
struct.id = iprot.readI64();
struct.setIdIsSet(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();
}
}