mirror of
https://github.com/torproject/collector.git
synced 2024-11-23 09:29:46 +00:00
Take out options for copying to rsync directory.
This commit is contained in:
parent
9766f4c4e9
commit
5bdf0b0121
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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).");
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user