public final class BufferClaim extends 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)
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.
|
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(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(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 void wrap(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 MutableDirectBuffer buffer()
public int offset()
public int length()
public int headerType()
DataHeaderFlyweight
public 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 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 BufferClaim putBytes(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 void commit()
public void abort()
Copyright © 2014-2022 Real Logic Limited. All Rights Reserved.