org.apache.iotdb.consensus.multileader.thrift.TSyncLogReq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of thrift-multi-leader-consensus
Show all versions of thrift-multi-leader-consensus
Rpc modules for multi leader consensus algorithm
The newest version!
/**
* 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.consensus.multileader.thrift;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2022-10-14")
public class TSyncLogReq 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("TSyncLogReq");
private static final org.apache.thrift.protocol.TField PEER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("peerId", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField CONSENSUS_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("consensusGroupId", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.protocol.TField BATCHES_FIELD_DESC = new org.apache.thrift.protocol.TField("batches", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TSyncLogReqStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TSyncLogReqTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable java.lang.String peerId; // required
public @org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId; // required
public @org.apache.thrift.annotation.Nullable java.util.List batches; // 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 {
PEER_ID((short)1, "peerId"),
CONSENSUS_GROUP_ID((short)2, "consensusGroupId"),
BATCHES((short)3, "batches");
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: // PEER_ID
return PEER_ID;
case 2: // CONSENSUS_GROUP_ID
return CONSENSUS_GROUP_ID;
case 3: // BATCHES
return BATCHES;
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
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.PEER_ID, new org.apache.thrift.meta_data.FieldMetaData("peerId", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CONSENSUS_GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("consensusGroupId", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.iotdb.common.rpc.thrift.TConsensusGroupId.class)));
tmpMap.put(_Fields.BATCHES, new org.apache.thrift.meta_data.FieldMetaData("batches", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TLogBatch.class))));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSyncLogReq.class, metaDataMap);
}
public TSyncLogReq() {
}
public TSyncLogReq(
java.lang.String peerId,
org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId,
java.util.List batches)
{
this();
this.peerId = peerId;
this.consensusGroupId = consensusGroupId;
this.batches = batches;
}
/**
* Performs a deep copy on other.
*/
public TSyncLogReq(TSyncLogReq other) {
if (other.isSetPeerId()) {
this.peerId = other.peerId;
}
if (other.isSetConsensusGroupId()) {
this.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId(other.consensusGroupId);
}
if (other.isSetBatches()) {
java.util.List __this__batches = new java.util.ArrayList(other.batches.size());
for (TLogBatch other_element : other.batches) {
__this__batches.add(new TLogBatch(other_element));
}
this.batches = __this__batches;
}
}
public TSyncLogReq deepCopy() {
return new TSyncLogReq(this);
}
@Override
public void clear() {
this.peerId = null;
this.consensusGroupId = null;
this.batches = null;
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getPeerId() {
return this.peerId;
}
public TSyncLogReq setPeerId(@org.apache.thrift.annotation.Nullable java.lang.String peerId) {
this.peerId = peerId;
return this;
}
public void unsetPeerId() {
this.peerId = null;
}
/** Returns true if field peerId is set (has been assigned a value) and false otherwise */
public boolean isSetPeerId() {
return this.peerId != null;
}
public void setPeerIdIsSet(boolean value) {
if (!value) {
this.peerId = null;
}
}
@org.apache.thrift.annotation.Nullable
public org.apache.iotdb.common.rpc.thrift.TConsensusGroupId getConsensusGroupId() {
return this.consensusGroupId;
}
public TSyncLogReq setConsensusGroupId(@org.apache.thrift.annotation.Nullable org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId) {
this.consensusGroupId = consensusGroupId;
return this;
}
public void unsetConsensusGroupId() {
this.consensusGroupId = null;
}
/** Returns true if field consensusGroupId is set (has been assigned a value) and false otherwise */
public boolean isSetConsensusGroupId() {
return this.consensusGroupId != null;
}
public void setConsensusGroupIdIsSet(boolean value) {
if (!value) {
this.consensusGroupId = null;
}
}
public int getBatchesSize() {
return (this.batches == null) ? 0 : this.batches.size();
}
@org.apache.thrift.annotation.Nullable
public java.util.Iterator getBatchesIterator() {
return (this.batches == null) ? null : this.batches.iterator();
}
public void addToBatches(TLogBatch elem) {
if (this.batches == null) {
this.batches = new java.util.ArrayList();
}
this.batches.add(elem);
}
@org.apache.thrift.annotation.Nullable
public java.util.List getBatches() {
return this.batches;
}
public TSyncLogReq setBatches(@org.apache.thrift.annotation.Nullable java.util.List batches) {
this.batches = batches;
return this;
}
public void unsetBatches() {
this.batches = null;
}
/** Returns true if field batches is set (has been assigned a value) and false otherwise */
public boolean isSetBatches() {
return this.batches != null;
}
public void setBatchesIsSet(boolean value) {
if (!value) {
this.batches = null;
}
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case PEER_ID:
if (value == null) {
unsetPeerId();
} else {
setPeerId((java.lang.String)value);
}
break;
case CONSENSUS_GROUP_ID:
if (value == null) {
unsetConsensusGroupId();
} else {
setConsensusGroupId((org.apache.iotdb.common.rpc.thrift.TConsensusGroupId)value);
}
break;
case BATCHES:
if (value == null) {
unsetBatches();
} else {
setBatches((java.util.List)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case PEER_ID:
return getPeerId();
case CONSENSUS_GROUP_ID:
return getConsensusGroupId();
case BATCHES:
return getBatches();
}
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 PEER_ID:
return isSetPeerId();
case CONSENSUS_GROUP_ID:
return isSetConsensusGroupId();
case BATCHES:
return isSetBatches();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof TSyncLogReq)
return this.equals((TSyncLogReq)that);
return false;
}
public boolean equals(TSyncLogReq that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_peerId = true && this.isSetPeerId();
boolean that_present_peerId = true && that.isSetPeerId();
if (this_present_peerId || that_present_peerId) {
if (!(this_present_peerId && that_present_peerId))
return false;
if (!this.peerId.equals(that.peerId))
return false;
}
boolean this_present_consensusGroupId = true && this.isSetConsensusGroupId();
boolean that_present_consensusGroupId = true && that.isSetConsensusGroupId();
if (this_present_consensusGroupId || that_present_consensusGroupId) {
if (!(this_present_consensusGroupId && that_present_consensusGroupId))
return false;
if (!this.consensusGroupId.equals(that.consensusGroupId))
return false;
}
boolean this_present_batches = true && this.isSetBatches();
boolean that_present_batches = true && that.isSetBatches();
if (this_present_batches || that_present_batches) {
if (!(this_present_batches && that_present_batches))
return false;
if (!this.batches.equals(that.batches))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetPeerId()) ? 131071 : 524287);
if (isSetPeerId())
hashCode = hashCode * 8191 + peerId.hashCode();
hashCode = hashCode * 8191 + ((isSetConsensusGroupId()) ? 131071 : 524287);
if (isSetConsensusGroupId())
hashCode = hashCode * 8191 + consensusGroupId.hashCode();
hashCode = hashCode * 8191 + ((isSetBatches()) ? 131071 : 524287);
if (isSetBatches())
hashCode = hashCode * 8191 + batches.hashCode();
return hashCode;
}
@Override
public int compareTo(TSyncLogReq other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetPeerId(), other.isSetPeerId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPeerId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.peerId, other.peerId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetConsensusGroupId(), other.isSetConsensusGroupId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetConsensusGroupId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consensusGroupId, other.consensusGroupId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetBatches(), other.isSetBatches());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBatches()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batches, other.batches);
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("TSyncLogReq(");
boolean first = true;
sb.append("peerId:");
if (this.peerId == null) {
sb.append("null");
} else {
sb.append(this.peerId);
}
first = false;
if (!first) sb.append(", ");
sb.append("consensusGroupId:");
if (this.consensusGroupId == null) {
sb.append("null");
} else {
sb.append(this.consensusGroupId);
}
first = false;
if (!first) sb.append(", ");
sb.append("batches:");
if (this.batches == null) {
sb.append("null");
} else {
sb.append(this.batches);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (peerId == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'peerId' was not present! Struct: " + toString());
}
if (consensusGroupId == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'consensusGroupId' was not present! Struct: " + toString());
}
if (batches == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'batches' was not present! Struct: " + toString());
}
// check for sub-struct validity
if (consensusGroupId != null) {
consensusGroupId.validate();
}
}
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 {
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 TSyncLogReqStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TSyncLogReqStandardScheme getScheme() {
return new TSyncLogReqStandardScheme();
}
}
private static class TSyncLogReqStandardScheme extends org.apache.thrift.scheme.StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, TSyncLogReq 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: // PEER_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.peerId = iprot.readString();
struct.setPeerIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // CONSENSUS_GROUP_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
struct.consensusGroupId.read(iprot);
struct.setConsensusGroupIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // BATCHES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
struct.batches = new java.util.ArrayList(_list0.size);
@org.apache.thrift.annotation.Nullable TLogBatch _elem1;
for (int _i2 = 0; _i2 < _list0.size; ++_i2)
{
_elem1 = new TLogBatch();
_elem1.read(iprot);
struct.batches.add(_elem1);
}
iprot.readListEnd();
}
struct.setBatchesIsSet(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
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TSyncLogReq struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.peerId != null) {
oprot.writeFieldBegin(PEER_ID_FIELD_DESC);
oprot.writeString(struct.peerId);
oprot.writeFieldEnd();
}
if (struct.consensusGroupId != null) {
oprot.writeFieldBegin(CONSENSUS_GROUP_ID_FIELD_DESC);
struct.consensusGroupId.write(oprot);
oprot.writeFieldEnd();
}
if (struct.batches != null) {
oprot.writeFieldBegin(BATCHES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.batches.size()));
for (TLogBatch _iter3 : struct.batches)
{
_iter3.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TSyncLogReqTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TSyncLogReqTupleScheme getScheme() {
return new TSyncLogReqTupleScheme();
}
}
private static class TSyncLogReqTupleScheme extends org.apache.thrift.scheme.TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TSyncLogReq struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
oprot.writeString(struct.peerId);
struct.consensusGroupId.write(oprot);
{
oprot.writeI32(struct.batches.size());
for (TLogBatch _iter4 : struct.batches)
{
_iter4.write(oprot);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TSyncLogReq struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.peerId = iprot.readString();
struct.setPeerIdIsSet(true);
struct.consensusGroupId = new org.apache.iotdb.common.rpc.thrift.TConsensusGroupId();
struct.consensusGroupId.read(iprot);
struct.setConsensusGroupIdIsSet(true);
{
org.apache.thrift.protocol.TList _list5 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
struct.batches = new java.util.ArrayList(_list5.size);
@org.apache.thrift.annotation.Nullable TLogBatch _elem6;
for (int _i7 = 0; _i7 < _list5.size; ++_i7)
{
_elem6 = new TLogBatch();
_elem6.read(iprot);
struct.batches.add(_elem6);
}
}
struct.setBatchesIsSet(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