[tor-commits] [metrics-db/master] Adapt assignments processor to ponticum's files.

karsten at torproject.org karsten at torproject.org
Sat May 5 17:12:17 UTC 2012


commit b6a95bb4574f4c1f53d9c702076cb2e4b222c58b
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sat May 5 19:10:24 2012 +0200

    Adapt assignments processor to ponticum's files.
---
 .../ernie/db/BridgePoolAssignmentsProcessor.java   |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/org/torproject/ernie/db/BridgePoolAssignmentsProcessor.java b/src/org/torproject/ernie/db/BridgePoolAssignmentsProcessor.java
index 3f30569..1eef418 100644
--- a/src/org/torproject/ernie/db/BridgePoolAssignmentsProcessor.java
+++ b/src/org/torproject/ernie/db/BridgePoolAssignmentsProcessor.java
@@ -32,7 +32,7 @@ public class BridgePoolAssignmentsProcessor {
       File file = files.pop();
       if (file.isDirectory()) {
         files.addAll(Arrays.asList(file.listFiles()));
-      } else {
+      } else if (!file.getName().endsWith(".gz")) {
         assignmentFiles.add(file);
       }
     }
@@ -49,8 +49,24 @@ public class BridgePoolAssignmentsProcessor {
             assignmentFile));
         String line, bridgePoolAssignmentLine = null;
         SortedSet<String> sanitizedAssignments = new TreeSet<String>();
-        boolean wroteLastLine = false;
+        boolean wroteLastLine = false, skipBefore20120504125947 = true;
         while ((line = br.readLine()) != null || !wroteLastLine) {
+          if (line != null && line.startsWith("bridge-pool-assignment ")) {
+            String[] parts = line.split(" ");
+            if (parts.length != 3) {
+              continue;
+            }
+            /* TODO Take out this temporary hack to ignore all assignments
+             * coming from ponticum when byblos was still the official
+             * BridgeDB host. */
+            if (line.compareTo(
+                "bridge-pool-assignment 2012-05-04 12:59:47") >= 0) {
+              skipBefore20120504125947 = false;
+            }
+          }
+          if (skipBefore20120504125947) {
+            continue;
+          }
           if (line == null ||
               line.startsWith("bridge-pool-assignment ")) {
             if (bridgePoolAssignmentLine != null) {



More information about the tor-commits mailing list