
io.aeron.archive.codecs.BoundedReplayRequestDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aeron-all Show documentation
Show all versions of aeron-all Show documentation
Efficient reliable UDP unicast, UDP multicast, and IPC transport protocol.
/* Generated SBE (Simple Binary Encoding) message codec. */
package io.aeron.archive.codecs;
import org.agrona.MutableDirectBuffer;
import org.agrona.DirectBuffer;
/**
* Replay recording range request bounded by a position counter.
*/
@SuppressWarnings("all")
public final class BoundedReplayRequestDecoder
{
public static final int BLOCK_LENGTH = 60;
public static final int TEMPLATE_ID = 18;
public static final int SCHEMA_ID = 101;
public static final int SCHEMA_VERSION = 10;
public static final String SEMANTIC_VERSION = "5.2";
public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;
private final BoundedReplayRequestDecoder parentMessage = this;
private DirectBuffer buffer;
private int offset;
private int limit;
int actingBlockLength;
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 BoundedReplayRequestDecoder wrap(
final DirectBuffer buffer,
final int offset,
final int actingBlockLength,
final int actingVersion)
{
if (buffer != this.buffer)
{
this.buffer = buffer;
}
this.offset = offset;
this.actingBlockLength = actingBlockLength;
this.actingVersion = actingVersion;
limit(offset + actingBlockLength);
return this;
}
public BoundedReplayRequestDecoder wrapAndApplyHeader(
final DirectBuffer buffer,
final int offset,
final MessageHeaderDecoder headerDecoder)
{
headerDecoder.wrap(buffer, offset);
final int templateId = headerDecoder.templateId();
if (TEMPLATE_ID != templateId)
{
throw new IllegalStateException("Invalid TEMPLATE_ID: " + templateId);
}
return wrap(
buffer,
offset + MessageHeaderDecoder.ENCODED_LENGTH,
headerDecoder.blockLength(),
headerDecoder.version());
}
public BoundedReplayRequestDecoder sbeRewind()
{
return wrap(buffer, offset, actingBlockLength, actingVersion);
}
public int sbeDecodedLength()
{
final int currentLimit = limit();
sbeSkip();
final int decodedLength = encodedLength();
limit(currentLimit);
return decodedLength;
}
public int actingVersion()
{
return actingVersion;
}
public int encodedLength()
{
return limit - offset;
}
public int limit()
{
return limit;
}
public void limit(final int limit)
{
this.limit = limit;
}
public static int controlSessionIdId()
{
return 1;
}
public static int controlSessionIdSinceVersion()
{
return 0;
}
public static int controlSessionIdEncodingOffset()
{
return 0;
}
public static int controlSessionIdEncodingLength()
{
return 8;
}
public static String controlSessionIdMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long controlSessionIdNullValue()
{
return -9223372036854775808L;
}
public static long controlSessionIdMinValue()
{
return -9223372036854775807L;
}
public static long controlSessionIdMaxValue()
{
return 9223372036854775807L;
}
public long controlSessionId()
{
return buffer.getLong(offset + 0, BYTE_ORDER);
}
public static int correlationIdId()
{
return 2;
}
public static int correlationIdSinceVersion()
{
return 0;
}
public static int correlationIdEncodingOffset()
{
return 8;
}
public static int correlationIdEncodingLength()
{
return 8;
}
public static String correlationIdMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long correlationIdNullValue()
{
return -9223372036854775808L;
}
public static long correlationIdMinValue()
{
return -9223372036854775807L;
}
public static long correlationIdMaxValue()
{
return 9223372036854775807L;
}
public long correlationId()
{
return buffer.getLong(offset + 8, BYTE_ORDER);
}
public static int recordingIdId()
{
return 3;
}
public static int recordingIdSinceVersion()
{
return 0;
}
public static int recordingIdEncodingOffset()
{
return 16;
}
public static int recordingIdEncodingLength()
{
return 8;
}
public static String recordingIdMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long recordingIdNullValue()
{
return -9223372036854775808L;
}
public static long recordingIdMinValue()
{
return -9223372036854775807L;
}
public static long recordingIdMaxValue()
{
return 9223372036854775807L;
}
public long recordingId()
{
return buffer.getLong(offset + 16, BYTE_ORDER);
}
public static int positionId()
{
return 4;
}
public static int positionSinceVersion()
{
return 0;
}
public static int positionEncodingOffset()
{
return 24;
}
public static int positionEncodingLength()
{
return 8;
}
public static String positionMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long positionNullValue()
{
return -9223372036854775808L;
}
public static long positionMinValue()
{
return -9223372036854775807L;
}
public static long positionMaxValue()
{
return 9223372036854775807L;
}
public long position()
{
return buffer.getLong(offset + 24, BYTE_ORDER);
}
public static int lengthId()
{
return 5;
}
public static int lengthSinceVersion()
{
return 0;
}
public static int lengthEncodingOffset()
{
return 32;
}
public static int lengthEncodingLength()
{
return 8;
}
public static String lengthMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long lengthNullValue()
{
return -9223372036854775808L;
}
public static long lengthMinValue()
{
return -9223372036854775807L;
}
public static long lengthMaxValue()
{
return 9223372036854775807L;
}
public long length()
{
return buffer.getLong(offset + 32, BYTE_ORDER);
}
public static int limitCounterIdId()
{
return 6;
}
public static int limitCounterIdSinceVersion()
{
return 0;
}
public static int limitCounterIdEncodingOffset()
{
return 40;
}
public static int limitCounterIdEncodingLength()
{
return 4;
}
public static String limitCounterIdMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static int limitCounterIdNullValue()
{
return -2147483648;
}
public static int limitCounterIdMinValue()
{
return -2147483647;
}
public static int limitCounterIdMaxValue()
{
return 2147483647;
}
public int limitCounterId()
{
return buffer.getInt(offset + 40, BYTE_ORDER);
}
public static int replayStreamIdId()
{
return 7;
}
public static int replayStreamIdSinceVersion()
{
return 0;
}
public static int replayStreamIdEncodingOffset()
{
return 44;
}
public static int replayStreamIdEncodingLength()
{
return 4;
}
public static String replayStreamIdMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static int replayStreamIdNullValue()
{
return -2147483648;
}
public static int replayStreamIdMinValue()
{
return -2147483647;
}
public static int replayStreamIdMaxValue()
{
return 2147483647;
}
public int replayStreamId()
{
return buffer.getInt(offset + 44, BYTE_ORDER);
}
public static int fileIoMaxLengthId()
{
return 9;
}
public static int fileIoMaxLengthSinceVersion()
{
return 7;
}
public static int fileIoMaxLengthEncodingOffset()
{
return 48;
}
public static int fileIoMaxLengthEncodingLength()
{
return 4;
}
public static String fileIoMaxLengthMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static int fileIoMaxLengthNullValue()
{
return -2147483648;
}
public static int fileIoMaxLengthMinValue()
{
return -2147483647;
}
public static int fileIoMaxLengthMaxValue()
{
return 2147483647;
}
public int fileIoMaxLength()
{
if (parentMessage.actingVersion < 7)
{
return -2147483648;
}
return buffer.getInt(offset + 48, BYTE_ORDER);
}
public static int replayTokenId()
{
return 10;
}
public static int replayTokenSinceVersion()
{
return 10;
}
public static int replayTokenEncodingOffset()
{
return 52;
}
public static int replayTokenEncodingLength()
{
return 8;
}
public static String replayTokenMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static long replayTokenNullValue()
{
return -9223372036854775808L;
}
public static long replayTokenMinValue()
{
return -9223372036854775807L;
}
public static long replayTokenMaxValue()
{
return 9223372036854775807L;
}
public long replayToken()
{
if (parentMessage.actingVersion < 10)
{
return -9223372036854775808L;
}
return buffer.getLong(offset + 52, BYTE_ORDER);
}
public static int replayChannelId()
{
return 8;
}
public static int replayChannelSinceVersion()
{
return 0;
}
public static String replayChannelCharacterEncoding()
{
return java.nio.charset.StandardCharsets.US_ASCII.name();
}
public static String replayChannelMetaAttribute(final MetaAttribute metaAttribute)
{
if (MetaAttribute.PRESENCE == metaAttribute)
{
return "required";
}
return "";
}
public static int replayChannelHeaderLength()
{
return 4;
}
public int replayChannelLength()
{
final int limit = parentMessage.limit();
return (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
}
public int skipReplayChannel()
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
final int dataOffset = limit + headerLength;
parentMessage.limit(dataOffset + dataLength);
return dataLength;
}
public int getReplayChannel(final MutableDirectBuffer dst, final int dstOffset, final int length)
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
final int bytesCopied = Math.min(length, dataLength);
parentMessage.limit(limit + headerLength + dataLength);
buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);
return bytesCopied;
}
public int getReplayChannel(final byte[] dst, final int dstOffset, final int length)
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
final int bytesCopied = Math.min(length, dataLength);
parentMessage.limit(limit + headerLength + dataLength);
buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);
return bytesCopied;
}
public void wrapReplayChannel(final DirectBuffer wrapBuffer)
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
parentMessage.limit(limit + headerLength + dataLength);
wrapBuffer.wrap(buffer, limit + headerLength, dataLength);
}
public String replayChannel()
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
parentMessage.limit(limit + headerLength + dataLength);
if (0 == dataLength)
{
return "";
}
final byte[] tmp = new byte[dataLength];
buffer.getBytes(limit + headerLength, tmp, 0, dataLength);
return new String(tmp, java.nio.charset.StandardCharsets.US_ASCII);
}
public int getReplayChannel(final Appendable appendable)
{
final int headerLength = 4;
final int limit = parentMessage.limit();
final int dataLength = (int)(buffer.getInt(limit, BYTE_ORDER) & 0xFFFF_FFFFL);
final int dataOffset = limit + headerLength;
parentMessage.limit(dataOffset + dataLength);
buffer.getStringWithoutLengthAscii(dataOffset, dataLength, appendable);
return dataLength;
}
public String toString()
{
if (null == buffer)
{
return "";
}
final BoundedReplayRequestDecoder decoder = new BoundedReplayRequestDecoder();
decoder.wrap(buffer, offset, actingBlockLength, actingVersion);
return decoder.appendTo(new StringBuilder()).toString();
}
public StringBuilder appendTo(final StringBuilder builder)
{
if (null == buffer)
{
return builder;
}
final int originalLimit = limit();
limit(offset + actingBlockLength);
builder.append("[BoundedReplayRequest](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("):");
builder.append("controlSessionId=");
builder.append(this.controlSessionId());
builder.append('|');
builder.append("correlationId=");
builder.append(this.correlationId());
builder.append('|');
builder.append("recordingId=");
builder.append(this.recordingId());
builder.append('|');
builder.append("position=");
builder.append(this.position());
builder.append('|');
builder.append("length=");
builder.append(this.length());
builder.append('|');
builder.append("limitCounterId=");
builder.append(this.limitCounterId());
builder.append('|');
builder.append("replayStreamId=");
builder.append(this.replayStreamId());
builder.append('|');
builder.append("fileIoMaxLength=");
builder.append(this.fileIoMaxLength());
builder.append('|');
builder.append("replayToken=");
builder.append(this.replayToken());
builder.append('|');
builder.append("replayChannel=");
builder.append('\'');
getReplayChannel(builder);
builder.append('\'');
limit(originalLimit);
return builder;
}
public BoundedReplayRequestDecoder sbeSkip()
{
sbeRewind();
skipReplayChannel();
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy