@Test public void returnsTheLatestAppendedPersistenceForAGivenQuorum() throws Exception { final OLogHeader header = anOLogHeader(); havingAppendedAPersistenceContainingHeader(header); try (BytePersistence persistence = logFileService.getCurrent(QUORUM_ID)) { assertThat(deserializedHeader(persistence), is(equalToHeader(header))); } }
@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);  }