[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-db/master] Include exit lists in rsync, too.
commit c7d8ec8a32ecfb24ef85745849e889f08947ddd1
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Fri Jan 27 11:28:32 2012 +0100
Include exit lists in rsync, too.
---
src/org/torproject/ernie/db/Main.java | 1 +
src/org/torproject/ernie/db/RsyncDataProvider.java | 22 +++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/ernie/db/Main.java b/src/org/torproject/ernie/db/Main.java
index a20748a..ab79174 100644
--- a/src/org/torproject/ernie/db/Main.java
+++ b/src/org/torproject/ernie/db/Main.java
@@ -146,6 +146,7 @@ public class Main {
new File(config.getSanitizedBridgesWriteDirectory()),
config.getSanitizedAssignmentsDirectory() == null ? null :
new File(config.getSanitizedAssignmentsDirectory()),
+ config.getDownloadExitList(),
new File(config.getRsyncDirectory()));
}
diff --git a/src/org/torproject/ernie/db/RsyncDataProvider.java b/src/org/torproject/ernie/db/RsyncDataProvider.java
index 11aa1c0..2f2c1b4 100644
--- a/src/org/torproject/ernie/db/RsyncDataProvider.java
+++ b/src/org/torproject/ernie/db/RsyncDataProvider.java
@@ -13,7 +13,8 @@ import java.util.logging.*;
public class RsyncDataProvider {
public RsyncDataProvider(File directoryArchivesOutputDirectory,
File sanitizedBridgesWriteDirectory,
- File sanitizedAssignmentsDirectory, File rsyncDirectory) {
+ File sanitizedAssignmentsDirectory,
+ boolean downloadExitList, File rsyncDirectory) {
/* Initialize logger. */
Logger logger = Logger.getLogger(RsyncDataProvider.class.getName());
@@ -126,6 +127,25 @@ public class RsyncDataProvider {
+ "are still " + fileNamesInRsync.size() + " files left in "
+ rsyncDirectory.getAbsolutePath() + ".");
+ /* Copy exit lists from the last 3 days. */
+ if (downloadExitList) {
+ files.add(new File("exitlist"));
+ while (!files.isEmpty()) {
+ File pop = files.pop();
+ if (pop.isDirectory()) {
+ files.addAll(Arrays.asList(pop.listFiles()));
+ } else if (pop.lastModified() >= cutOffMillis) {
+ String fileName = pop.getName();
+ this.copyFile(pop, new File(rsyncDirectory,
+ "exit-lists/" + fileName));
+ fileNamesInRsync.remove(pop.getName());
+ }
+ }
+ }
+ logger.info("After copying exit lists, 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()) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits