Class DocumentStore
- java.lang.Object
-
- org.torproject.metrics.onionoo.docs.DocumentStore
-
public class DocumentStore extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DocumentStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flushDocumentCache()
Writes cached node statuses, cached summary documents, and then the update file to disk.java.lang.String
getStatsString()
Returns a string with statistics on document storage operations.void
invalidateDocumentCache()
Invalidates the document cache, so that it will be freshly populated during the next execution.<T extends Document>
java.util.SortedSet<java.lang.String>list(java.lang.Class<T> documentType)
<T extends Document>
java.util.SortedSet<java.lang.String>list(java.lang.Class<T> documentType, long updatedAfter)
Returns all fingerprints of documents of the given type that have been updated after the given time in milliseconds since the epoch.<T extends Document>
booleanremove(java.lang.Class<T> documentType)
<T extends Document>
booleanremove(java.lang.Class<T> documentType, java.lang.String fingerprint)
Removes the document with given type and identified by the given fingerprint.<T extends Document>
Tretrieve(java.lang.Class<T> documentType, boolean parse)
<T extends Document>
Tretrieve(java.lang.Class<T> documentType, boolean parse, java.lang.String fingerprint)
Retrieves the document with given type and identified by the given fingerprint, and either parses it or returns it unparsed.void
setOutDir(java.io.File outDir)
<T extends Document>
booleanstore(T document)
<T extends Document>
booleanstore(T document, java.lang.String fingerprint)
Stores the given document using the given fingerprint as identifier.
-
-
-
Method Detail
-
setOutDir
public void setOutDir(java.io.File outDir)
-
list
public <T extends Document> java.util.SortedSet<java.lang.String> list(java.lang.Class<T> documentType)
-
list
public <T extends Document> java.util.SortedSet<java.lang.String> list(java.lang.Class<T> documentType, long updatedAfter)
Returns all fingerprints of documents of the given type that have been updated after the given time in milliseconds since the epoch.
-
store
public <T extends Document> boolean store(T document)
-
store
public <T extends Document> boolean store(T document, java.lang.String fingerprint)
Stores the given document using the given fingerprint as identifier.
-
retrieve
public <T extends Document> T retrieve(java.lang.Class<T> documentType, boolean parse)
-
retrieve
public <T extends Document> T retrieve(java.lang.Class<T> documentType, boolean parse, java.lang.String fingerprint)
Retrieves the document with given type and identified by the given fingerprint, and either parses it or returns it unparsed.
-
remove
public <T extends Document> boolean remove(java.lang.Class<T> documentType)
-
remove
public <T extends Document> boolean remove(java.lang.Class<T> documentType, java.lang.String fingerprint)
Removes the document with given type and identified by the given fingerprint.
-
flushDocumentCache
public void flushDocumentCache()
Writes cached node statuses, cached summary documents, and then the update file to disk.
-
invalidateDocumentCache
public void invalidateDocumentCache()
Invalidates the document cache, so that it will be freshly populated during the next execution.
-
getStatsString
public java.lang.String getStatsString()
Returns a string with statistics on document storage operations.
-
-