Package io.aeron.logbuffer
Class TermScanner
java.lang.Object
io.aeron.logbuffer.TermScanner
Scans a term buffer for an availability range of message fragments.
This can be used to concurrently read a term buffer which is being appended to.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intavailable(long result) The number of bytes that are available to be read after a scan.static longpack(int padding, int available) Pack the values for available and padding into a long for returning on the stack.static intpadding(long result) The count of bytes that should be added for padding to the position on top of what is available.static longscanForAvailability(UnsafeBuffer termBuffer, int offset, int maxLength) Scan the term buffer for availability of new message fragments from a given offset up to a maxLength of bytes.
-
Constructor Details
-
TermScanner
public TermScanner()
-
-
Method Details
-
scanForAvailability
Scan the term buffer for availability of new message fragments from a given offset up to a maxLength of bytes.- Parameters:
termBuffer- to be scanned for new message fragments.offset- at which the scan should begin.maxLength- in bytes of how much should be scanned.- Returns:
- resulting status of the scan which packs the available bytes and padding into a long. The available bytes can be negative which indicates that there was data to send.
-
pack
public static long pack(int padding, int available) Pack the values for available and padding into a long for returning on the stack.- Parameters:
padding- value to be packed.available- value to be packed.- Returns:
- a long with both ints packed into it.
-
available
public static int available(long result) The number of bytes that are available to be read after a scan.- Parameters:
result- into which the padding value has been packed.- Returns:
- the count of bytes that are available to be read.
-
padding
public static int padding(long result) The count of bytes that should be added for padding to the position on top of what is available.- Parameters:
result- into which the padding value has been packed.- Returns:
- the count of bytes that should be added for padding to the position on top of what is available.
-