@Test(timeout = 1000) public void throwsExceptionFromGetLogEntriesMethodWhenTheLogIsEmpty() throws Exception { assertThat(log.getLogEntries(1, 2, quorumId), resultsInException(LogEntryNotFound.class)); }
@Override public ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId) { if (end < start) { throw new IllegalArgumentException("getLogEntries: end < start"); } else if (end == start) { return Futures.immediateFuture(new ArrayList<>()); } return submitQuorumTask(quorumId, () -> { if (!seqNumPrecedesLog(start, getQuorumStructure(quorumId).currentLogWithHeader())) { return currentLog(quorumId).subSequence(start, end); } else { return multiLogGet(start, end, quorumId); } }); }
QuorumDelegatingLog implements OLog, AutoCloseable { @Override public ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId) { if (end < start) { throw new IllegalArgumentException("getLogEntries: end < start"); } else if (end == start) { return Futures.immediateFuture(new ArrayList<>()); } return submitQuorumTask(quorumId, () -> { if (!seqNumPrecedesLog(start, getQuorumStructure(quorumId).currentLogWithHeader())) { return currentLog(quorumId).subSequence(start, end); } else { return multiLogGet(start, end, quorumId); } }); } }
QuorumDelegatingLog implements OLog, AutoCloseable { @Override public ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId) { if (end < start) { throw new IllegalArgumentException("getLogEntries: end < start"); } else if (end == start) { return Futures.immediateFuture(new ArrayList<>()); } return submitQuorumTask(quorumId, () -> { if (!seqNumPrecedesLog(start, getQuorumStructure(quorumId).currentLogWithHeader())) { return currentLog(quorumId).subSequence(start, end); } else { return multiLogGet(start, end, quorumId); } }); } QuorumDelegatingLog(LogPersistenceService<?> persistenceService,
                             KeySerializingExecutor taskExecutor,
                             OLogEntryOracleFactory OLogEntryOracleFactory,
                             PersistenceNavigatorFactory persistenceNavigatorFactory
  ); }
QuorumDelegatingLog implements OLog, AutoCloseable { @Override public ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId) { if (end < start) { throw new IllegalArgumentException("getLogEntries: end < start"); } else if (end == start) { return Futures.immediateFuture(new ArrayList<>()); } return submitQuorumTask(quorumId, () -> { if (!seqNumPrecedesLog(start, getQuorumStructure(quorumId).currentLogWithHeader())) { return currentLog(quorumId).subSequence(start, end); } else { return multiLogGet(start, end, quorumId); } }); } QuorumDelegatingLog(LogPersistenceService<?> persistenceService,
                             KeySerializingExecutor taskExecutor,
                             OLogEntryOracleFactory OLogEntryOracleFactory,
                             PersistenceNavigatorFactory persistenceNavigatorFactory
  ); @Override ListenableFuture<Void> openAsync(String quorumId); @Override ListenableFuture<Boolean> logEntries(List<OLogEntry> passedInEntries, String quorumId); @Override ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId); @Override ListenableFuture<Boolean> truncateLog(long seqNum, String quorumId); @Override long getNextSeqNum(String quorumId); @Override long getLastTerm(String quorumId); @Override long getLogTerm(long seqNum, String quorumId); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig(String quorumId); @Override ListenableFuture<Void> roll(String quorumId); @Override void close(); }
QuorumDelegatingLog implements OLog, AutoCloseable { @Override public ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId) { if (end < start) { throw new IllegalArgumentException("getLogEntries: end < start"); } else if (end == start) { return Futures.immediateFuture(new ArrayList<>()); } return submitQuorumTask(quorumId, () -> { if (!seqNumPrecedesLog(start, getQuorumStructure(quorumId).currentLogWithHeader())) { return currentLog(quorumId).subSequence(start, end); } else { return multiLogGet(start, end, quorumId); } }); } QuorumDelegatingLog(LogPersistenceService<?> persistenceService,
                             KeySerializingExecutor taskExecutor,
                             OLogEntryOracleFactory OLogEntryOracleFactory,
                             PersistenceNavigatorFactory persistenceNavigatorFactory
  ); @Override ListenableFuture<Void> openAsync(String quorumId); @Override ListenableFuture<Boolean> logEntries(List<OLogEntry> passedInEntries, String quorumId); @Override ListenableFuture<List<OLogEntry>> getLogEntries(long start, long end, String quorumId); @Override ListenableFuture<Boolean> truncateLog(long seqNum, String quorumId); @Override long getNextSeqNum(String quorumId); @Override long getLastTerm(String quorumId); @Override long getLogTerm(long seqNum, String quorumId); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig(String quorumId); @Override ListenableFuture<Void> roll(String quorumId); @Override void close();  }