Class ArchiveWriter
- java.lang.Object
-
- org.torproject.metrics.collector.sync.SyncManager
-
- org.torproject.metrics.collector.cron.CollecTorMain
-
- org.torproject.metrics.collector.relaydescs.ArchiveWriter
-
- All Implemented Interfaces:
java.lang.Runnable,java.util.concurrent.Callable<java.lang.Object>
public class ArchiveWriter extends CollecTorMain
-
-
Field Summary
-
Fields inherited from class org.torproject.metrics.collector.cron.CollecTorMain
config, mapPathDescriptors, SOURCES
-
Fields inherited from class org.torproject.metrics.collector.sync.SyncManager
SYNCORIGINS
-
-
Constructor Summary
Constructors Constructor Description ArchiveWriter(Configuration config)Initialize an archive writer with a given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUpDirectories()Delete all files from the rsync (out) directory that have not been modified in the last three days (seven weeks), and remove the .tmp extension from newly written files.voidintermediateStats(java.lang.String event)Compiles a message with statistics on stored descriptors by type for later inclusion in the log and resets counters.java.lang.Stringmodule()Returns the module name for logging purposes.protected voidstartProcessing()Module specific code goes here.voidstoreCertificate(byte[] data, java.lang.String fingerprint, long published)Stores a key certificate to disk.voidstoreConsensus(byte[] data, long validAfter, java.util.SortedSet<java.lang.String> dirSources, java.util.SortedSet<java.lang.String> serverDescriptorDigests)Stores a consensus to disk and adds all referenced votes and server descriptors to the list of missing descriptors.voidstoreExtraInfoDescriptor(byte[] data, java.lang.String extraInfoDigest, long published)Stores an extra-info descriptor to disk.voidstoreMicrodescConsensus(byte[] data, long validAfter, java.util.SortedSet<java.lang.String> microdescriptorDigests)Stores a microdesc consensus to disk and adds all referenced microdescriptors to the list of missing descriptors.voidstoreMicrodescriptor(byte[] data, java.lang.String microdescriptorDigest, long validAfter)Stores a microdescriptor to disk.voidstoreServerDescriptor(byte[] data, java.lang.String digest, long published, java.lang.String extraInfoDigest)Stores a server descriptor to disk and adds the referenced extra-info descriptor to the list of missing descriptors.voidstoreVote(byte[] data, long validAfter, java.lang.String fingerprint, java.lang.String digest, java.util.SortedSet<java.lang.String> serverDescriptorDigests)Stores a vote to disk and adds all referenced server descriptors to the list of missing descriptors.protected java.lang.StringsyncMarker()Returns property prefix/infix/postfix for Sync related properties.-
Methods inherited from class org.torproject.metrics.collector.cron.CollecTorMain
call, checkAvailableSpace, readProcessedFiles, run, syncMapPathsDescriptors, writeProcessedFiles
-
Methods inherited from class org.torproject.metrics.collector.sync.SyncManager
merge
-
-
-
-
Constructor Detail
-
ArchiveWriter
public ArchiveWriter(Configuration config)
Initialize an archive writer with a given configuration.
-
-
Method Detail
-
module
public java.lang.String module()
Description copied from class:CollecTorMainReturns the module name for logging purposes.- Specified by:
modulein classCollecTorMain
-
syncMarker
protected java.lang.String syncMarker()
Description copied from class:CollecTorMainReturns property prefix/infix/postfix for Sync related properties.- Specified by:
syncMarkerin classCollecTorMain
-
startProcessing
protected void startProcessing() throws ConfigurationExceptionDescription copied from class:CollecTorMainModule specific code goes here.- Specified by:
startProcessingin classCollecTorMain- Throws:
ConfigurationException
-
intermediateStats
public void intermediateStats(java.lang.String event)
Compiles a message with statistics on stored descriptors by type for later inclusion in the log and resets counters.
-
cleanUpDirectories
public void cleanUpDirectories()
Delete all files from the rsync (out) directory that have not been modified in the last three days (seven weeks), and remove the .tmp extension from newly written files.
-
storeConsensus
public void storeConsensus(byte[] data, long validAfter, java.util.SortedSet<java.lang.String> dirSources, java.util.SortedSet<java.lang.String> serverDescriptorDigests)Stores a consensus to disk and adds all referenced votes and server descriptors to the list of missing descriptors.
-
storeMicrodescConsensus
public void storeMicrodescConsensus(byte[] data, long validAfter, java.util.SortedSet<java.lang.String> microdescriptorDigests)Stores a microdesc consensus to disk and adds all referenced microdescriptors to the list of missing descriptors.
-
storeVote
public void storeVote(byte[] data, long validAfter, java.lang.String fingerprint, java.lang.String digest, java.util.SortedSet<java.lang.String> serverDescriptorDigests)Stores a vote to disk and adds all referenced server descriptors to the list of missing descriptors.
-
storeCertificate
public void storeCertificate(byte[] data, java.lang.String fingerprint, long published)Stores a key certificate to disk.
-
storeServerDescriptor
public void storeServerDescriptor(byte[] data, java.lang.String digest, long published, java.lang.String extraInfoDigest)Stores a server descriptor to disk and adds the referenced extra-info descriptor to the list of missing descriptors.
-
storeExtraInfoDescriptor
public void storeExtraInfoDescriptor(byte[] data, java.lang.String extraInfoDigest, long published)Stores an extra-info descriptor to disk.
-
storeMicrodescriptor
public void storeMicrodescriptor(byte[] data, java.lang.String microdescriptorDigest, long validAfter)Stores a microdescriptor to disk.
-
-