[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #22836 [Metrics/Website]: Parse CollecTor's index.json and provide our own directory listing
#22836: Parse CollecTor's index.json and provide our own directory listing
-----------------------------+------------------------------
Reporter: karsten | Owner: karsten
Type: enhancement | Status: needs_review
Priority: Medium | Milestone:
Component: Metrics/Website | Version:
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
-----------------------------+------------------------------
Comment (by iwakeh):
I cannot find a test for `static List<String[]> formatTableEntries`, did
you forget a commit?
The waiting time shouldn't be extended unnecessarily:
{{{
- } while (System.currentTimeMillis() < waitingSinceMillis + 10000L);
+ } while (null == this.index
+ && System.currentTimeMillis() < waitingSinceMillis + 10000L);
}}}
In addition, it might be safer and shorter to simply use `AtomicReference`
instead of the synchronized methods.
Actually, I was hinting for a separate DirectoryListing class (in
comment:14), but separating the retrieval of the index is important, too.
The separation you provided made it easy to introduce a
`CollectorDirectoryProvider`, which fetches and provides the index incl.
the suggested use of `AtomicReference` and the second while-condition.
DirectoryListing is a `Map<String, List<String[]>>` and encapsulates the
conversion from Index* to lists of strings. `CollectorDirectoryProvider`
only manages the scheduler and handing out the index.
Another test `testListing` needs close inspection; it uses a fantasy
index.json and checks the resulting map.
Please, review the commit on top of
[https://gitweb.torproject.org/user/iwakeh/metrics-
web.git/commit/?h=task-22836 this branch].
(I didn't change the byte-calculations, b/c they are only 'optics' and the
compiler will make sure that a constant is created for the
Math.log(1024).)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/22836#comment:17>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs