public class BufferClaim
extends java.lang.Object
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()
.
Publication.tryClaim(int, BufferClaim)
Modifier and Type | Field and Description |
---|---|
protected org.agrona.concurrent.UnsafeBuffer |
buffer |
Constructor and Description |
---|
BufferClaim() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort a claim of the message space to the log buffer so that the log can progress by ignoring this claim.
|
org.agrona.MutableDirectBuffer |
buffer()
The referenced buffer to be used.
|
void |
commit()
Commit the message to the log buffer so that is it available to subscribers.
|
byte |
flags()
Get the value of the flags field.
|
BufferClaim |
flags(byte flags)
Set the value of the header flags field.
|
int |
headerType()
Get the value of the header type field.
|
BufferClaim |
headerType(int type)
Set the value of the header type field.
|
int |
length()
The length of the claimed range in the buffer.
|
int |
offset()
The offset in the buffer at which the claimed range begins.
|
BufferClaim |
putBytes(org.agrona.DirectBuffer srcBuffer,
int srcIndex,
int length)
Put bytes into the claimed buffer space for a message.
|
long |
reservedValue()
Get the value stored in the reserve space at the end of a data frame header.
|
BufferClaim |
reservedValue(long value)
Write the provided value into the reserved space at the end of the data frame header.
|
void |
wrap(org.agrona.concurrent.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.
|
public final void wrap(org.agrona.concurrent.AtomicBuffer buffer, int offset, int length)
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.public final org.agrona.MutableDirectBuffer buffer()
public final int offset()
public final int length()
public final int headerType()
DataHeaderFlyweight
public final byte flags()
DataHeaderFlyweight
public BufferClaim flags(byte flags)
flags
- value to be set in the header.DataHeaderFlyweight
public BufferClaim headerType(int type)
type
- value to be set in the header.DataHeaderFlyweight
public final long reservedValue()
Note: The value is in ByteOrder.LITTLE_ENDIAN
format.
DataHeaderFlyweight
public BufferClaim reservedValue(long value)
Note: The value will be written in ByteOrder.LITTLE_ENDIAN
format.
value
- to be stored in the reserve space at the end of a data frame header.DataHeaderFlyweight
public final BufferClaim putBytes(org.agrona.DirectBuffer srcBuffer, int srcIndex, int length)
buffer()
and offset()
.srcBuffer
- to copy into the claimed space.srcIndex
- in the source buffer from which to copy.length
- of the source buffer to copy.public final void commit()
public final void abort()
Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.