Skip to content

Commit

Permalink
Merge pull request #82 from michaeldinzinger/devRocksDBPurge
Browse files Browse the repository at this point in the history
Modifying functionality for rocksdb.purge to use abstract method
  • Loading branch information
jnioche authored Jan 17, 2023
2 parents 053039b + 40396f4 commit bc3584e
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@
import crawlercommons.urlfrontier.service.QueueWithinCrawl;
import crawlercommons.urlfrontier.service.SynchronizedStreamObserver;
import io.grpc.stub.StreamObserver;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -96,14 +91,8 @@ public RocksDBService(final Map<String, String> configuration) {
LOG.info("RocksDB data stored in {} ", path);

if (configuration.containsKey("rocksdb.purge")) {
try {
Files.walk(Paths.get(path))
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
} catch (IOException e) {
LOG.error("Couldn't delete path {}", path);
}
createOrCleanDirectory(path);
LOG.info("Purged storage path {}", path);
}

if (configuration.containsKey("rocksdb.stats")) {
Expand Down

0 comments on commit bc3584e

Please sign in to comment.