public class Header
extends java.lang.Object
Constructor and Description |
---|
Header(int initialTermId,
int positionBitsToShift)
Construct a header that references a buffer for the log.
|
Header(int initialTermId,
int positionBitsToShift,
java.lang.Object context)
Construct a header that references a buffer for the log.
|
Modifier and Type | Method and Description |
---|---|
org.agrona.DirectBuffer |
buffer()
The
DirectBuffer containing the header. |
void |
buffer(org.agrona.DirectBuffer buffer)
The
DirectBuffer containing the header. |
java.lang.Object |
context()
Context for storing state related to the context of the callback where the header is used.
|
byte |
flags()
The flags for this frame.
|
int |
frameLength()
The total length of the frame including the header.
|
int |
initialTermId()
Get the initial term id this stream started at.
|
int |
offset()
The offset at which the frame begins.
|
void |
offset(int offset)
Set the offset at which the header begins in the log.
|
long |
position()
Get the current position to which the image has advanced on reading this message.
|
long |
reservedValue()
Get the value stored in the reserve space at the end of a data frame header.
|
int |
sessionId()
The session ID to which the frame belongs.
|
int |
streamId()
The stream ID to which the frame belongs.
|
int |
termId()
The term ID to which the frame belongs.
|
int |
termOffset()
The offset in the term at which the frame begins.
|
int |
type()
The type of the the frame which should always be
HeaderFlyweight.HDR_TYPE_DATA |
public Header(int initialTermId, int positionBitsToShift)
initialTermId
- this stream started at.positionBitsToShift
- for calculating positions.public Header(int initialTermId, int positionBitsToShift, java.lang.Object context)
initialTermId
- this stream started at.positionBitsToShift
- for calculating positions.context
- for storing state when which can be accessed with context()
.public java.lang.Object context()
public final long position()
public final int initialTermId()
public final void offset(int offset)
offset
- at which the header begins in the log.public final int offset()
public final org.agrona.DirectBuffer buffer()
DirectBuffer
containing the header.DirectBuffer
containing the header.public final void buffer(org.agrona.DirectBuffer buffer)
DirectBuffer
containing the header.buffer
- DirectBuffer
containing the header.public int frameLength()
public final int sessionId()
public final int streamId()
public final int termId()
public int termOffset()
offset()
public final int type()
HeaderFlyweight.HDR_TYPE_DATA
HeaderFlyweight.HDR_TYPE_DATA
public byte flags()
DataHeaderFlyweight.BEGIN_FLAG
and DataHeaderFlyweight.END_FLAG
. A convenience flag DataHeaderFlyweight.BEGIN_AND_END_FLAGS
can be used for both flags.public long reservedValue()
Note: The value is in ByteOrder.LITTLE_ENDIAN
format.
DataHeaderFlyweight
Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.