public abstract class CollecTorMain extends SyncManager implements java.util.concurrent.Callable<java.lang.Object>, java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected Configuration |
config |
protected java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>> |
mapPathDescriptors |
static java.lang.String |
SOURCES |
SYNCORIGINS
Constructor and Description |
---|
CollecTorMain(Configuration conf) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
call()
Wrapper for
run . |
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.
|
abstract java.lang.String |
module()
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.
|
void |
run()
Log all errors preventing successful completion of the module.
|
protected abstract void |
startProcessing()
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.String |
syncMarker()
Returns property prefix/infix/postfix for Sync related properties.
|
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.
|
merge
public static final java.lang.String SOURCES
protected Configuration config
protected final java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>> mapPathDescriptors
public CollecTorMain(Configuration conf)
public final void run()
run
in interface java.lang.Runnable
public final java.lang.Object call()
run
.call
in interface java.util.concurrent.Callable<java.lang.Object>
protected abstract void startProcessing() throws ConfigurationException
ConfigurationException
protected abstract java.lang.String syncMarker()
public abstract java.lang.String module()
public java.util.Map<java.lang.String,java.lang.Class<? extends org.torproject.descriptor.Descriptor>> syncMapPathsDescriptors()
public static void checkAvailableSpace(java.nio.file.Path location)
public java.util.SortedSet<java.nio.file.Path> readProcessedFiles(java.nio.file.Path stateFile)
stateFile
- State file to read file names from.public void writeProcessedFiles(java.nio.file.Path stateFile, java.util.SortedSet<java.nio.file.Path> processedFiles)
stateFile
- State file to write file names to.processedFiles
- File names of processed files.