public interface RingBufferReader extends RingBufferReaderStats, net.openhft.chronicle.core.io.Closeable
This interface also extends RingBufferReaderStats
, which provides statistics
about the Ring Buffer's usage, and Closeable
for closing the reader when it's no longer needed.
The reader supports concurrent reading and writing operations without blocking the writers, even when stopped.
Modifier and Type | Field and Description |
---|---|
static long |
UNKNOWN_INDEX
Constant representing an undefined or unknown index within the ring buffer.
|
Modifier and Type | Method and Description |
---|---|
void |
afterRead(long next)
Updates the reader's state after a read operation.
|
void |
afterRead(long next,
long payloadStart,
long underlyingIndex)
Overloaded method of
afterRead(long) providing additional details about the read operation. |
long |
beforeRead(Bytes<?> bytes)
Prepares the reader to read data from the Ring Buffer.
|
BytesStore |
byteStore()
Retrieves the
BytesStore instance that backs the Ring Buffer. |
boolean |
isEmpty()
Checks if the Ring Buffer is empty.
|
boolean |
isStopped()
Checks if the Ring Buffer reader has been stopped.
|
boolean |
read(BytesOut<?> bytes)
A convenience method that reads data from the Ring Buffer by internally calling both
beforeRead(Bytes) and afterRead(long) . |
void |
stop()
Stops the reader.
|
void |
toEnd()
Adjusts the reader's position to just past the end of the Ring Buffer, effectively making it read any new data that gets written.
|
long |
underlyingIndex()
Retrieves the index in the underlying data structure where the last read operation occurred.
|
behind, getAndClearMissedReadCount, getAndClearReadCount
static final long UNKNOWN_INDEX
boolean isEmpty()
boolean isStopped()
void stop()
long beforeRead(Bytes<?> bytes)
Bytes
object, allowing the client to read the data.bytes
- The Bytes
instance backed by the Ring Buffer.afterRead(long)
after the read operation.void afterRead(long next)
beforeRead(Bytes)
call.next
- The position after the last read operation.void afterRead(long next, long payloadStart, long underlyingIndex)
afterRead(long)
providing additional details about the read operation.next
- The position after the last read operation.payloadStart
- The starting position of the payload that was read.underlyingIndex
- The index in the underlying data structure from where the data was read.long underlyingIndex()
boolean read(BytesOut<?> bytes)
beforeRead(Bytes)
and afterRead(long)
.bytes
- to read a message intoBytesStore byteStore()
BytesStore
instance that backs the Ring Buffer.BytesStore
instance.void toEnd()
Copyright © 2023. All rights reserved.