Package io.aeron.logbuffer
Class BufferClaim
java.lang.Object
io.aeron.logbuffer.BufferClaim
Represents a claimed range in a buffer to be used for recording a message without copy semantics for later commit.
The claimed space is in buffer() between offset() and offset() + length().
When the buffer is filled with message data, use commit() to make it available to subscribers.
If the claimed space is no longer required it can be aborted by calling abort().
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort a claim of the message space to the log buffer so that the log can progress by ignoring this claim.buffer()The referenced buffer to be used.voidcommit()Commit the message to the log buffer so that is it available to subscribers.byteflags()Get the value of the flags field.flags(byte flags) Set the value of the header flags field.intGet the value of the header type field.headerType(int type) Set the value of the header type field.intlength()The length of the claimed range in the buffer.intoffset()The offset in the buffer at which the claimed range begins.putBytes(DirectBuffer srcBuffer, int srcIndex, int length) Put bytes into the claimed buffer space for a message.longGet the value stored in the reserve space at the end of a data frame header.reservedValue(long value) Write the provided value into the reserved space at the end of the data frame header.voidwrap(AtomicBuffer buffer, int offset, int length) Wrap a region of an underlying log buffer so can can represent a claimed space for use by a publisher.
-
Constructor Details
-
BufferClaim
public BufferClaim()
-
-
Method Details
-
wrap
Wrap a region of an underlying log buffer so can can represent a claimed space for use by a publisher.- Parameters:
buffer- to be wrapped.offset- at which the claimed region begins including space for the header.length- length of the underlying claimed region including space for the header.
-
buffer
The referenced buffer to be used.- Returns:
- the referenced buffer to be used.
-
offset
public int offset()The offset in the buffer at which the claimed range begins.- Returns:
- offset in the buffer at which the range begins.
-
length
public int length()The length of the claimed range in the buffer.- Returns:
- length of the range in the buffer.
-
headerType
public int headerType()Get the value of the header type field. The lower 16 bits are valid.- Returns:
- the value of the header type field.
- See Also:
-
flags
public byte flags()Get the value of the flags field.- Returns:
- the value of the header flags field.
- See Also:
-
flags
Set the value of the header flags field.- Parameters:
flags- value to be set in the header.- Returns:
- this for a fluent API.
- See Also:
-
headerType
Set the value of the header type field. The lower 16 bits are valid.- Parameters:
type- value to be set in the header.- Returns:
- this for a fluent API.
- See Also:
-
reservedValue
public long reservedValue()Get the value stored in the reserve space at the end of a data frame header.Note: The value is in
ByteOrder.LITTLE_ENDIANformat.- Returns:
- the value stored in the reserve space at the end of a data frame header.
- See Also:
-
reservedValue
Write the provided value into the reserved space at the end of the data frame header.Note: The value will be written in
ByteOrder.LITTLE_ENDIANformat.- Parameters:
value- to be stored in the reserve space at the end of a data frame header.- Returns:
- this for fluent API semantics.
- See Also:
-
putBytes
Put bytes into the claimed buffer space for a message. To write multiple parts then usebuffer()andoffset().- Parameters:
srcBuffer- to copy into the claimed space.srcIndex- in the source buffer from which to copy.length- of the source buffer to copy.- Returns:
- this for a fluent API.
-
commit
public void commit()Commit the message to the log buffer so that is it available to subscribers. -
abort
public void abort()Abort a claim of the message space to the log buffer so that the log can progress by ignoring this claim.
-