docs: boolean isLogUpToDate(long lastIndex, long lastTerm, RaftRequest request) {
      // Read the last entry from the log.
      final Indexed<RaftLogEntry> lastEntry = raft.getLogWriter().getLastEntry();
  
      // If the log is empty then vote for the candidate.
      if (lastEntry == null) {
        log.debug("Accepted {}: candidate's log is up-to-date", request);
        return true;
      }
  
      // If the candidate's last log term is lower than the local log's last entry term, reject the request.
      if (lastTerm < lastEntry.entry().term()) {
        log.debug("Rejected {}: candidate's last log entry ({}) is at a lower term than the local log ({})", request, lastTerm, lastEntry.entry().term());
        return false;
      }
  
      // If the candidate's last term is equal to the local log's last entry term, reject the request if the
      // candidate's last index is less than the local log's last index. If the candidate's last log term is
      // greater than the local log's last term then it's considered up to date, and if both have the same term
      // then the candidate's last index must be greater than the local log's last index.
      if (lastTerm == lastEntry.entry().term() && lastIndex < lastEntry.index()) {
        log.debug("Rejected {}: candidate's last log entry ({}) is at a lower index than the local log ({})", request, lastIndex, lastEntry.index());
        return false;
      }
  
      // If we made it this far, the candidate's last term is greater than or equal to the local log's last
      // term, and if equal to the local log's last term, the candidate's last index is equal to or greater
      // than the local log's last index.
      log.debug("Accepted {}: candidate's log is up-to-date", request);
      return true;
    }