public final class TermAppender
extends java.lang.Object
Note: This class is 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 failed because it was past the end of the buffer. 
 | 
| Constructor and Description | 
|---|
TermAppender(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(HeaderWriter header,
                       org.agrona.DirectBuffer bufferOne,
                       int offsetOne,
                       int lengthOne,
                       org.agrona.DirectBuffer bufferTwo,
                       int offsetTwo,
                       int lengthTwo,
                       int maxPayloadLength,
                       ReservedValueSupplier reservedValueSupplier,
                       int activeTermId)
Append a fragmented message to the the term buffer. 
 | 
int | 
appendFragmentedMessage(HeaderWriter header,
                       org.agrona.DirectBuffer buffer,
                       int offset,
                       int length,
                       int maxPayloadLength,
                       ReservedValueSupplier reservedValueSupplier,
                       int activeTermId)
Append a fragmented message to the the term buffer. 
 | 
int | 
appendFragmentedMessage(HeaderWriter header,
                       DirectBufferVector[] vectors,
                       int length,
                       int maxPayloadLength,
                       ReservedValueSupplier reservedValueSupplier,
                       int activeTermId)
Append a fragmented message to the the term buffer. 
 | 
int | 
appendUnfragmentedMessage(HeaderWriter header,
                         org.agrona.DirectBuffer bufferOne,
                         int offsetOne,
                         int lengthOne,
                         org.agrona.DirectBuffer bufferTwo,
                         int offsetTwo,
                         int lengthTwo,
                         ReservedValueSupplier reservedValueSupplier,
                         int activeTermId)
Append an unfragmented message to the the term buffer. 
 | 
int | 
appendUnfragmentedMessage(HeaderWriter header,
                         org.agrona.DirectBuffer buffer,
                         int offset,
                         int length,
                         ReservedValueSupplier reservedValueSupplier,
                         int activeTermId)
Append an unfragmented message to the the term buffer. 
 | 
int | 
appendUnfragmentedMessage(HeaderWriter header,
                         DirectBufferVector[] vectors,
                         int length,
                         ReservedValueSupplier reservedValueSupplier,
                         int activeTermId)
Append an unfragmented message to the the term buffer as a gathering of vectors. 
 | 
int | 
claim(HeaderWriter header,
     int length,
     BufferClaim bufferClaim,
     int activeTermId)
Claim length of a the term buffer for writing in the message with zero copy semantics. 
 | 
long | 
rawTailVolatile()
Get the raw current tail value in a volatile memory ordering fashion. 
 | 
public static final int FAILED
public TermAppender(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 long rawTailVolatile()
public int claim(HeaderWriter header, int length, BufferClaim bufferClaim, int activeTermId)
header - for writing the default header.length - of the message to be written.bufferClaim - to be updated with the claimed region.activeTermId - used for flow control.FAILED.public int appendUnfragmentedMessage(HeaderWriter header, org.agrona.DirectBuffer bufferOne, int offsetOne, int lengthOne, org.agrona.DirectBuffer bufferTwo, int offsetTwo, int lengthTwo, ReservedValueSupplier reservedValueSupplier, int activeTermId)
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.activeTermId - used for flow control.FAILEDpublic int appendUnfragmentedMessage(HeaderWriter header, org.agrona.DirectBuffer buffer, int offset, int length, ReservedValueSupplier reservedValueSupplier, int activeTermId)
header - for writing the default header.buffer - containing the message.offset - at which the message begins.length - of the message in the source buffer.reservedValueSupplier - ReservedValueSupplier for the frame.activeTermId - used for flow control.FAILEDpublic int appendUnfragmentedMessage(HeaderWriter header, DirectBufferVector[] vectors, int length, ReservedValueSupplier reservedValueSupplier, int activeTermId)
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.activeTermId - used for flow control.FAILED.public int appendFragmentedMessage(HeaderWriter header, org.agrona.DirectBuffer buffer, int offset, int length, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier, int activeTermId)
header - for writing the default header.buffer - containing the message.offset - 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.activeTermId - used for flow control.FAILED.public int appendFragmentedMessage(HeaderWriter header, org.agrona.DirectBuffer bufferOne, int offsetOne, int lengthOne, org.agrona.DirectBuffer bufferTwo, int offsetTwo, int lengthTwo, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier, int activeTermId)
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.activeTermId - used for flow control.FAILED.public int appendFragmentedMessage(HeaderWriter header, DirectBufferVector[] vectors, int length, int maxPayloadLength, ReservedValueSupplier reservedValueSupplier, int activeTermId)
header - for writing the default header.vectors - to the buffers.length - of the message as a sum of the vectors.maxPayloadLength - that the message will be fragmented into.reservedValueSupplier - ReservedValueSupplier for the frame.activeTermId - used for flow control.FAILED.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.