Class CollecTorMain
java.lang.Object
org.torproject.metrics.collector.sync.SyncManager
org.torproject.metrics.collector.cron.CollecTorMain
- All Implemented Interfaces:
java.lang.Runnable,java.util.concurrent.Callable<java.lang.Object>
- Direct Known Subclasses:
ArchiveWriter,BridgedbMetricsProcessor,BridgePoolAssignmentsProcessor,CreateIndexJson,ExitListDownloader,OnionPerfDownloader,SanitizedBridgesWriter,SanitizeWeblogs,SnowflakeStatsDownloader
public abstract class CollecTorMain extends SyncManager implements java.util.concurrent.Callable<java.lang.Object>, java.lang.Runnable
-
Field Summary
Fields Modifier and Type Field Description protected Configurationconfigprotected java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>>mapPathDescriptorsstatic java.lang.StringSOURCES -
Constructor Summary
Constructors Constructor Description CollecTorMain(Configuration conf) -
Method Summary
Modifier and Type Method Description java.lang.Objectcall()Wrapper forrun.static voidcheckAvailableSpace(java.nio.file.Path location)Checks the available space for the storage the given path is located on and logs a warning, if 200 MiB or less are available, and otherwise logs available space in TRACE level.abstract java.lang.Stringmodule()Returns the module name for logging purposes.java.util.SortedSet<java.nio.file.Path>readProcessedFiles(java.nio.file.Path stateFile)Read file names of processed files from the given state file.voidrun()Log all errors preventing successful completion of the module.protected abstract voidstartProcessing()Module specific code goes here.java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>>syncMapPathsDescriptors()Returns map of path and descriptor type for download.protected abstract java.lang.StringsyncMarker()Returns property prefix/infix/postfix for Sync related properties.voidwriteProcessedFiles(java.nio.file.Path stateFile, java.util.SortedSet<java.nio.file.Path> processedFiles)Write file names of processed files to the state file.
-
Field Details
-
SOURCES
public static final java.lang.String SOURCES- See Also:
- Constant Field Values
-
config
-
mapPathDescriptors
protected final java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>> mapPathDescriptors
-
-
Constructor Details
-
Method Details
-
run
public final void run()Log all errors preventing successful completion of the module.- Specified by:
runin interfacejava.lang.Runnable
-
call
public final java.lang.Object call()Wrapper forrun.- Specified by:
callin interfacejava.util.concurrent.Callable<java.lang.Object>
-
startProcessing
Module specific code goes here.- Throws:
ConfigurationException
-
syncMarker
protected abstract java.lang.String syncMarker()Returns property prefix/infix/postfix for Sync related properties. -
module
public abstract java.lang.String module()Returns the module name for logging purposes. -
syncMapPathsDescriptors
public java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>> syncMapPathsDescriptors()Returns map of path and descriptor type for download. -
checkAvailableSpace
public static void checkAvailableSpace(java.nio.file.Path location)Checks the available space for the storage the given path is located on and logs a warning, if 200 MiB or less are available, and otherwise logs available space in TRACE level. -
readProcessedFiles
public java.util.SortedSet<java.nio.file.Path> readProcessedFiles(java.nio.file.Path stateFile)Read file names of processed files from the given state file.- Parameters:
stateFile- State file to read file names from.- Returns:
- File names of processed files.
-
writeProcessedFiles
public void writeProcessedFiles(java.nio.file.Path stateFile, java.util.SortedSet<java.nio.file.Path> processedFiles)Write file names of processed files to the state file.- Parameters:
stateFile- State file to write file names to.processedFiles- File names of processed files.
-