@Test public void listsDataStoresInOrderOfMostRecentToLeastRecent() throws Exception { havingAppendedAPersistenceContainingHeader(anOLogHeaderWithSeqNum(1)); havingAppendedAPersistenceContainingHeader(anOLogHeaderWithSeqNum(2)); havingAppendedAPersistenceContainingHeader(anOLogHeaderWithSeqNum(3)); assertThat(logFileService.getList(QUORUM_ID), is(aListOfPersistencesWithSeqNums(3, 2, 1))); }
@Override public ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId) throws IOException { ImmutableList.Builder<CheckedSupplier<FilePersistence, IOException>> persistenceSupplierBuilder = ImmutableList.builder(); for (Path path : getLinkPathMap(quorumId).descendingMap().values()) { persistenceSupplierBuilder.add( () -> new FilePersistence(Files.readSymbolicLink(path))); } return persistenceSupplierBuilder.build(); }
LogFileService implements LogPersistenceService<FilePersistence> { @Override public ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId) throws IOException { ImmutableList.Builder<CheckedSupplier<FilePersistence, IOException>> persistenceSupplierBuilder = ImmutableList.builder(); for (Path path : getLinkPathMap(quorumId).descendingMap().values()) { persistenceSupplierBuilder.add( () -> new FilePersistence(Files.readSymbolicLink(path))); } return persistenceSupplierBuilder.build(); } }
LogFileService implements LogPersistenceService<FilePersistence> { @Override public ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId) throws IOException { ImmutableList.Builder<CheckedSupplier<FilePersistence, IOException>> persistenceSupplierBuilder = ImmutableList.builder(); for (Path path : getLinkPathMap(quorumId).descendingMap().values()) { persistenceSupplierBuilder.add( () -> new FilePersistence(Files.readSymbolicLink(path))); } return persistenceSupplierBuilder.build(); } LogFileService(Path basePath); }
LogFileService implements LogPersistenceService<FilePersistence> { @Override public ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId) throws IOException { ImmutableList.Builder<CheckedSupplier<FilePersistence, IOException>> persistenceSupplierBuilder = ImmutableList.builder(); for (Path path : getLinkPathMap(quorumId).descendingMap().values()) { persistenceSupplierBuilder.add( () -> new FilePersistence(Files.readSymbolicLink(path))); } return persistenceSupplierBuilder.build(); } 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> { @Override public ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId) throws IOException { ImmutableList.Builder<CheckedSupplier<FilePersistence, IOException>> persistenceSupplierBuilder = ImmutableList.builder(); for (Path path : getLinkPathMap(quorumId).descendingMap().values()) { persistenceSupplierBuilder.add( () -> new FilePersistence(Files.readSymbolicLink(path))); } return persistenceSupplierBuilder.build(); } 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);  }