Package io.atomix.raft.storage.log
Class RaftLogUncommittedReader
java.lang.Object
io.atomix.raft.storage.log.RaftLogUncommittedReader
- All Implemented Interfaces:
RaftLogReader,AutoCloseable,Iterator<IndexedRaftLogEntry>
Raft log reader that reads both committed and uncommitted entries. This reader is supposed to be
only used internally in raft. The reader is not thread safe with a concurrent writer.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanhasNext()next()longreset()Reset the reader to the first index of the log.longseek(long index) Seeks to the given index.longseekToAsqn(long asqn) Seek to a record with the highest ASQN less than or equal to the given asqn.longseekToAsqn(long asqn, long indexUpperBound) longSeeks to the last indexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<IndexedRaftLogEntry>
-
next
- Specified by:
nextin interfaceIterator<IndexedRaftLogEntry>
-
reset
public long reset()Description copied from interface:RaftLogReaderReset the reader to the first index of the log.- Specified by:
resetin interfaceRaftLogReader- Returns:
- return the first index
-
seek
public long seek(long index) Description copied from interface:RaftLogReaderSeeks to the given index.- Specified by:
seekin interfaceRaftLogReader- Parameters:
index- the index to seeks to- Returns:
- the index of the next record to be read
-
seekToLast
public long seekToLast()Description copied from interface:RaftLogReaderSeeks to the last index- Specified by:
seekToLastin interfaceRaftLogReader- Returns:
- the index of the next record to be read
-
seekToAsqn
public long seekToAsqn(long asqn) Description copied from interface:RaftLogReaderSeek to a record with the highest ASQN less than or equal to the given asqn.- Specified by:
seekToAsqnin interfaceRaftLogReader- Parameters:
asqn- the asqn to seek to- Returns:
- the index of the record that will be returned by
Iterator.next()
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRaftLogReader
-
seekToAsqn
public long seekToAsqn(long asqn, long indexUpperBound)
-