Class RelayDescriptorDownloader


  • public class RelayDescriptorDownloader
    extends java.lang.Object
    Downloads relay descriptors from the directory authorities via HTTP. Keeps a list of missing descriptors that gets updated by parse results from RelayDescriptorParser and downloads all missing descriptors that have been published in the last 24 hours. Also downloads all server and extra-info descriptors known to a directory authority at most once a day.
    • Constructor Summary

      Constructors 
      Constructor Description
      RelayDescriptorDownloader​(RelayDescriptorParser rdp, java.lang.String[] authorities, java.lang.String[] authorityFingerprints, boolean downloadCurrentConsensus, boolean downloadCurrentMicrodescConsensus, boolean downloadCurrentVotes, boolean downloadMissingServerDescriptors, boolean downloadMissingExtraInfos, boolean downloadMissingMicrodescriptors, boolean downloadAllServerDescriptors, boolean downloadAllExtraInfos, boolean downloadCompressed)
      Initializes this class, including reading in missing descriptors from stats/missing-relay-descriptors and the times when we last downloaded all server and extra-info descriptors from stats/last-downloaded-all-descriptors.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void downloadDescriptors()
      Downloads missing descriptors that we think might still be available on the directory authorities as well as all server and extra-info descriptors once per day.
      void haveParsedConsensus​(java.lang.String validAfter, java.util.Set<java.lang.String> authorities, java.util.Set<java.lang.String> serverDescriptors)
      We have parsed a consensus.
      void haveParsedExtraInfoDescriptor​(java.lang.String published, java.lang.String relayIdentity, java.lang.String extraInfoDigest)
      We have parsed an extra-info descriptor.
      void haveParsedMicrodescConsensus​(java.lang.String validAfter, java.util.Set<java.lang.String> microdescriptors)
      We have parsed a microdesc consensus.
      void haveParsedMicrodescriptor​(java.lang.String descriptorDigest)
      We have parsed a microdescriptor.
      void haveParsedServerDescriptor​(java.lang.String published, java.lang.String relayIdentity, java.lang.String serverDescriptorDigest, java.lang.String extraInfoDigest)
      We have parsed a server descriptor.
      void haveParsedVote​(java.lang.String validAfter, java.lang.String fingerprint, java.util.Set<java.lang.String> serverDescriptors)
      We have parsed a vote.
      void writeFile()
      Writes status files to disk and logs statistics about downloading relay descriptors in this execution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RelayDescriptorDownloader

        public RelayDescriptorDownloader​(RelayDescriptorParser rdp,
                                         java.lang.String[] authorities,
                                         java.lang.String[] authorityFingerprints,
                                         boolean downloadCurrentConsensus,
                                         boolean downloadCurrentMicrodescConsensus,
                                         boolean downloadCurrentVotes,
                                         boolean downloadMissingServerDescriptors,
                                         boolean downloadMissingExtraInfos,
                                         boolean downloadMissingMicrodescriptors,
                                         boolean downloadAllServerDescriptors,
                                         boolean downloadAllExtraInfos,
                                         boolean downloadCompressed)
        Initializes this class, including reading in missing descriptors from stats/missing-relay-descriptors and the times when we last downloaded all server and extra-info descriptors from stats/last-downloaded-all-descriptors.
    • Method Detail

      • haveParsedConsensus

        public void haveParsedConsensus​(java.lang.String validAfter,
                                        java.util.Set<java.lang.String> authorities,
                                        java.util.Set<java.lang.String> serverDescriptors)
        We have parsed a consensus. Take this consensus off the missing list and add the votes created by the given authorities and the serverDescriptors which are in the format "<published>,<relayid>,<descid>" to that list.
      • haveParsedMicrodescConsensus

        public void haveParsedMicrodescConsensus​(java.lang.String validAfter,
                                                 java.util.Set<java.lang.String> microdescriptors)
        We have parsed a microdesc consensus. Take this microdesc consensus off the missing list and add the microdescriptors which are in the format "<validafter>,<relayid>,<descid>" to that list.
      • haveParsedVote

        public void haveParsedVote​(java.lang.String validAfter,
                                   java.lang.String fingerprint,
                                   java.util.Set<java.lang.String> serverDescriptors)
        We have parsed a vote. Take this vote off the missing list and add the serverDescriptors which are in the format "<published>,<relayid>,<descid>" to that list.
      • haveParsedServerDescriptor

        public void haveParsedServerDescriptor​(java.lang.String published,
                                               java.lang.String relayIdentity,
                                               java.lang.String serverDescriptorDigest,
                                               java.lang.String extraInfoDigest)
        We have parsed a server descriptor. Take this server descriptor off the missing list and put the extra-info descriptor digest on that list.
      • haveParsedExtraInfoDescriptor

        public void haveParsedExtraInfoDescriptor​(java.lang.String published,
                                                  java.lang.String relayIdentity,
                                                  java.lang.String extraInfoDigest)
        We have parsed an extra-info descriptor. Take it off the missing list.
      • haveParsedMicrodescriptor

        public void haveParsedMicrodescriptor​(java.lang.String descriptorDigest)
        We have parsed a microdescriptor. Take it off the missing list.
      • downloadDescriptors

        public void downloadDescriptors()
        Downloads missing descriptors that we think might still be available on the directory authorities as well as all server and extra-info descriptors once per day.
      • writeFile

        public void writeFile()
        Writes status files to disk and logs statistics about downloading relay descriptors in this execution.