public final class ExclusiveTermAppender
extends java.lang.Object
Note: This class is NOT threadsafe.
Messages are appended to a term using a framing protocol as described in FrameDescriptor
.
A default message header is applied to each message with the fields filled in for fragment flags, type, term number, as appropriate.
A message of type FrameDescriptor.PADDING_FRAME_TYPE
is appended at the end of the buffer if claimed
space is not sufficiently large to accommodate the message about to be written.
Modifier and Type | Field and Description |
---|---|
static int |
FAILED
The append operation tripped the end of the buffer and needs to rotate.
|
Constructor and Description |
---|
ExclusiveTermAppender(org.agrona.concurrent.UnsafeBuffer termBuffer,
org.agrona.concurrent.UnsafeBuffer metaDataBuffer,
int partitionIndex)
Construct a view over a term buffer and state buffer for appending frames.
|
Modifier and Type | Method and Description |
---|---|
int |
appendFragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
org.agrona.DirectBuffer bufferOne,
int offsetOne,
int lengthOne,
org.agrona.DirectBuffer bufferTwo,
int offsetTwo,
int lengthTwo,
int maxPayloadLength,
ReservedValueSupplier reservedValueSupplier)
Append a fragmented message to the the term buffer.
|
int |
appendFragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
org.agrona.DirectBuffer srcBuffer,
int srcOffset,
int length,
int maxPayloadLength,
ReservedValueSupplier reservedValueSupplier)
Append a fragmented message to the the term buffer.
|
int |
appendFragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
DirectBufferVector[] vectors,
int length,
int maxPayloadLength,
ReservedValueSupplier reservedValueSupplier)
Append a fragmented message to the the term buffer.
|
int |
appendPadding(int termId,
int termOffset,
HeaderWriter header,
int length)
Pad a length of the term buffer with a padding record.
|
int |
appendUnfragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
org.agrona.DirectBuffer bufferOne,
int offsetOne,
int lengthOne,
org.agrona.DirectBuffer bufferTwo,
int offsetTwo,
int lengthTwo,
ReservedValueSupplier reservedValueSupplier)
Append an unfragmented message to the the term buffer.
|
int |
appendUnfragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
org.agrona.DirectBuffer srcBuffer,
int srcOffset,
int length,
ReservedValueSupplier reservedValueSupplier)
Append an unfragmented message to the the term buffer.
|
int |
appendUnfragmentedMessage(int termId,
int termOffset,
HeaderWriter header,
DirectBufferVector[] vectors,
int length,
ReservedValueSupplier reservedValueSupplier)
Append an unfragmented message to the the term buffer as a gathering of vectors.
|
int |
claim(int termId,
int termOffset,
HeaderWriter header,
int length,
BufferClaim bufferClaim)
Claim length of a the term buffer for writing in the message with zero copy semantics.
|
public static final int FAILED
public ExclusiveTermAppender(org.agrona.concurrent.UnsafeBuffer termBuffer, org.agrona.concurrent.UnsafeBuffer metaDataBuffer, int partitionIndex)
termBuffer
- for where messages are stored.metaDataBuffer
- for where the state of writers is stored manage concurrency.partitionIndex
- for this will be the active appender.public int claim(int termId, int termOffset, HeaderWriter header, int length, BufferClaim bufferClaim)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.length
- of the message to be written.bufferClaim
- to be updated with the claimed region.FAILED
.public int appendPadding(int termId, int termOffset, HeaderWriter header, int length)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.length
- of the padding to be written.FAILED
.public int appendUnfragmentedMessage(int termId, int termOffset, HeaderWriter header, org.agrona.DirectBuffer srcBuffer, int srcOffset, int length, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.srcBuffer
- containing the message.srcOffset
- at which the message begins.length
- of the message in the source buffer.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.public int appendUnfragmentedMessage(int termId, int termOffset, HeaderWriter header, org.agrona.DirectBuffer bufferOne, int offsetOne, int lengthOne, org.agrona.DirectBuffer bufferTwo, int offsetTwo, int lengthTwo, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.bufferOne
- containing the first part of the message.offsetOne
- at which the first part of the message begins.lengthOne
- of the first part of the message.bufferTwo
- containing the second part of the message.offsetTwo
- at which the second part of the message begins.lengthTwo
- of the second part of the message.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.public int appendUnfragmentedMessage(int termId, int termOffset, HeaderWriter header, DirectBufferVector[] vectors, int length, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.vectors
- to the buffers.length
- of the message as a sum of the vectors.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.public int appendFragmentedMessage(int termId, int termOffset, HeaderWriter header, org.agrona.DirectBuffer srcBuffer, int srcOffset, int length, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.srcBuffer
- containing the message.srcOffset
- at which the message begins.length
- of the message in the source buffer.maxPayloadLength
- that the message will be fragmented into.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.public int appendFragmentedMessage(int termId, int termOffset, HeaderWriter header, org.agrona.DirectBuffer bufferOne, int offsetOne, int lengthOne, org.agrona.DirectBuffer bufferTwo, int offsetTwo, int lengthTwo, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.bufferOne
- containing the first part of the message.offsetOne
- at which the first part of the message begins.lengthOne
- of the first part of the message.bufferTwo
- containing the second part of the message.offsetTwo
- at which the second part of the message begins.lengthTwo
- of the second part of the message.maxPayloadLength
- that the message will be fragmented into.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.public int appendFragmentedMessage(int termId, int termOffset, HeaderWriter header, DirectBufferVector[] vectors, int length, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier)
termId
- for the current term.termOffset
- in the term at which to append.header
- for writing the default header.vectors
- to the buffers.length
- of the message in the source buffer.maxPayloadLength
- that the message will be fragmented into.reservedValueSupplier
- ReservedValueSupplier
for the frame.FAILED
.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.