@Test public void handlesTruncationsAndUpdatesTermInformationAccordingly() throws Exception { havingLogged( entries() .term(7).seqNums(1, 2)); havingTruncatedToSeqNum(2); havingLogged( entries() .term(8).seqNums(2)); assertThat(oracle.getTermAtSeqNum(1), is(equalTo(7L))); assertThat(oracle.getTermAtSeqNum(2), is(equalTo(8L))); }
@Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); } }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig(); }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig();  }