io.zeebe.clustering.raft.LeaveResponseDecoder Maven / Gradle / Ivy
/* Generated SBE (Simple Binary Encoding) message codec */
package io.zeebe.clustering.raft;
import org.agrona.MutableDirectBuffer;
import org.agrona.DirectBuffer;
import org.agrona.sbe.*;
@javax.annotation.Generated(value = {"io.zeebe.clustering.raft.LeaveResponseDecoder"})
@SuppressWarnings("all")
public class LeaveResponseDecoder implements MessageDecoderFlyweight
{
public static final int BLOCK_LENGTH = 15;
public static final int TEMPLATE_ID = 3;
public static final int SCHEMA_ID = 4;
public static final int SCHEMA_VERSION = 1;
private final LeaveResponseDecoder parentMessage = this;
private DirectBuffer buffer;
protected int offset;
protected int limit;
protected int actingBlockLength;
protected int actingVersion;
public int sbeBlockLength()
{
return BLOCK_LENGTH;
}
public int sbeTemplateId()
{
return TEMPLATE_ID;
}
public int sbeSchemaId()
{
return SCHEMA_ID;
}
public int sbeSchemaVersion()
{
return SCHEMA_VERSION;
}
public String sbeSemanticType()
{
return "";
}
public DirectBuffer buffer()
{
return buffer;
}
public int offset()
{
return offset;
}
public LeaveResponseDecoder wrap(
final DirectBuffer buffer, final int offset, final int actingBlockLength, final int actingVersion)
{
this.buffer = buffer;
this.offset = offset;
this.actingBlockLength = actingBlockLength;
this.actingVersion = actingVersion;
limit(offset + actingBlockLength);
return this;
}
public int encodedLength()
{
return limit - offset;
}
public int limit()
{
return limit;
}
public void limit(final int limit)
{
this.limit = limit;
}
public static int termId()
{
return 1;
}
public static int termSinceVersion()
{
return 0;
}
public static int termEncodingOffset()
{
return 0;
}
public static int termEncodingLength()
{
return 2;
}
public static String termMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public static int termNullValue()
{
return 65535;
}
public static int termMinValue()
{
return 0;
}
public static int termMaxValue()
{
return 65534;
}
public int term()
{
return (buffer.getShort(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
}
public static int succeededId()
{
return 3;
}
public static int succeededSinceVersion()
{
return 0;
}
public static int succeededEncodingOffset()
{
return 2;
}
public static int succeededEncodingLength()
{
return 1;
}
public static String succeededMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public BooleanType succeeded()
{
return BooleanType.get(((short)(buffer.getByte(offset + 2) & 0xFF)));
}
public static int configurationEntryPositionId()
{
return 4;
}
public static int configurationEntryPositionSinceVersion()
{
return 0;
}
public static int configurationEntryPositionEncodingOffset()
{
return 3;
}
public static int configurationEntryPositionEncodingLength()
{
return 8;
}
public static String configurationEntryPositionMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public static long configurationEntryPositionNullValue()
{
return 0xffffffffffffffffL;
}
public static long configurationEntryPositionMinValue()
{
return 0x0L;
}
public static long configurationEntryPositionMaxValue()
{
return 0xfffffffffffffffeL;
}
public long configurationEntryPosition()
{
return buffer.getLong(offset + 3, java.nio.ByteOrder.LITTLE_ENDIAN);
}
public static int configurationEntryTermId()
{
return 5;
}
public static int configurationEntryTermSinceVersion()
{
return 0;
}
public static int configurationEntryTermEncodingOffset()
{
return 11;
}
public static int configurationEntryTermEncodingLength()
{
return 4;
}
public static String configurationEntryTermMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public static int configurationEntryTermNullValue()
{
return -2147483648;
}
public static int configurationEntryTermMinValue()
{
return -2147483647;
}
public static int configurationEntryTermMaxValue()
{
return 2147483647;
}
public int configurationEntryTerm()
{
return buffer.getInt(offset + 11, java.nio.ByteOrder.LITTLE_ENDIAN);
}
private final MembersDecoder members = new MembersDecoder();
public static long membersDecoderId()
{
return 6;
}
public static int membersDecoderSinceVersion()
{
return 0;
}
public MembersDecoder members()
{
members.wrap(parentMessage, buffer);
return members;
}
public static class MembersDecoder
implements Iterable, java.util.Iterator
{
private static final int HEADER_SIZE = 3;
private final GroupSizeEncodingDecoder dimensions = new GroupSizeEncodingDecoder();
private LeaveResponseDecoder parentMessage;
private DirectBuffer buffer;
private int count;
private int index;
private int offset;
private int blockLength;
public void wrap(
final LeaveResponseDecoder parentMessage, final DirectBuffer buffer)
{
this.parentMessage = parentMessage;
this.buffer = buffer;
dimensions.wrap(buffer, parentMessage.limit());
blockLength = dimensions.blockLength();
count = dimensions.numInGroup();
index = -1;
parentMessage.limit(parentMessage.limit() + HEADER_SIZE);
}
public static int sbeHeaderSize()
{
return HEADER_SIZE;
}
public static int sbeBlockLength()
{
return 2;
}
public int actingBlockLength()
{
return blockLength;
}
public int count()
{
return count;
}
public java.util.Iterator iterator()
{
return this;
}
public void remove()
{
throw new UnsupportedOperationException();
}
public boolean hasNext()
{
return (index + 1) < count;
}
public MembersDecoder next()
{
if (index + 1 >= count)
{
throw new java.util.NoSuchElementException();
}
offset = parentMessage.limit();
parentMessage.limit(offset + blockLength);
++index;
return this;
}
public static int portId()
{
return 7;
}
public static int portSinceVersion()
{
return 0;
}
public static int portEncodingOffset()
{
return 0;
}
public static int portEncodingLength()
{
return 2;
}
public static String portMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public static int portNullValue()
{
return 65535;
}
public static int portMinValue()
{
return 0;
}
public static int portMaxValue()
{
return 65534;
}
public int port()
{
return (buffer.getShort(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
}
public static int hostId()
{
return 8;
}
public static int hostSinceVersion()
{
return 0;
}
public static String hostCharacterEncoding()
{
return "UTF-8";
}
public static String hostMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "";
}
return "";
}
public static int hostHeaderLength()
{
return 2;
}
public int hostLength()
{
final int limit = parentMessage.limit();
return (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
}
public int getHost(final MutableDirectBuffer dst, final int dstOffset, final int length)
{
final int headerLength = 2;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
final int bytesCopied = Math.min(length, dataLength);
parentMessage.limit(limit + headerLength + dataLength);
buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);
return bytesCopied;
}
public int getHost(final byte[] dst, final int dstOffset, final int length)
{
final int headerLength = 2;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
final int bytesCopied = Math.min(length, dataLength);
parentMessage.limit(limit + headerLength + dataLength);
buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);
return bytesCopied;
}
public String host()
{
final int headerLength = 2;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getShort(limit, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
parentMessage.limit(limit + headerLength + dataLength);
final byte[] tmp = new byte[dataLength];
buffer.getBytes(limit + headerLength, tmp, 0, dataLength);
final String value;
try
{
value = new String(tmp, "UTF-8");
}
catch (final java.io.UnsupportedEncodingException ex)
{
throw new RuntimeException(ex);
}
return value;
}
public String toString()
{
return appendTo(new StringBuilder(100)).toString();
}
public StringBuilder appendTo(final StringBuilder builder)
{
builder.append('(');
//Token{signal=BEGIN_FIELD, name='port', description='null', id=7, version=0, deprecated=0, encodedLength=0, offset=0, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
//Token{signal=ENCODING, name='uint16', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
builder.append("port=");
builder.append(port());
builder.append('|');
//Token{signal=BEGIN_VAR_DATA, name='host', description='null', id=8, version=0, deprecated=0, encodedLength=0, offset=2, componentTokenCount=6, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
builder.append("host=");
builder.append(host());
builder.append(')');
return builder;
}
}
public String toString()
{
return appendTo(new StringBuilder(100)).toString();
}
public StringBuilder appendTo(final StringBuilder builder)
{
final int originalLimit = limit();
limit(offset + actingBlockLength);
builder.append("[LeaveResponse](sbeTemplateId=");
builder.append(TEMPLATE_ID);
builder.append("|sbeSchemaId=");
builder.append(SCHEMA_ID);
builder.append("|sbeSchemaVersion=");
if (parentMessage.actingVersion != SCHEMA_VERSION)
{
builder.append(parentMessage.actingVersion);
builder.append('/');
}
builder.append(SCHEMA_VERSION);
builder.append("|sbeBlockLength=");
if (actingBlockLength != BLOCK_LENGTH)
{
builder.append(actingBlockLength);
builder.append('/');
}
builder.append(BLOCK_LENGTH);
builder.append("):");
//Token{signal=BEGIN_FIELD, name='term', description='null', id=1, version=0, deprecated=0, encodedLength=0, offset=0, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
//Token{signal=ENCODING, name='uint16', description='null', id=-1, version=0, deprecated=0, encodedLength=2, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT16, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
builder.append("term=");
builder.append(term());
builder.append('|');
//Token{signal=BEGIN_FIELD, name='succeeded', description='null', id=3, version=0, deprecated=0, encodedLength=0, offset=2, componentTokenCount=6, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
//Token{signal=BEGIN_ENUM, name='BooleanType', description='null', id=-1, version=0, deprecated=0, encodedLength=1, offset=2, componentTokenCount=4, encoding=Encoding{presence=REQUIRED, primitiveType=UINT8, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='Boolean'}}
builder.append("succeeded=");
builder.append(succeeded());
builder.append('|');
//Token{signal=BEGIN_FIELD, name='configurationEntryPosition', description='null', id=4, version=0, deprecated=0, encodedLength=0, offset=3, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
//Token{signal=ENCODING, name='uint64', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=3, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=UINT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
builder.append("configurationEntryPosition=");
builder.append(configurationEntryPosition());
builder.append('|');
//Token{signal=BEGIN_FIELD, name='configurationEntryTerm', description='null', id=5, version=0, deprecated=0, encodedLength=0, offset=11, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
//Token{signal=ENCODING, name='int32', description='null', id=-1, version=0, deprecated=0, encodedLength=4, offset=11, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
builder.append("configurationEntryTerm=");
builder.append(configurationEntryTerm());
builder.append('|');
//Token{signal=BEGIN_GROUP, name='members', description='null', id=6, version=0, deprecated=0, encodedLength=2, offset=15, componentTokenCount=15, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}}
builder.append("members=[");
MembersDecoder members = members();
if (members.count() > 0)
{
while (members.hasNext())
{
members.next().appendTo(builder);
builder.append(',');
}
builder.setLength(builder.length() - 1);
}
builder.append(']');
limit(originalLimit);
return builder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy