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 Configuration config  
    protected java.util.Map<java.lang.String,​java.lang.Class<? extends org.torproject.descriptor.Descriptor>> mapPathDescriptors  
    static java.lang.String SOURCES  

    Fields inherited from class org.torproject.metrics.collector.sync.SyncManager

    SYNCORIGINS
  • Constructor Summary

    Constructors 
    Constructor Description
    CollecTorMain​(Configuration conf)  
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class org.torproject.metrics.collector.sync.SyncManager

    merge

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • run

      public final void run()
      Log all errors preventing successful completion of the module.
      Specified by:
      run in interface java.lang.Runnable
    • call

      public final java.lang.Object call()
      Wrapper for run.
      Specified by:
      call in interface java.util.concurrent.Callable<java.lang.Object>
    • startProcessing

      protected abstract void startProcessing() throws ConfigurationException
      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.