Class CollecTorMain

    • 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  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      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 Detail

      • mapPathDescriptors

        protected final java.util.Map<java.lang.String,​java.lang.Class<? extends org.torproject.descriptor.Descriptor>> mapPathDescriptors
    • Constructor Detail

    • Method Detail

      • 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>
      • 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.