[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-db/master] Take out options for copying to rsync directory.
commit 5bdf0b012116bd3dddc257a463402824f92cacf3
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Fri Oct 26 14:20:02 2012 -0400
Take out options for copying to rsync directory.
---
config.template | 10 -------
.../db/bridgedescs/SanitizedBridgesWriter.java | 21 ++++++--------
.../BridgePoolAssignmentsProcessor.java | 9 ++----
.../ernie/db/exitlists/ExitListDownloader.java | 7 +---
.../torproject/ernie/db/main/Configuration.java | 13 ---------
.../ernie/db/main/RsyncDataProvider.java | 4 +-
.../ernie/db/relaydescs/ArchiveWriter.java | 29 +++++++++-----------
.../ernie/db/torperf/TorperfDownloader.java | 7 +---
8 files changed, 31 insertions(+), 69 deletions(-)
diff --git a/config.template b/config.template
index 94e28e3..8f9888b 100644
--- a/config.template
+++ b/config.template
@@ -102,16 +102,6 @@
#DownloadExitList 0
#
#
-######## Rsync directory ########
-#
-## Copy recently published decriptors to another directory to provide them
-## via rsync
-#ProvideFilesViaRsync 0
-#
-## Relative path to the directory that shall be provided via rsync
-#RsyncDirectory rsync/
-#
-#
######## Torperf downloader ########
#
## Download and merge Torperf .data and .extradata files
diff --git a/src/org/torproject/ernie/db/bridgedescs/SanitizedBridgesWriter.java b/src/org/torproject/ernie/db/bridgedescs/SanitizedBridgesWriter.java
index 15cb8f1..10d2baa 100644
--- a/src/org/torproject/ernie/db/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/org/torproject/ernie/db/bridgedescs/SanitizedBridgesWriter.java
@@ -180,19 +180,16 @@ public class SanitizedBridgesWriter {
// Finish writing sanitized bridge descriptors to disk
this.finishWriting();
- // Copy sanitized bridge descriptors from the last 3 days to rsync
+ // Copy sanitized bridge descriptors from the last 3 days to the rsync
// directory.
- if (config.getProvideFilesViaRsync()) {
- RsyncDataProvider rdp = new RsyncDataProvider(
- new File(config.getRsyncDirectory()));
- rdp.copyFiles(new File(sanitizedBridgesDirectory, "statuses"),
- "bridge-descriptors/statuses");
- rdp.copyFiles(
- new File(sanitizedBridgesDirectory, "server-descriptor"),
- "bridge-descriptors/server-descriptors");
- rdp.copyFiles(new File(sanitizedBridgesDirectory, "extra-info"),
- "bridge-descriptors/extra-infos");
- }
+ RsyncDataProvider rdp = new RsyncDataProvider();
+ rdp.copyFiles(new File(sanitizedBridgesDirectory, "statuses"),
+ "bridge-descriptors/statuses");
+ rdp.copyFiles(
+ new File(sanitizedBridgesDirectory, "server-descriptor"),
+ "bridge-descriptors/server-descriptors");
+ rdp.copyFiles(new File(sanitizedBridgesDirectory, "extra-info"),
+ "bridge-descriptors/extra-infos");
}
private String scrubOrAddress(String orAddress, byte[] fingerprintBytes,
diff --git a/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java b/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
index 63b7c4d..3893495 100644
--- a/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
+++ b/src/org/torproject/ernie/db/bridgepools/BridgePoolAssignmentsProcessor.java
@@ -175,12 +175,9 @@ public class BridgePoolAssignmentsProcessor {
// Copy sanitized bridge pool assignments from the last 3 days to the
// rsync directory.
- if (config.getProvideFilesViaRsync()) {
- RsyncDataProvider rdp = new RsyncDataProvider(
- new File(config.getRsyncDirectory()));
- rdp.copyFiles(sanitizedAssignmentsDirectory,
- "bridge-pool-assignments");
- }
+ RsyncDataProvider rdp = new RsyncDataProvider();
+ rdp.copyFiles(sanitizedAssignmentsDirectory,
+ "bridge-pool-assignments");
logger.info("Finished processing bridge pool assignment file(s).");
}
diff --git a/src/org/torproject/ernie/db/exitlists/ExitListDownloader.java b/src/org/torproject/ernie/db/exitlists/ExitListDownloader.java
index 9fb714b..f6f2865 100644
--- a/src/org/torproject/ernie/db/exitlists/ExitListDownloader.java
+++ b/src/org/torproject/ernie/db/exitlists/ExitListDownloader.java
@@ -100,11 +100,8 @@ public class ExitListDownloader {
logger.info(dumpStats.toString());
/* Copy exit lists from the last 3 days to the rsync directory. */
- if (config.getProvideFilesViaRsync()) {
- RsyncDataProvider rdp = new RsyncDataProvider(
- new File(config.getRsyncDirectory()));
- rdp.copyFiles(new File("exitlist"), "exit-lists");
- }
+ RsyncDataProvider rdp = new RsyncDataProvider();
+ rdp.copyFiles(new File("exitlist"), "exit-lists");
}
}
diff --git a/src/org/torproject/ernie/db/main/Configuration.java b/src/org/torproject/ernie/db/main/Configuration.java
index adf22cc..65ab948 100644
--- a/src/org/torproject/ernie/db/main/Configuration.java
+++ b/src/org/torproject/ernie/db/main/Configuration.java
@@ -56,8 +56,6 @@ public class Configuration {
private String torperfOutputDirectory = "torperf/";
private SortedMap<String, String> torperfSources = null;
private List<String> torperfFiles = null;
- private boolean provideFilesViaRsync = false;
- private String rsyncDirectory = "rsync";
public Configuration() {
/* Initialize logger. */
@@ -191,11 +189,6 @@ public class Configuration {
System.exit(1);
}
this.torperfFiles.add(line);
- } else if (line.startsWith("ProvideFilesViaRsync")) {
- this.provideFilesViaRsync = Integer.parseInt(
- line.split(" ")[1]) != 0;
- } else if (line.startsWith("RsyncDirectory")) {
- this.rsyncDirectory = line.split(" ")[1];
} else {
logger.severe("Configuration file contains unrecognized "
+ "configuration key in line '" + line + "'! Exiting!");
@@ -349,11 +342,5 @@ public class Configuration {
public List<String> getTorperfFiles() {
return this.torperfFiles;
}
- public boolean getProvideFilesViaRsync() {
- return this.provideFilesViaRsync;
- }
- public String getRsyncDirectory() {
- return this.rsyncDirectory;
- }
}
diff --git a/src/org/torproject/ernie/db/main/RsyncDataProvider.java b/src/org/torproject/ernie/db/main/RsyncDataProvider.java
index 78ea1f3..7788584 100644
--- a/src/org/torproject/ernie/db/main/RsyncDataProvider.java
+++ b/src/org/torproject/ernie/db/main/RsyncDataProvider.java
@@ -25,7 +25,7 @@ public class RsyncDataProvider {
private File rsyncDirectory;
- public RsyncDataProvider(File rsyncDirectory) {
+ public RsyncDataProvider() {
/* Initialize logger. */
this.logger = Logger.getLogger(RsyncDataProvider.class.getName());
@@ -35,10 +35,10 @@ public class RsyncDataProvider {
- 3L * 24L * 60L * 60L * 1000L;
/* Create rsync/ directory if it doesn't exist. */
+ this.rsyncDirectory = new File("rsync");
if (!rsyncDirectory.exists()) {
rsyncDirectory.mkdirs();
}
- this.rsyncDirectory = rsyncDirectory;
}
public void copyFiles(File fromDirectory, String toRsyncSubDirectory) {
diff --git a/src/org/torproject/ernie/db/relaydescs/ArchiveWriter.java b/src/org/torproject/ernie/db/relaydescs/ArchiveWriter.java
index 8d7e413..a9cb604 100644
--- a/src/org/torproject/ernie/db/relaydescs/ArchiveWriter.java
+++ b/src/org/torproject/ernie/db/relaydescs/ArchiveWriter.java
@@ -88,22 +88,19 @@ public class ArchiveWriter {
/* Copy relay descriptors from the last 3 days to the rsync
* directory. */
- if (config.getProvideFilesViaRsync()) {
- RsyncDataProvider rsdp = new RsyncDataProvider(
- new File(config.getRsyncDirectory()));
- rsdp.copyFiles(
- new File(outputDirectory, "consensus"),
- "relay-descriptors/consensuses");
- rsdp.copyFiles(
- new File(outputDirectory, "vote"),
- "relay-descriptors/votes");
- rsdp.copyFiles(
- new File(outputDirectory, "server-descriptor"),
- "relay-descriptors/server-descriptors");
- rsdp.copyFiles(
- new File(outputDirectory, "extra-info"),
- "relay-descriptors/extra-infos");
- }
+ RsyncDataProvider rsdp = new RsyncDataProvider();
+ rsdp.copyFiles(
+ new File(outputDirectory, "consensus"),
+ "relay-descriptors/consensuses");
+ rsdp.copyFiles(
+ new File(outputDirectory, "vote"),
+ "relay-descriptors/votes");
+ rsdp.copyFiles(
+ new File(outputDirectory, "server-descriptor"),
+ "relay-descriptors/server-descriptors");
+ rsdp.copyFiles(
+ new File(outputDirectory, "extra-info"),
+ "relay-descriptors/extra-infos");
}
private boolean store(byte[] typeAnnotation, byte[] data,
diff --git a/src/org/torproject/ernie/db/torperf/TorperfDownloader.java b/src/org/torproject/ernie/db/torperf/TorperfDownloader.java
index 07b444e..5f09038 100644
--- a/src/org/torproject/ernie/db/torperf/TorperfDownloader.java
+++ b/src/org/torproject/ernie/db/torperf/TorperfDownloader.java
@@ -57,11 +57,8 @@ public class TorperfDownloader {
this.writeLastMergedTimestamps();
/* Copy Torperf files from the last 3 days to the rsync directory. */
- if (config.getProvideFilesViaRsync()) {
- RsyncDataProvider rdp = new RsyncDataProvider(
- new File(config.getRsyncDirectory()));
- rdp.copyFiles(torperfOutputDirectory, "torperf");
- }
+ RsyncDataProvider rdp = new RsyncDataProvider();
+ rdp.copyFiles(torperfOutputDirectory, "torperf");
}
private File torperfLastMergedFile =
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits