Package org.agrona.concurrent.ringbuffer
Class RecordDescriptor
- java.lang.Object
-
- org.agrona.concurrent.ringbuffer.RecordDescriptor
-
public final class RecordDescriptor extends java.lang.Object
Description of the record structure for message framing in the aRingBuffer
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALIGNMENT
Alignment as a multiple of bytes for each record.static int
HEADER_LENGTH
Header length made up of fields for length, type, and then the encoded message.
-
Constructor Summary
Constructors Modifier Constructor Description private
RecordDescriptor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkTypeId(int msgTypeId)
Check that and message id is in the valid range.static int
encodedMsgOffset(int recordOffset)
The offset from the beginning of a record at which the encoded message begins.static int
lengthOffset(int recordOffset)
The offset from the beginning of a record at which the message length field begins.static int
typeOffset(int recordOffset)
The offset from the beginning of a record at which the message type field begins.
-
-
-
Field Detail
-
HEADER_LENGTH
public static final int HEADER_LENGTH
Header length made up of fields for length, type, and then the encoded message.Writing of a positive record length signals the message recording is complete.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | +---------------------------------------------------------------+ | Type | +---------------------------------------------------------------+ | Encoded Message ... ... | +---------------------------------------------------------------+
- See Also:
- Constant Field Values
-
ALIGNMENT
public static final int ALIGNMENT
Alignment as a multiple of bytes for each record.- See Also:
- Constant Field Values
-
-
Method Detail
-
lengthOffset
public static int lengthOffset(int recordOffset)
The offset from the beginning of a record at which the message length field begins.- Parameters:
recordOffset
- beginning index of the record.- Returns:
- offset from the beginning of a record at which the type field begins.
-
typeOffset
public static int typeOffset(int recordOffset)
The offset from the beginning of a record at which the message type field begins.- Parameters:
recordOffset
- beginning index of the record.- Returns:
- offset from the beginning of a record at which the type field begins.
-
encodedMsgOffset
public static int encodedMsgOffset(int recordOffset)
The offset from the beginning of a record at which the encoded message begins.- Parameters:
recordOffset
- beginning index of the record.- Returns:
- offset from the beginning of a record at which the encoded message begins.
-
checkTypeId
public static void checkTypeId(int msgTypeId)
Check that and message id is in the valid range.- Parameters:
msgTypeId
- to be checked.- Throws:
java.lang.IllegalArgumentException
- if the id is not in the valid range.
-
-