Package io.permazen.kv.raft
Class LogEntry
java.lang.Object
io.permazen.kv.raft.LogEntry
Represents one unapplied Raft log entry.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getAge()
Get the age of this log entry since instantiation.String[]
Get the cluster config change associated with this log entry, if any.getFile()
Get the on-disk file for this log entry.long
Get the size of the on-disk file for this log entry.long
getIndex()
Get the index of this instance.long
getTerm()
Get the term of this instance.static long[]
parseFileName
(String fileName) Parse a log file name, extracting the log term and index.toString()
-
Field Details
-
SORT_BY_INDEX
Sorts instances by log index.
-
-
Method Details
-
getAge
public int getAge()Get the age of this log entry since instantiation.- Returns:
- age in milliseconds
-
getTerm
public long getTerm()Get the term of this instance.- Returns:
- associated log entry term
-
getIndex
public long getIndex()Get the index of this instance.- Returns:
- associated log entry index
-
getConfigChange
Get the cluster config change associated with this log entry, if any.The returned array is a copy; changes have no effect on this instance.
- Returns:
- cluster config change, or null if none
- See Also:
-
RaftKVTransaction.configChange
-
getFileSize
public long getFileSize()Get the size of the on-disk file for this log entry.- Returns:
- log entry file size
-
getFile
Get the on-disk file for this log entry.- Returns:
- log entry file
-
parseFileName
Parse a log file name, extracting the log term and index.- Parameters:
fileName
- file name- Returns:
- array of length two containing
[index, term]
, or null if parse fails - Throws:
IllegalArgumentException
- iffileName
is null
-
toString
-