@Test(expected = Exception.class) public void doesNotAcceptARequestToLogAnEmptyEntryList() { log.logEntries(new ArrayList<>()); }
@Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries) { if (entries.isEmpty()) { throw new IllegalArgumentException("Mooring#logEntries: empty entry list"); } List<OLogEntry> oLogEntries = new ArrayList<>(); for (LogEntry entry : entries) { if (isAConfigurationEntry(entry)) { lastQuorumConfig = QuorumConfiguration.fromProtostuff(entry.getQuorumConfiguration()); lastQuorumConfigIndex = entry.getIndex(); } oLogEntries.add(OLogEntry.fromProtostuff(entry)); } updateCachedTermAndIndex(oLogEntries); return log.logEntries(oLogEntries, quorumId); }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries) { if (entries.isEmpty()) { throw new IllegalArgumentException("Mooring#logEntries: empty entry list"); } List<OLogEntry> oLogEntries = new ArrayList<>(); for (LogEntry entry : entries) { if (isAConfigurationEntry(entry)) { lastQuorumConfig = QuorumConfiguration.fromProtostuff(entry.getQuorumConfiguration()); lastQuorumConfigIndex = entry.getIndex(); } oLogEntries.add(OLogEntry.fromProtostuff(entry)); } updateCachedTermAndIndex(oLogEntries); return log.logEntries(oLogEntries, quorumId); } }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries) { if (entries.isEmpty()) { throw new IllegalArgumentException("Mooring#logEntries: empty entry list"); } List<OLogEntry> oLogEntries = new ArrayList<>(); for (LogEntry entry : entries) { if (isAConfigurationEntry(entry)) { lastQuorumConfig = QuorumConfiguration.fromProtostuff(entry.getQuorumConfiguration()); lastQuorumConfigIndex = entry.getIndex(); } oLogEntries.add(OLogEntry.fromProtostuff(entry)); } updateCachedTermAndIndex(oLogEntries); return log.logEntries(oLogEntries, quorumId); } Mooring(OLog log, String quorumId); }
Mooring implements ReplicatorLog { @Override public ListenableFuture<Boolean> logEntries(List<LogEntry> entries) { if (entries.isEmpty()) { throw new IllegalArgumentException("Mooring#logEntries: empty entry list"); } List<OLogEntry> oLogEntries = new ArrayList<>(); for (LogEntry entry : entries) { if (isAConfigurationEntry(entry)) { lastQuorumConfig = QuorumConfiguration.fromProtostuff(entry.getQuorumConfiguration()); lastQuorumConfigIndex = entry.getIndex(); } oLogEntries.add(OLogEntry.fromProtostuff(entry)); } updateCachedTermAndIndex(oLogEntries); return log.logEntries(oLogEntries, quorumId); } 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> logEntries(List<LogEntry> entries) { if (entries.isEmpty()) { throw new IllegalArgumentException("Mooring#logEntries: empty entry list"); } List<OLogEntry> oLogEntries = new ArrayList<>(); for (LogEntry entry : entries) { if (isAConfigurationEntry(entry)) { lastQuorumConfig = QuorumConfiguration.fromProtostuff(entry.getQuorumConfiguration()); lastQuorumConfigIndex = entry.getIndex(); } oLogEntries.add(OLogEntry.fromProtostuff(entry)); } updateCachedTermAndIndex(oLogEntries); return log.logEntries(oLogEntries, quorumId); } 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();  }