@Test public void testGetDirectoriesIncludesMatchingTimestampPlusOne() { final List<IndexLocation> locations = new ArrayList<>(); locations.add(createLocation(999L)); locations.add(createLocation(1002L)); locations.add(createLocation(1005L)); final List<File> directories = IndexDirectoryManager.getDirectories(1000L, 1001L, locations); assertEquals(2, directories.size()); assertTrue(directories.contains(new File("index-999"))); assertTrue(directories.contains(new File("index-1002"))); }
public synchronized List<File> getDirectories(final Long startTime, final Long endTime) { final List<File> selected = new ArrayList<>(); final Map<String, List<IndexLocation>> startTimeWithFileByStorageDirectory = flattenDirectoriesByTimestamp().stream() .collect(Collectors.groupingBy(indexLoc -> indexLoc.getPartitionName())); for (final List<IndexLocation> locationList : startTimeWithFileByStorageDirectory.values()) { selected.addAll(getDirectories(startTime, endTime, locationList)); } return selected; }
IndexDirectoryManager { public synchronized List<File> getDirectories(final Long startTime, final Long endTime) { final List<File> selected = new ArrayList<>(); final Map<String, List<IndexLocation>> startTimeWithFileByStorageDirectory = flattenDirectoriesByTimestamp().stream() .collect(Collectors.groupingBy(indexLoc -> indexLoc.getPartitionName())); for (final List<IndexLocation> locationList : startTimeWithFileByStorageDirectory.values()) { selected.addAll(getDirectories(startTime, endTime, locationList)); } return selected; } }
IndexDirectoryManager { public synchronized List<File> getDirectories(final Long startTime, final Long endTime) { final List<File> selected = new ArrayList<>(); final Map<String, List<IndexLocation>> startTimeWithFileByStorageDirectory = flattenDirectoriesByTimestamp().stream() .collect(Collectors.groupingBy(indexLoc -> indexLoc.getPartitionName())); for (final List<IndexLocation> locationList : startTimeWithFileByStorageDirectory.values()) { selected.addAll(getDirectories(startTime, endTime, locationList)); } return selected; } IndexDirectoryManager(final RepositoryConfiguration repoConfig); }
IndexDirectoryManager { public synchronized List<File> getDirectories(final Long startTime, final Long endTime) { final List<File> selected = new ArrayList<>(); final Map<String, List<IndexLocation>> startTimeWithFileByStorageDirectory = flattenDirectoriesByTimestamp().stream() .collect(Collectors.groupingBy(indexLoc -> indexLoc.getPartitionName())); for (final List<IndexLocation> locationList : startTimeWithFileByStorageDirectory.values()) { selected.addAll(getDirectories(startTime, endTime, locationList)); } return selected; } IndexDirectoryManager(final RepositoryConfiguration repoConfig); synchronized void initialize(); synchronized void deleteDirectory(final File directory); synchronized List<File> getDirectoriesBefore(final long timestamp); synchronized List<File> getDirectories(final Long startTime, final Long endTime); synchronized List<File> getDirectories(final Long startTime, final Long endTime, final String partitionName); boolean onIndexCommitted(final File indexDir); synchronized Optional<File> getActiveIndexDirectory(final String partitionName); synchronized File getWritableIndexingDirectory(final long earliestTimestamp, final String partitionName); }
IndexDirectoryManager { public synchronized List<File> getDirectories(final Long startTime, final Long endTime) { final List<File> selected = new ArrayList<>(); final Map<String, List<IndexLocation>> startTimeWithFileByStorageDirectory = flattenDirectoriesByTimestamp().stream() .collect(Collectors.groupingBy(indexLoc -> indexLoc.getPartitionName())); for (final List<IndexLocation> locationList : startTimeWithFileByStorageDirectory.values()) { selected.addAll(getDirectories(startTime, endTime, locationList)); } return selected; } IndexDirectoryManager(final RepositoryConfiguration repoConfig); synchronized void initialize(); synchronized void deleteDirectory(final File directory); synchronized List<File> getDirectoriesBefore(final long timestamp); synchronized List<File> getDirectories(final Long startTime, final Long endTime); synchronized List<File> getDirectories(final Long startTime, final Long endTime, final String partitionName); boolean onIndexCommitted(final File indexDir); synchronized Optional<File> getActiveIndexDirectory(final String partitionName); synchronized File getWritableIndexingDirectory(final long earliestTimestamp, final String partitionName);  }