diff --git a/rocky-raft/src/rocky/raft/log/RaftLog.java b/rocky-raft/src/rocky/raft/log/RaftLog.java index 04fe3df..3d8004a 100644 --- a/rocky-raft/src/rocky/raft/log/RaftLog.java +++ b/rocky-raft/src/rocky/raft/log/RaftLog.java @@ -59,20 +59,20 @@ public synchronized LogEntry last() throws IOException { } @Override - public synchronized LogEntry get(int index) throws IOException { - LogEntry logEntry = cache.get(index); + public synchronized LogEntry get(int logEntryIndex) throws IOException { + LogEntry logEntry = cache.get(logEntryIndex); if (logEntry == null) { - byte[] data = queueFile.get(index - 1); + byte[] data = queueFile.get(logEntryIndex - 1); if (data != null) { logEntry = new Gson().fromJson(new String(data), LogEntry.class); - cache.put(index, logEntry); + cache.put(logEntryIndex, logEntry); } } return logEntry; } @Override - public List getAll(int fromIndex) throws IOException { + public List getAll(int fromLogEntryIndex) throws IOException { Gson gson = new Gson(); List logEntryList = new ArrayList<>(); @@ -82,7 +82,7 @@ public List getAll(int fromIndex) throws IOException { @Override public boolean read(InputStream in, int length) throws IOException { ++current; - if (current >= fromIndex - 1) { + if (current >= fromLogEntryIndex - 1) { LogEntry entry = cache.get(current + 1); if (entry == null) { byte[] data = new byte[length];