Package io.atomix.raft.storage.log
Class RaftLog
java.lang.Object
io.atomix.raft.storage.log.RaftLog
- All Implemented Interfaces:
Closeable,AutoCloseable
Raft log.
-
Method Summary
Modifier and TypeMethodDescriptionappend(RaftLogEntry entry) append(PersistedRaftRecord entry) static RaftLogBuilderbuilder()Returns a new Raft log builder.voidclose()voiddeleteAfter(long index) voiddeleteUntil(long index) Compacts the journal up to the given index.voidflush()longReturns the Raft log commit index.longlongbooleanisEmpty()booleanisOpen()Opens the reader that can only read committed entries.Opens the reader that can read both committed and uncommitted entries.voidreset(long index) voidsetCommitIndex(long index) Commits entries up to the given index.booleantoString()
-
Method Details
-
builder
Returns a new Raft log builder.- Returns:
- A new Raft log builder.
-
openUncommittedReader
Opens the reader that can read both committed and uncommitted entries.- Returns:
- the reader
-
openCommittedReader
Opens the reader that can only read committed entries.- Returns:
- the reader
-
isOpen
public boolean isOpen() -
deleteUntil
public void deleteUntil(long index) Compacts the journal up to the given index.The semantics of compaction are not specified by this interface.
- Parameters:
index- The index up to which to compact the journal.
-
getCommitIndex
public long getCommitIndex()Returns the Raft log commit index.- Returns:
- The Raft log commit index.
-
setCommitIndex
public void setCommitIndex(long index) Commits entries up to the given index.- Parameters:
index- The index up to which to commit entries.
-
shouldFlushExplicitly
public boolean shouldFlushExplicitly() -
getFirstIndex
public long getFirstIndex() -
getLastIndex
public long getLastIndex() -
getLastEntry
-
isEmpty
public boolean isEmpty() -
append
-
append
-
reset
public void reset(long index) -
deleteAfter
public void deleteAfter(long index) -
flush
public void flush() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
toString
-