[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #22196 [Metrics/metrics-lib]: Configure descriptor sources using method chaining
#22196: Configure descriptor sources using method chaining
-------------------------------------+--------------------------
Reporter: karsten | Owner: metrics-team
Type: enhancement | Status: new
Priority: Medium | Milestone:
Component: Metrics/metrics-lib | Version:
Severity: Normal | Keywords:
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
-------------------------------------+--------------------------
The two descriptor sources `DescriptorReader` and `DescriptorParser` are
instantiated by `DescriptorSourceFactory`, configured, and then executed.
This requires state checks and leads to quite verbose application code.
An exception to this is `DescriptorCollector` which is state-less but
which has a method with 5 parameters, which also does not produce very
readable code.
We should consider switching to configuring descriptor sources using
method chanining. [https://gitweb.torproject.org/user/karsten/metrics-
lib.git/commit/?h=task-16225&id=f8c5862bbdfa0acefbbbd7d4899b997077c20196
Here's a code sample] from a few months ago, written for another ticket.
iwakeh rightly
[https://trac.torproject.org/projects/tor/ticket/16225#comment:6 commented
on that other ticket]: "configuration of a descriptor source by fluent-
style (or method chaining) is fine, but metrics-lib currently has the
DescriptorSourceFactory approach, which would need to be adapted. That is,
I see two things: the ideas around the code of DescriptorSourceBuilder are
ideas about a new way of configuration and not exception/error handling in
metrics-lib, i.e. a different ticket (there is one for redesign of the
interface hierarchy, I'll look for it). Second, the current configuration
and descriptor source instanciation need to be considered together (in
that other ticket)."
Not assigning to a milestone on purpose. This likely needs more thoughts
before we can write code and make plans for releasing that.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/22196>
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