@Test public void appendsANewPersistenceSoThatItWillBeReturnedByFutureCallsToGetCurrent() throws Exception { final OLogHeader secondHeader; final long anArbitrarySeqNum = 1210; final long aGreaterArbitrarySeqNum = 1815; havingAppendedAPersistenceContainingHeader(anOLogHeaderWithSeqNum(anArbitrarySeqNum)); havingAppendedAPersistenceContainingHeader(secondHeader = anOLogHeaderWithSeqNum(aGreaterArbitrarySeqNum)); try (BytePersistence primaryPersistence = logFileService.getCurrent(QUORUM_ID)) { assertThat(deserializedHeader(primaryPersistence), is(equalToHeader(secondHeader))); } }
@Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } }
LogFileService implements LogPersistenceService<FilePersistence> { @Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } } }
LogFileService implements LogPersistenceService<FilePersistence> { @Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } } LogFileService(Path basePath); }
LogFileService implements LogPersistenceService<FilePersistence> { @Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } } LogFileService(Path basePath); @Nullable @Override FilePersistence getCurrent(String quorumId); @NotNull @Override FilePersistence create(String quorumId); @Override void append(String quorumId, @NotNull FilePersistence persistence); @Override void truncate(String quorumId); @Override ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId); void clearAllLogs(); void archiveAllButCurrent(String quorumId); }
LogFileService implements LogPersistenceService<FilePersistence> { @Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } } LogFileService(Path basePath); @Nullable @Override FilePersistence getCurrent(String quorumId); @NotNull @Override FilePersistence create(String quorumId); @Override void append(String quorumId, @NotNull FilePersistence persistence); @Override void truncate(String quorumId); @Override ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId); void clearAllLogs(); void archiveAllButCurrent(String quorumId);  }