commit 843ae9b36cfe301f40f6be89781493496b4158cd Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu May 31 15:14:25 2012 +0200
Include GetTor stats in rsync/. --- src/org/torproject/ernie/db/Main.java | 2 ++ src/org/torproject/ernie/db/RsyncDataProvider.java | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/ernie/db/Main.java b/src/org/torproject/ernie/db/Main.java index 4fa9e37..dcb2800 100644 --- a/src/org/torproject/ernie/db/Main.java +++ b/src/org/torproject/ernie/db/Main.java @@ -153,6 +153,8 @@ public class Main { config.getSanitizedAssignmentsDirectory() == null ? null : new File(config.getSanitizedAssignmentsDirectory()), config.getDownloadExitList(), + !config.getDownloadGetTorStats() ? null : + new File(config.getGetTorDirectory()), new File(config.getRsyncDirectory())); }
diff --git a/src/org/torproject/ernie/db/RsyncDataProvider.java b/src/org/torproject/ernie/db/RsyncDataProvider.java index 19cf9a4..dac0249 100644 --- a/src/org/torproject/ernie/db/RsyncDataProvider.java +++ b/src/org/torproject/ernie/db/RsyncDataProvider.java @@ -21,7 +21,8 @@ public class RsyncDataProvider { public RsyncDataProvider(File directoryArchivesOutputDirectory, File sanitizedBridgesWriteDirectory, File sanitizedAssignmentsDirectory, - boolean downloadExitList, File rsyncDirectory) { + boolean downloadExitList, File getTorDirectory, + File rsyncDirectory) {
/* Initialize logger. */ Logger logger = Logger.getLogger(RsyncDataProvider.class.getName()); @@ -153,6 +154,22 @@ public class RsyncDataProvider { + fileNamesInRsync.size() + " files left in " + rsyncDirectory.getAbsolutePath() + ".");
+ /* Copy GetTor stats. */ + if (getTorDirectory != null) { + String getTorFileName = "gettor_stats.txt"; + File getTorFile = new File(getTorDirectory, getTorFileName); + if (getTorFile.exists() && + getTorFile.lastModified() >= cutOffMillis) { + this.copyFile(getTorFile, new File(rsyncDirectory, "gettor/" + + getTorFileName)); + fileNamesInRsync.remove(getTorFileName); + } + } + + logger.info("After copying the GetTor stats file, there are still " + + fileNamesInRsync.size() + " files left in " + + rsyncDirectory.getAbsolutePath() + "."); + /* Delete all files that we didn't (over-)write in this run. */ files.add(rsyncDirectory); while (!files.isEmpty()) {