Interface LogStorageReader
- All Superinterfaces:
AutoCloseable,Closeable,Iterator<org.agrona.DirectBuffer>
- All Known Implementing Classes:
AtomixLogStorageReader
The LogStorageReader provides a way to iterate over the blocks that were appended to the log
storage via
LogStorage.append(long, long, ByteBuffer, AppendListener).
On creation the reader should be positioned such that Iterator.next() would return the first
block (assuming there is one).
The expected access pattern is to seek first, then read iteratively by calling Iterator.next().
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidseek(long position) Positions the reader such that the next call toIterator.next()would return a block which contains aLoggedEventwithLoggedEvent.getPosition()equal to the givenposition, or the highest one which is less than the givenposition.Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
seek
void seek(long position) Positions the reader such that the next call toIterator.next()would return a block which contains aLoggedEventwithLoggedEvent.getPosition()equal to the givenposition, or the highest one which is less than the givenposition.If the
positionis negative, it should seek to the first position.If the
positionis greater than the greatest position stored, it should seek to the last block, such thatIterator.next()would return that block.- Parameters:
position- the position to seek to
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-