BlobIdTracker implements Closeable, BlobTracker { @Override public Iterator<String> get() throws IOException { try { globalMerge(); return store.getRecords(); } catch (IOException e) { LOG.error("Error in retrieving blob records iterator", e); throw e; } } private  BlobIdTracker(); private  BlobIdTracker(String path, String repositoryId, long snapshotIntervalSecs, SharedDataStore datastore); private  BlobIdTracker(String path, String repositoryId, ScheduledExecutorService scheduler, long snapshotDelaySecs,
        long snapshotIntervalSecs, SharedDataStore datastore); static BlobIdTracker build(String path, String repositoryId, long snapshotIntervalSecs, SharedDataStore datastore); ActiveDeletionTracker getDeleteTracker(); @Override void remove(File recs, Options options); @Override void remove(File recs); @Override void remove(Iterator<String> recs); @Override void add(String id); @Override void add(Iterator<String> recs); @Override void add(File recs); @Override Iterator<String> get(); @Override File get(String path); @Override void close();  }
@Test public void snapshotIgnoreAfterRemove() throws Exception { LOG.info("In snapshotIgnoreAfterRemove"); BlobIdTracker.SnapshotJob job = tracker.new SnapshotJob(); snapshotRemove(job, false); ScheduledFuture<?> scheduledFuture = scheduler.schedule(job, 0, TimeUnit.MILLISECONDS); scheduledFuture.get(); assertTrue("Snapshot not skipped", read(dataStore.getAllMetadataRecords(BLOBREFERENCES.getType())).isEmpty()); }
@Test public void snapshotExecuteAfterRemove() throws Exception { LOG.info("In snapshotExecuteAfterRemove"); Clock clock = Clock.ACCURATE; BlobIdTracker.SnapshotJob job = tracker.new SnapshotJob(100, clock); Set<String> present = snapshotRemove(job, false); clock.waitUntil(System.currentTimeMillis() + 100); ScheduledFuture<?> scheduledFuture = scheduler.schedule(job, 0, TimeUnit.MILLISECONDS); scheduledFuture.get(); assertEquals("Elements not equal after snapshot after remove", present, read(dataStore.getAllMetadataRecords(BLOBREFERENCES.getType()))); }
@Test public void snapshotBeforeRemove() throws Exception { LOG.info("In snapshotBeforeRemove"); Clock clock = Clock.ACCURATE; BlobIdTracker.SnapshotJob job = tracker.new SnapshotJob(100, clock); Set<String> present = snapshotRemove(job, true); clock.waitUntil(System.currentTimeMillis() + 100); ScheduledFuture<?> scheduledFuture = scheduler.schedule(job, 0, TimeUnit.MILLISECONDS); scheduledFuture.get(); assertEquals("Elements not equal after snapshot after remove", present, read(dataStore.getAllMetadataRecords(BLOBREFERENCES.getType()))); }