[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [collector/master] Makes recent path configurable (part of #19776).
commit e64db09c1a080bdb0ba265240f9adfa6b44f1924
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date: Tue Aug 2 21:33:04 2016 +0200
Makes recent path configurable (part of #19776).
---
.../torproject/collector/bridgedescs/BridgeDescriptorParser.java | 5 ++++-
.../org/torproject/collector/bridgedescs/BridgeSnapshotReader.java | 4 +++-
.../torproject/collector/bridgedescs/SanitizedBridgesWriter.java | 6 +++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/torproject/collector/bridgedescs/BridgeDescriptorParser.java b/src/main/java/org/torproject/collector/bridgedescs/BridgeDescriptorParser.java
index 6dc05b6..8850598 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/BridgeDescriptorParser.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/BridgeDescriptorParser.java
@@ -3,6 +3,8 @@
package org.torproject.collector.bridgedescs;
+import org.torproject.collector.conf.ConfigurationException;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,7 +28,8 @@ public class BridgeDescriptorParser {
/** Parses the first line of the given descriptor data to determine the
* descriptor type and passes it to the sanitized bridges writer. */
- public void parse(byte[] allData, String dateTime) {
+ public void parse(byte[] allData, String dateTime)
+ throws ConfigurationException {
try {
BufferedReader br = new BufferedReader(new StringReader(
new String(allData, "US-ASCII")));
diff --git a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
index 3df5242..797d8cf 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
@@ -3,6 +3,8 @@
package org.torproject.collector.bridgedescs;
+import org.torproject.collector.conf.ConfigurationException;
+
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
@@ -32,7 +34,7 @@ public class BridgeSnapshotReader {
* Reads the half-hourly snapshots of bridge descriptors from Tonga.
*/
public BridgeSnapshotReader(BridgeDescriptorParser bdp,
- File bridgeDirectoriesDir, File statsDirectory) {
+ File bridgeDirectoriesDir, File statsDirectory) throws ConfigurationException {
if (bdp == null || bridgeDirectoriesDir == null
|| statsDirectory == null) {
diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
index 476f80b..8147487 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
@@ -378,7 +378,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
* Sanitizes a network status and writes it to disk.
*/
public void sanitizeAndStoreNetworkStatus(byte[] data,
- String publicationTime) {
+ String publicationTime) throws ConfigurationException {
if (this.persistenceProblemWithSecrets) {
/* There's a persistence problem, so we shouldn't scrub more IP
@@ -547,8 +547,8 @@ public class SanitizedBridgesWriter extends CollecTorMain {
+ "/" + smonth + "/statuses/" + sday + "/" + syear + smonth
+ sday + "-" + stime + "-"
+ "4A0CCD2DDC7995083D73F5D667100C8A5831F16D");
- File rsyncFile = new File("recent/bridge-descriptors/statuses/"
- + tarballFile.getName());
+ File rsyncFile = new File(config.getPath(Key.RecentPath).toFile(),
+ "bridge-descriptors/statuses/" + tarballFile.getName());
File[] outputFiles = new File[] { tarballFile, rsyncFile };
for (File outputFile : outputFiles) {
outputFile.getParentFile().mkdirs();
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits