org.apache.kafka.common.message.DescribeProducersResponseData Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// THIS CODE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package org.apache.kafka.common.message;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.kafka.common.errors.UnsupportedVersionException;
import org.apache.kafka.common.protocol.ApiMessage;
import org.apache.kafka.common.protocol.Message;
import org.apache.kafka.common.protocol.MessageSizeAccumulator;
import org.apache.kafka.common.protocol.MessageUtil;
import org.apache.kafka.common.protocol.ObjectSerializationCache;
import org.apache.kafka.common.protocol.Readable;
import org.apache.kafka.common.protocol.Writable;
import org.apache.kafka.common.protocol.types.CompactArrayOf;
import org.apache.kafka.common.protocol.types.Field;
import org.apache.kafka.common.protocol.types.RawTaggedField;
import org.apache.kafka.common.protocol.types.RawTaggedFieldWriter;
import org.apache.kafka.common.protocol.types.Schema;
import org.apache.kafka.common.protocol.types.Type;
import org.apache.kafka.common.utils.ByteUtils;
import static org.apache.kafka.common.protocol.types.Field.TaggedFieldsSection;
public class DescribeProducersResponseData implements ApiMessage {
int throttleTimeMs;
List topics;
private List _unknownTaggedFields;
public static final Schema SCHEMA_0 =
new Schema(
new Field("throttle_time_ms", Type.INT32, "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota."),
new Field("topics", new CompactArrayOf(TopicResponse.SCHEMA_0), "Each topic in the response."),
TaggedFieldsSection.of(
)
);
public static final Schema[] SCHEMAS = new Schema[] {
SCHEMA_0
};
public static final short LOWEST_SUPPORTED_VERSION = 0;
public static final short HIGHEST_SUPPORTED_VERSION = 0;
public DescribeProducersResponseData(Readable _readable, short _version) {
read(_readable, _version);
}
public DescribeProducersResponseData() {
this.throttleTimeMs = 0;
this.topics = new ArrayList(0);
}
@Override
public short apiKey() {
return 61;
}
@Override
public short lowestSupportedVersion() {
return 0;
}
@Override
public short highestSupportedVersion() {
return 0;
}
@Override
public void read(Readable _readable, short _version) {
this.throttleTimeMs = _readable.readInt();
{
int arrayLength;
arrayLength = _readable.readUnsignedVarint() - 1;
if (arrayLength < 0) {
throw new RuntimeException("non-nullable field topics was serialized as null");
} else {
if (arrayLength > _readable.remaining()) {
throw new RuntimeException("Tried to allocate a collection of size " + arrayLength + ", but there are only " + _readable.remaining() + " bytes remaining.");
}
ArrayList newCollection = new ArrayList<>(arrayLength);
for (int i = 0; i < arrayLength; i++) {
newCollection.add(new TopicResponse(_readable, _version));
}
this.topics = newCollection;
}
}
this._unknownTaggedFields = null;
int _numTaggedFields = _readable.readUnsignedVarint();
for (int _i = 0; _i < _numTaggedFields; _i++) {
int _tag = _readable.readUnsignedVarint();
int _size = _readable.readUnsignedVarint();
switch (_tag) {
default:
this._unknownTaggedFields = _readable.readUnknownTaggedField(this._unknownTaggedFields, _tag, _size);
break;
}
}
}
@Override
public void write(Writable _writable, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
_writable.writeInt(throttleTimeMs);
_writable.writeUnsignedVarint(topics.size() + 1);
for (TopicResponse topicsElement : topics) {
topicsElement.write(_writable, _cache, _version);
}
RawTaggedFieldWriter _rawWriter = RawTaggedFieldWriter.forFields(_unknownTaggedFields);
_numTaggedFields += _rawWriter.numFields();
_writable.writeUnsignedVarint(_numTaggedFields);
_rawWriter.writeRawTags(_writable, Integer.MAX_VALUE);
}
@Override
public void addSize(MessageSizeAccumulator _size, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
_size.addBytes(4);
{
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(topics.size() + 1));
for (TopicResponse topicsElement : topics) {
topicsElement.addSize(_size, _cache, _version);
}
}
if (_unknownTaggedFields != null) {
_numTaggedFields += _unknownTaggedFields.size();
for (RawTaggedField _field : _unknownTaggedFields) {
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.tag()));
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.size()));
_size.addBytes(_field.size());
}
}
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_numTaggedFields));
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof DescribeProducersResponseData)) return false;
DescribeProducersResponseData other = (DescribeProducersResponseData) obj;
if (throttleTimeMs != other.throttleTimeMs) return false;
if (this.topics == null) {
if (other.topics != null) return false;
} else {
if (!this.topics.equals(other.topics)) return false;
}
return MessageUtil.compareRawTaggedFields(_unknownTaggedFields, other._unknownTaggedFields);
}
@Override
public int hashCode() {
int hashCode = 0;
hashCode = 31 * hashCode + throttleTimeMs;
hashCode = 31 * hashCode + (topics == null ? 0 : topics.hashCode());
return hashCode;
}
@Override
public DescribeProducersResponseData duplicate() {
DescribeProducersResponseData _duplicate = new DescribeProducersResponseData();
_duplicate.throttleTimeMs = throttleTimeMs;
ArrayList newTopics = new ArrayList(topics.size());
for (TopicResponse _element : topics) {
newTopics.add(_element.duplicate());
}
_duplicate.topics = newTopics;
return _duplicate;
}
@Override
public String toString() {
return "DescribeProducersResponseData("
+ "throttleTimeMs=" + throttleTimeMs
+ ", topics=" + MessageUtil.deepToString(topics.iterator())
+ ")";
}
public int throttleTimeMs() {
return this.throttleTimeMs;
}
public List topics() {
return this.topics;
}
@Override
public List unknownTaggedFields() {
if (_unknownTaggedFields == null) {
_unknownTaggedFields = new ArrayList<>(0);
}
return _unknownTaggedFields;
}
public DescribeProducersResponseData setThrottleTimeMs(int v) {
this.throttleTimeMs = v;
return this;
}
public DescribeProducersResponseData setTopics(List v) {
this.topics = v;
return this;
}
public static class TopicResponse implements Message {
String name;
List partitions;
private List _unknownTaggedFields;
public static final Schema SCHEMA_0 =
new Schema(
new Field("name", Type.COMPACT_STRING, "The topic name"),
new Field("partitions", new CompactArrayOf(PartitionResponse.SCHEMA_0), "Each partition in the response."),
TaggedFieldsSection.of(
)
);
public static final Schema[] SCHEMAS = new Schema[] {
SCHEMA_0
};
public static final short LOWEST_SUPPORTED_VERSION = 0;
public static final short HIGHEST_SUPPORTED_VERSION = 0;
public TopicResponse(Readable _readable, short _version) {
read(_readable, _version);
}
public TopicResponse() {
this.name = "";
this.partitions = new ArrayList(0);
}
@Override
public short lowestSupportedVersion() {
return 0;
}
@Override
public short highestSupportedVersion() {
return 0;
}
@Override
public void read(Readable _readable, short _version) {
if (_version > 0) {
throw new UnsupportedVersionException("Can't read version " + _version + " of TopicResponse");
}
{
int length;
length = _readable.readUnsignedVarint() - 1;
if (length < 0) {
throw new RuntimeException("non-nullable field name was serialized as null");
} else if (length > 0x7fff) {
throw new RuntimeException("string field name had invalid length " + length);
} else {
this.name = _readable.readString(length);
}
}
{
int arrayLength;
arrayLength = _readable.readUnsignedVarint() - 1;
if (arrayLength < 0) {
throw new RuntimeException("non-nullable field partitions was serialized as null");
} else {
if (arrayLength > _readable.remaining()) {
throw new RuntimeException("Tried to allocate a collection of size " + arrayLength + ", but there are only " + _readable.remaining() + " bytes remaining.");
}
ArrayList newCollection = new ArrayList<>(arrayLength);
for (int i = 0; i < arrayLength; i++) {
newCollection.add(new PartitionResponse(_readable, _version));
}
this.partitions = newCollection;
}
}
this._unknownTaggedFields = null;
int _numTaggedFields = _readable.readUnsignedVarint();
for (int _i = 0; _i < _numTaggedFields; _i++) {
int _tag = _readable.readUnsignedVarint();
int _size = _readable.readUnsignedVarint();
switch (_tag) {
default:
this._unknownTaggedFields = _readable.readUnknownTaggedField(this._unknownTaggedFields, _tag, _size);
break;
}
}
}
@Override
public void write(Writable _writable, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
{
byte[] _stringBytes = _cache.getSerializedValue(name);
_writable.writeUnsignedVarint(_stringBytes.length + 1);
_writable.writeByteArray(_stringBytes);
}
_writable.writeUnsignedVarint(partitions.size() + 1);
for (PartitionResponse partitionsElement : partitions) {
partitionsElement.write(_writable, _cache, _version);
}
RawTaggedFieldWriter _rawWriter = RawTaggedFieldWriter.forFields(_unknownTaggedFields);
_numTaggedFields += _rawWriter.numFields();
_writable.writeUnsignedVarint(_numTaggedFields);
_rawWriter.writeRawTags(_writable, Integer.MAX_VALUE);
}
@Override
public void addSize(MessageSizeAccumulator _size, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
if (_version > 0) {
throw new UnsupportedVersionException("Can't size version " + _version + " of TopicResponse");
}
{
byte[] _stringBytes = name.getBytes(StandardCharsets.UTF_8);
if (_stringBytes.length > 0x7fff) {
throw new RuntimeException("'name' field is too long to be serialized");
}
_cache.cacheSerializedValue(name, _stringBytes);
_size.addBytes(_stringBytes.length + ByteUtils.sizeOfUnsignedVarint(_stringBytes.length + 1));
}
{
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(partitions.size() + 1));
for (PartitionResponse partitionsElement : partitions) {
partitionsElement.addSize(_size, _cache, _version);
}
}
if (_unknownTaggedFields != null) {
_numTaggedFields += _unknownTaggedFields.size();
for (RawTaggedField _field : _unknownTaggedFields) {
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.tag()));
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.size()));
_size.addBytes(_field.size());
}
}
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_numTaggedFields));
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof TopicResponse)) return false;
TopicResponse other = (TopicResponse) obj;
if (this.name == null) {
if (other.name != null) return false;
} else {
if (!this.name.equals(other.name)) return false;
}
if (this.partitions == null) {
if (other.partitions != null) return false;
} else {
if (!this.partitions.equals(other.partitions)) return false;
}
return MessageUtil.compareRawTaggedFields(_unknownTaggedFields, other._unknownTaggedFields);
}
@Override
public int hashCode() {
int hashCode = 0;
hashCode = 31 * hashCode + (name == null ? 0 : name.hashCode());
hashCode = 31 * hashCode + (partitions == null ? 0 : partitions.hashCode());
return hashCode;
}
@Override
public TopicResponse duplicate() {
TopicResponse _duplicate = new TopicResponse();
_duplicate.name = name;
ArrayList newPartitions = new ArrayList(partitions.size());
for (PartitionResponse _element : partitions) {
newPartitions.add(_element.duplicate());
}
_duplicate.partitions = newPartitions;
return _duplicate;
}
@Override
public String toString() {
return "TopicResponse("
+ "name=" + ((name == null) ? "null" : "'" + name.toString() + "'")
+ ", partitions=" + MessageUtil.deepToString(partitions.iterator())
+ ")";
}
public String name() {
return this.name;
}
public List partitions() {
return this.partitions;
}
@Override
public List unknownTaggedFields() {
if (_unknownTaggedFields == null) {
_unknownTaggedFields = new ArrayList<>(0);
}
return _unknownTaggedFields;
}
public TopicResponse setName(String v) {
this.name = v;
return this;
}
public TopicResponse setPartitions(List v) {
this.partitions = v;
return this;
}
}
public static class PartitionResponse implements Message {
int partitionIndex;
short errorCode;
String errorMessage;
List activeProducers;
private List _unknownTaggedFields;
public static final Schema SCHEMA_0 =
new Schema(
new Field("partition_index", Type.INT32, "The partition index."),
new Field("error_code", Type.INT16, "The partition error code, or 0 if there was no error."),
new Field("error_message", Type.COMPACT_NULLABLE_STRING, "The partition error message, which may be null if no additional details are available"),
new Field("active_producers", new CompactArrayOf(ProducerState.SCHEMA_0), ""),
TaggedFieldsSection.of(
)
);
public static final Schema[] SCHEMAS = new Schema[] {
SCHEMA_0
};
public static final short LOWEST_SUPPORTED_VERSION = 0;
public static final short HIGHEST_SUPPORTED_VERSION = 0;
public PartitionResponse(Readable _readable, short _version) {
read(_readable, _version);
}
public PartitionResponse() {
this.partitionIndex = 0;
this.errorCode = (short) 0;
this.errorMessage = null;
this.activeProducers = new ArrayList(0);
}
@Override
public short lowestSupportedVersion() {
return 0;
}
@Override
public short highestSupportedVersion() {
return 0;
}
@Override
public void read(Readable _readable, short _version) {
if (_version > 0) {
throw new UnsupportedVersionException("Can't read version " + _version + " of PartitionResponse");
}
this.partitionIndex = _readable.readInt();
this.errorCode = _readable.readShort();
{
int length;
length = _readable.readUnsignedVarint() - 1;
if (length < 0) {
this.errorMessage = null;
} else if (length > 0x7fff) {
throw new RuntimeException("string field errorMessage had invalid length " + length);
} else {
this.errorMessage = _readable.readString(length);
}
}
{
int arrayLength;
arrayLength = _readable.readUnsignedVarint() - 1;
if (arrayLength < 0) {
throw new RuntimeException("non-nullable field activeProducers was serialized as null");
} else {
if (arrayLength > _readable.remaining()) {
throw new RuntimeException("Tried to allocate a collection of size " + arrayLength + ", but there are only " + _readable.remaining() + " bytes remaining.");
}
ArrayList newCollection = new ArrayList<>(arrayLength);
for (int i = 0; i < arrayLength; i++) {
newCollection.add(new ProducerState(_readable, _version));
}
this.activeProducers = newCollection;
}
}
this._unknownTaggedFields = null;
int _numTaggedFields = _readable.readUnsignedVarint();
for (int _i = 0; _i < _numTaggedFields; _i++) {
int _tag = _readable.readUnsignedVarint();
int _size = _readable.readUnsignedVarint();
switch (_tag) {
default:
this._unknownTaggedFields = _readable.readUnknownTaggedField(this._unknownTaggedFields, _tag, _size);
break;
}
}
}
@Override
public void write(Writable _writable, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
_writable.writeInt(partitionIndex);
_writable.writeShort(errorCode);
if (errorMessage == null) {
_writable.writeUnsignedVarint(0);
} else {
byte[] _stringBytes = _cache.getSerializedValue(errorMessage);
_writable.writeUnsignedVarint(_stringBytes.length + 1);
_writable.writeByteArray(_stringBytes);
}
_writable.writeUnsignedVarint(activeProducers.size() + 1);
for (ProducerState activeProducersElement : activeProducers) {
activeProducersElement.write(_writable, _cache, _version);
}
RawTaggedFieldWriter _rawWriter = RawTaggedFieldWriter.forFields(_unknownTaggedFields);
_numTaggedFields += _rawWriter.numFields();
_writable.writeUnsignedVarint(_numTaggedFields);
_rawWriter.writeRawTags(_writable, Integer.MAX_VALUE);
}
@Override
public void addSize(MessageSizeAccumulator _size, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
if (_version > 0) {
throw new UnsupportedVersionException("Can't size version " + _version + " of PartitionResponse");
}
_size.addBytes(4);
_size.addBytes(2);
if (errorMessage == null) {
_size.addBytes(1);
} else {
byte[] _stringBytes = errorMessage.getBytes(StandardCharsets.UTF_8);
if (_stringBytes.length > 0x7fff) {
throw new RuntimeException("'errorMessage' field is too long to be serialized");
}
_cache.cacheSerializedValue(errorMessage, _stringBytes);
_size.addBytes(_stringBytes.length + ByteUtils.sizeOfUnsignedVarint(_stringBytes.length + 1));
}
{
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(activeProducers.size() + 1));
for (ProducerState activeProducersElement : activeProducers) {
activeProducersElement.addSize(_size, _cache, _version);
}
}
if (_unknownTaggedFields != null) {
_numTaggedFields += _unknownTaggedFields.size();
for (RawTaggedField _field : _unknownTaggedFields) {
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.tag()));
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.size()));
_size.addBytes(_field.size());
}
}
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_numTaggedFields));
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof PartitionResponse)) return false;
PartitionResponse other = (PartitionResponse) obj;
if (partitionIndex != other.partitionIndex) return false;
if (errorCode != other.errorCode) return false;
if (this.errorMessage == null) {
if (other.errorMessage != null) return false;
} else {
if (!this.errorMessage.equals(other.errorMessage)) return false;
}
if (this.activeProducers == null) {
if (other.activeProducers != null) return false;
} else {
if (!this.activeProducers.equals(other.activeProducers)) return false;
}
return MessageUtil.compareRawTaggedFields(_unknownTaggedFields, other._unknownTaggedFields);
}
@Override
public int hashCode() {
int hashCode = 0;
hashCode = 31 * hashCode + partitionIndex;
hashCode = 31 * hashCode + errorCode;
hashCode = 31 * hashCode + (errorMessage == null ? 0 : errorMessage.hashCode());
hashCode = 31 * hashCode + (activeProducers == null ? 0 : activeProducers.hashCode());
return hashCode;
}
@Override
public PartitionResponse duplicate() {
PartitionResponse _duplicate = new PartitionResponse();
_duplicate.partitionIndex = partitionIndex;
_duplicate.errorCode = errorCode;
if (errorMessage == null) {
_duplicate.errorMessage = null;
} else {
_duplicate.errorMessage = errorMessage;
}
ArrayList newActiveProducers = new ArrayList(activeProducers.size());
for (ProducerState _element : activeProducers) {
newActiveProducers.add(_element.duplicate());
}
_duplicate.activeProducers = newActiveProducers;
return _duplicate;
}
@Override
public String toString() {
return "PartitionResponse("
+ "partitionIndex=" + partitionIndex
+ ", errorCode=" + errorCode
+ ", errorMessage=" + ((errorMessage == null) ? "null" : "'" + errorMessage.toString() + "'")
+ ", activeProducers=" + MessageUtil.deepToString(activeProducers.iterator())
+ ")";
}
public int partitionIndex() {
return this.partitionIndex;
}
public short errorCode() {
return this.errorCode;
}
public String errorMessage() {
return this.errorMessage;
}
public List activeProducers() {
return this.activeProducers;
}
@Override
public List unknownTaggedFields() {
if (_unknownTaggedFields == null) {
_unknownTaggedFields = new ArrayList<>(0);
}
return _unknownTaggedFields;
}
public PartitionResponse setPartitionIndex(int v) {
this.partitionIndex = v;
return this;
}
public PartitionResponse setErrorCode(short v) {
this.errorCode = v;
return this;
}
public PartitionResponse setErrorMessage(String v) {
this.errorMessage = v;
return this;
}
public PartitionResponse setActiveProducers(List v) {
this.activeProducers = v;
return this;
}
}
public static class ProducerState implements Message {
long producerId;
int producerEpoch;
int lastSequence;
long lastTimestamp;
int coordinatorEpoch;
long currentTxnStartOffset;
private List _unknownTaggedFields;
public static final Schema SCHEMA_0 =
new Schema(
new Field("producer_id", Type.INT64, ""),
new Field("producer_epoch", Type.INT32, ""),
new Field("last_sequence", Type.INT32, ""),
new Field("last_timestamp", Type.INT64, ""),
new Field("coordinator_epoch", Type.INT32, ""),
new Field("current_txn_start_offset", Type.INT64, ""),
TaggedFieldsSection.of(
)
);
public static final Schema[] SCHEMAS = new Schema[] {
SCHEMA_0
};
public static final short LOWEST_SUPPORTED_VERSION = 0;
public static final short HIGHEST_SUPPORTED_VERSION = 0;
public ProducerState(Readable _readable, short _version) {
read(_readable, _version);
}
public ProducerState() {
this.producerId = 0L;
this.producerEpoch = 0;
this.lastSequence = -1;
this.lastTimestamp = -1L;
this.coordinatorEpoch = 0;
this.currentTxnStartOffset = -1L;
}
@Override
public short lowestSupportedVersion() {
return 0;
}
@Override
public short highestSupportedVersion() {
return 0;
}
@Override
public void read(Readable _readable, short _version) {
if (_version > 0) {
throw new UnsupportedVersionException("Can't read version " + _version + " of ProducerState");
}
this.producerId = _readable.readLong();
this.producerEpoch = _readable.readInt();
this.lastSequence = _readable.readInt();
this.lastTimestamp = _readable.readLong();
this.coordinatorEpoch = _readable.readInt();
this.currentTxnStartOffset = _readable.readLong();
this._unknownTaggedFields = null;
int _numTaggedFields = _readable.readUnsignedVarint();
for (int _i = 0; _i < _numTaggedFields; _i++) {
int _tag = _readable.readUnsignedVarint();
int _size = _readable.readUnsignedVarint();
switch (_tag) {
default:
this._unknownTaggedFields = _readable.readUnknownTaggedField(this._unknownTaggedFields, _tag, _size);
break;
}
}
}
@Override
public void write(Writable _writable, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
_writable.writeLong(producerId);
_writable.writeInt(producerEpoch);
_writable.writeInt(lastSequence);
_writable.writeLong(lastTimestamp);
_writable.writeInt(coordinatorEpoch);
_writable.writeLong(currentTxnStartOffset);
RawTaggedFieldWriter _rawWriter = RawTaggedFieldWriter.forFields(_unknownTaggedFields);
_numTaggedFields += _rawWriter.numFields();
_writable.writeUnsignedVarint(_numTaggedFields);
_rawWriter.writeRawTags(_writable, Integer.MAX_VALUE);
}
@Override
public void addSize(MessageSizeAccumulator _size, ObjectSerializationCache _cache, short _version) {
int _numTaggedFields = 0;
if (_version > 0) {
throw new UnsupportedVersionException("Can't size version " + _version + " of ProducerState");
}
_size.addBytes(8);
_size.addBytes(4);
_size.addBytes(4);
_size.addBytes(8);
_size.addBytes(4);
_size.addBytes(8);
if (_unknownTaggedFields != null) {
_numTaggedFields += _unknownTaggedFields.size();
for (RawTaggedField _field : _unknownTaggedFields) {
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.tag()));
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_field.size()));
_size.addBytes(_field.size());
}
}
_size.addBytes(ByteUtils.sizeOfUnsignedVarint(_numTaggedFields));
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ProducerState)) return false;
ProducerState other = (ProducerState) obj;
if (producerId != other.producerId) return false;
if (producerEpoch != other.producerEpoch) return false;
if (lastSequence != other.lastSequence) return false;
if (lastTimestamp != other.lastTimestamp) return false;
if (coordinatorEpoch != other.coordinatorEpoch) return false;
if (currentTxnStartOffset != other.currentTxnStartOffset) return false;
return MessageUtil.compareRawTaggedFields(_unknownTaggedFields, other._unknownTaggedFields);
}
@Override
public int hashCode() {
int hashCode = 0;
hashCode = 31 * hashCode + ((int) (producerId >> 32) ^ (int) producerId);
hashCode = 31 * hashCode + producerEpoch;
hashCode = 31 * hashCode + lastSequence;
hashCode = 31 * hashCode + ((int) (lastTimestamp >> 32) ^ (int) lastTimestamp);
hashCode = 31 * hashCode + coordinatorEpoch;
hashCode = 31 * hashCode + ((int) (currentTxnStartOffset >> 32) ^ (int) currentTxnStartOffset);
return hashCode;
}
@Override
public ProducerState duplicate() {
ProducerState _duplicate = new ProducerState();
_duplicate.producerId = producerId;
_duplicate.producerEpoch = producerEpoch;
_duplicate.lastSequence = lastSequence;
_duplicate.lastTimestamp = lastTimestamp;
_duplicate.coordinatorEpoch = coordinatorEpoch;
_duplicate.currentTxnStartOffset = currentTxnStartOffset;
return _duplicate;
}
@Override
public String toString() {
return "ProducerState("
+ "producerId=" + producerId
+ ", producerEpoch=" + producerEpoch
+ ", lastSequence=" + lastSequence
+ ", lastTimestamp=" + lastTimestamp
+ ", coordinatorEpoch=" + coordinatorEpoch
+ ", currentTxnStartOffset=" + currentTxnStartOffset
+ ")";
}
public long producerId() {
return this.producerId;
}
public int producerEpoch() {
return this.producerEpoch;
}
public int lastSequence() {
return this.lastSequence;
}
public long lastTimestamp() {
return this.lastTimestamp;
}
public int coordinatorEpoch() {
return this.coordinatorEpoch;
}
public long currentTxnStartOffset() {
return this.currentTxnStartOffset;
}
@Override
public List unknownTaggedFields() {
if (_unknownTaggedFields == null) {
_unknownTaggedFields = new ArrayList<>(0);
}
return _unknownTaggedFields;
}
public ProducerState setProducerId(long v) {
this.producerId = v;
return this;
}
public ProducerState setProducerEpoch(int v) {
this.producerEpoch = v;
return this;
}
public ProducerState setLastSequence(int v) {
this.lastSequence = v;
return this;
}
public ProducerState setLastTimestamp(long v) {
this.lastTimestamp = v;
return this;
}
public ProducerState setCoordinatorEpoch(int v) {
this.coordinatorEpoch = v;
return this;
}
public ProducerState setCurrentTxnStartOffset(long v) {
this.currentTxnStartOffset = v;
return this;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy