[
https://issues.apache.org/jira/browse/HDFS-5224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13788428#comment-13788428
]
Colin Patrick McCabe commented on HDFS-5224:
--------------------------------------------
Thanks for looking at this, Chris.
I don't think we should create another class. We already have
{{PathBasedCacheDirective}} (client-facing), {{PathBasedCacheDescriptor}} (a
directive with an ID associated), and {{PathBasedCacheEntry}} (server-side).
Adding more classes would just be too many!
It would make more sense to add a method like
{{DistributedFileSystem#createPathBasedCacheDirective(Path path)}} which
returns a {{PathBasedCacheDirective}}. Keep in mind that we want the
{{DistributedFileSystem}} to supply its current working directory, and validate
that the path matches its URI. Then, we should make the fields in
{{PathBasedCacheDirective}} mutable and provide setters, so clients can do
something like this:
{code}
fs.addPathBasedCacheDirective(fs.createPathBasedCacheDirective(new
Path("/foo/bar")).
setReplication(2).
setPool("pool1")));
{code}
This way:
* we don't have more class bloat
* DFS provides its working directory and validates the path
* it's easy to see what's being set
* we can add more fields to the directive later without breaking compatibility
or getting into constructor overload hell
> Refactor PathBasedCache* methods to use a Path rather than a String
> -------------------------------------------------------------------
>
> Key: HDFS-5224
> URL: https://issues.apache.org/jira/browse/HDFS-5224
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: datanode, namenode
> Affects Versions: HDFS-4949
> Reporter: Andrew Wang
> Assignee: Chris Nauroth
> Attachments: HDFS-5224.1.patch
>
>
> As discussed in HDFS-5213, we should refactor PathBasedCacheDirective and
> related methods in DistributedFileSystem to use a Path to represent paths to
> cache, rather than a String.
--
This message was sent by Atlassian JIRA
(v6.1#6144)