@Test public void testFindMetaFiles() throws BackupRestoreException { List<AbstractBackupPath> metas = metaProxy.findMetaFiles( new DateUtil.DateRange( Instant.ofEpochMilli(1859824860000L), Instant.ofEpochMilli(1859828420000L))); Assert.assertEquals(1, metas.size()); Assert.assertEquals("meta_v2_202812071801.json", metas.get(0).getFileName()); Assert.assertTrue(fs.doesRemoteFileExist(Paths.get(metas.get(0).getRemotePath()))); metas = metaProxy.findMetaFiles( new DateUtil.DateRange( Instant.ofEpochMilli(1859824860000L), Instant.ofEpochMilli(1859828460000L))); Assert.assertEquals(2, metas.size()); }
@Override public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) { ArrayList<AbstractBackupPath> metas = new ArrayList<>(); String prefix = getMetaPrefix(dateRange); String marker = getMetaPrefix(new DateUtil.DateRange(dateRange.getStartTime(), null)); logger.info( "Listing filesystem with prefix: {}, marker: {}, daterange: {}", prefix, marker, dateRange); Iterator<String> iterator = fs.listFileSystem(prefix, null, marker); while (iterator.hasNext()) { AbstractBackupPath abstractBackupPath = abstractBackupPathProvider.get(); abstractBackupPath.parseRemote(iterator.next()); logger.debug("Meta file found: {}", abstractBackupPath); if (abstractBackupPath.getLastModified().toEpochMilli() >= dateRange.getStartTime().toEpochMilli() && abstractBackupPath.getLastModified().toEpochMilli() <= dateRange.getEndTime().toEpochMilli()) { metas.add(abstractBackupPath); } } metas.sort(Collections.reverseOrder()); if (metas.size() == 0) { logger.info( "No meta file found on remote file system for the time period: {}", dateRange); } return metas; }
MetaV2Proxy implements IMetaProxy { @Override public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) { ArrayList<AbstractBackupPath> metas = new ArrayList<>(); String prefix = getMetaPrefix(dateRange); String marker = getMetaPrefix(new DateUtil.DateRange(dateRange.getStartTime(), null)); logger.info( "Listing filesystem with prefix: {}, marker: {}, daterange: {}", prefix, marker, dateRange); Iterator<String> iterator = fs.listFileSystem(prefix, null, marker); while (iterator.hasNext()) { AbstractBackupPath abstractBackupPath = abstractBackupPathProvider.get(); abstractBackupPath.parseRemote(iterator.next()); logger.debug("Meta file found: {}", abstractBackupPath); if (abstractBackupPath.getLastModified().toEpochMilli() >= dateRange.getStartTime().toEpochMilli() && abstractBackupPath.getLastModified().toEpochMilli() <= dateRange.getEndTime().toEpochMilli()) { metas.add(abstractBackupPath); } } metas.sort(Collections.reverseOrder()); if (metas.size() == 0) { logger.info( "No meta file found on remote file system for the time period: {}", dateRange); } return metas; } }
MetaV2Proxy implements IMetaProxy { @Override public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) { ArrayList<AbstractBackupPath> metas = new ArrayList<>(); String prefix = getMetaPrefix(dateRange); String marker = getMetaPrefix(new DateUtil.DateRange(dateRange.getStartTime(), null)); logger.info( "Listing filesystem with prefix: {}, marker: {}, daterange: {}", prefix, marker, dateRange); Iterator<String> iterator = fs.listFileSystem(prefix, null, marker); while (iterator.hasNext()) { AbstractBackupPath abstractBackupPath = abstractBackupPathProvider.get(); abstractBackupPath.parseRemote(iterator.next()); logger.debug("Meta file found: {}", abstractBackupPath); if (abstractBackupPath.getLastModified().toEpochMilli() >= dateRange.getStartTime().toEpochMilli() && abstractBackupPath.getLastModified().toEpochMilli() <= dateRange.getEndTime().toEpochMilli()) { metas.add(abstractBackupPath); } } metas.sort(Collections.reverseOrder()); if (metas.size() == 0) { logger.info( "No meta file found on remote file system for the time period: {}", dateRange); } return metas; } @Inject  MetaV2Proxy(
            IConfiguration configuration,
            IFileSystemContext backupFileSystemCtx,
            Provider<AbstractBackupPath> abstractBackupPathProvider); }
MetaV2Proxy implements IMetaProxy { @Override public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) { ArrayList<AbstractBackupPath> metas = new ArrayList<>(); String prefix = getMetaPrefix(dateRange); String marker = getMetaPrefix(new DateUtil.DateRange(dateRange.getStartTime(), null)); logger.info( "Listing filesystem with prefix: {}, marker: {}, daterange: {}", prefix, marker, dateRange); Iterator<String> iterator = fs.listFileSystem(prefix, null, marker); while (iterator.hasNext()) { AbstractBackupPath abstractBackupPath = abstractBackupPathProvider.get(); abstractBackupPath.parseRemote(iterator.next()); logger.debug("Meta file found: {}", abstractBackupPath); if (abstractBackupPath.getLastModified().toEpochMilli() >= dateRange.getStartTime().toEpochMilli() && abstractBackupPath.getLastModified().toEpochMilli() <= dateRange.getEndTime().toEpochMilli()) { metas.add(abstractBackupPath); } } metas.sort(Collections.reverseOrder()); if (metas.size() == 0) { logger.info( "No meta file found on remote file system for the time period: {}", dateRange); } return metas; } @Inject  MetaV2Proxy(
            IConfiguration configuration,
            IFileSystemContext backupFileSystemCtx,
            Provider<AbstractBackupPath> abstractBackupPathProvider); @Override Path getLocalMetaFileDirectory(); @Override String getMetaPrefix(DateUtil.DateRange dateRange); @Override Iterator<AbstractBackupPath> getIncrementals(DateUtil.DateRange dateRange); @Override List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange); @Override Path downloadMetaFile(AbstractBackupPath meta); @Override void cleanupOldMetaFiles(); @Override List<String> getSSTFilesFromMeta(Path localMetaPath); @Override BackupVerificationResult isMetaFileValid(AbstractBackupPath metaBackupPath); }
MetaV2Proxy implements IMetaProxy { @Override public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) { ArrayList<AbstractBackupPath> metas = new ArrayList<>(); String prefix = getMetaPrefix(dateRange); String marker = getMetaPrefix(new DateUtil.DateRange(dateRange.getStartTime(), null)); logger.info( "Listing filesystem with prefix: {}, marker: {}, daterange: {}", prefix, marker, dateRange); Iterator<String> iterator = fs.listFileSystem(prefix, null, marker); while (iterator.hasNext()) { AbstractBackupPath abstractBackupPath = abstractBackupPathProvider.get(); abstractBackupPath.parseRemote(iterator.next()); logger.debug("Meta file found: {}", abstractBackupPath); if (abstractBackupPath.getLastModified().toEpochMilli() >= dateRange.getStartTime().toEpochMilli() && abstractBackupPath.getLastModified().toEpochMilli() <= dateRange.getEndTime().toEpochMilli()) { metas.add(abstractBackupPath); } } metas.sort(Collections.reverseOrder()); if (metas.size() == 0) { logger.info( "No meta file found on remote file system for the time period: {}", dateRange); } return metas; } @Inject  MetaV2Proxy(
            IConfiguration configuration,
            IFileSystemContext backupFileSystemCtx,
            Provider<AbstractBackupPath> abstractBackupPathProvider); @Override Path getLocalMetaFileDirectory(); @Override String getMetaPrefix(DateUtil.DateRange dateRange); @Override Iterator<AbstractBackupPath> getIncrementals(DateUtil.DateRange dateRange); @Override List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange); @Override Path downloadMetaFile(AbstractBackupPath meta); @Override void cleanupOldMetaFiles(); @Override List<String> getSSTFilesFromMeta(Path localMetaPath); @Override BackupVerificationResult isMetaFileValid(AbstractBackupPath metaBackupPath);  }