@Test(expected = IllegalArgumentException.class) public void throwsAnExceptionIfAskedToTruncateToAnIndexOfZero() { log.truncateLog(0); }
@Override public ListenableFuture<Boolean> truncateLog(long entryIndex) { if (entryIndex <= 0) { throw new IllegalArgumentException("Mooring#truncateLog"); } lastIndex = max(entryIndex - 1, 0); currentTerm = log.getLogTerm(lastIndex, quorumId); ListenableFuture<Boolean> truncateFuture = log.truncateLog(entryIndex, quorumId); setQuorumConfigFromLog(); return truncateFuture; }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> truncateLog(long entryIndex) { if (entryIndex <= 0) { throw new IllegalArgumentException("Mooring#truncateLog"); } lastIndex = max(entryIndex - 1, 0); currentTerm = log.getLogTerm(lastIndex, quorumId); ListenableFuture<Boolean> truncateFuture = log.truncateLog(entryIndex, quorumId); setQuorumConfigFromLog(); return truncateFuture; } }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> truncateLog(long entryIndex) { if (entryIndex <= 0) { throw new IllegalArgumentException("Mooring#truncateLog"); } lastIndex = max(entryIndex - 1, 0); currentTerm = log.getLogTerm(lastIndex, quorumId); ListenableFuture<Boolean> truncateFuture = log.truncateLog(entryIndex, quorumId); setQuorumConfigFromLog(); return truncateFuture; } Mooring(OLog log, String quorumId); }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> truncateLog(long entryIndex) { if (entryIndex <= 0) { throw new IllegalArgumentException("Mooring#truncateLog"); } lastIndex = max(entryIndex - 1, 0); currentTerm = log.getLogTerm(lastIndex, quorumId); ListenableFuture<Boolean> truncateFuture = log.truncateLog(entryIndex, quorumId); setQuorumConfigFromLog(); return truncateFuture; } Mooring(OLog log, String quorumId); @Override ListenableFuture<Boolean> logEntries(List<LogEntry> entries); @Override ListenableFuture<List<LogEntry>> getLogEntries(long start, long end); @Override long getLogTerm(long index); @Override long getLastTerm(); @Override long getLastIndex(); @Override ListenableFuture<Boolean> truncateLog(long entryIndex); @Override QuorumConfiguration getLastConfiguration(); @Override long getLastConfigurationIndex(); }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> truncateLog(long entryIndex) { if (entryIndex <= 0) { throw new IllegalArgumentException("Mooring#truncateLog"); } lastIndex = max(entryIndex - 1, 0); currentTerm = log.getLogTerm(lastIndex, quorumId); ListenableFuture<Boolean> truncateFuture = log.truncateLog(entryIndex, quorumId); setQuorumConfigFromLog(); return truncateFuture; } Mooring(OLog log, String quorumId); @Override ListenableFuture<Boolean> logEntries(List<LogEntry> entries); @Override ListenableFuture<List<LogEntry>> getLogEntries(long start, long end); @Override long getLogTerm(long index); @Override long getLastTerm(); @Override long getLastIndex(); @Override ListenableFuture<Boolean> truncateLog(long entryIndex); @Override QuorumConfiguration getLastConfiguration(); @Override long getLastConfigurationIndex();  }