[
https://issues.apache.org/jira/browse/HDFS-9537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15051326#comment-15051326
]
Bob Hansen commented on HDFS-9537:
----------------------------------
Question for reviewers:
The design of the Configuration class is to have immutable data, and always
return a new instance. This is a Good Thing.
However, with HdfsConfiguration as a subclass of Configuration, we need to
contort the code to support Configuration::Load returning a Configuration
object and HdfsConfiguration::Load returning an HdfsConfiguration object.
As I saw it, my options were:
* Have thing public methods that call into a template to do the actual
Load/AddResource calls (this is what's implemented in the patch). This means a
chunk of boilerplate code to act as the public wrappers around the
implementations.
* Make HdfsConfig has-a Configuration rather than is-a configuration. This
forces the consumer to load the configuration separately from the
HdfsConfiguration object (which would then be responsible just to convert
Configurations into Options), or we'd need to wrap all of the useful
Configuration calls into pass-throughs for the HdfsConfiguation.
* Make all of the load/add methods templates rather than member functions.
This would make the least code, but would need to expose the underlying map
objects in the public space for the template functions to work on. As
submitted, the template objects are methods so get access to the protected
methods.
What I really wanted was a template that was effectively template<class *this>
....
Any thoughts on those trades?
> libhdfs++: implement HDFSConfiguration class
> --------------------------------------------
>
> Key: HDFS-9537
> URL: https://issues.apache.org/jira/browse/HDFS-9537
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client
> Reporter: Bob Hansen
> Assignee: Bob Hansen
> Attachments: HDFS-9537.HDFS-8707.000.patch
>
>
> Create a class to encode the rules for interpreting a Configuration class to
> create a libhdfs++ Options object
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)