[ 
https://issues.apache.org/jira/browse/HDFS-8345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14545531#comment-14545531
 ] 

Sean Busbey commented on HDFS-8345:
-----------------------------------

It would be nice if the returned values from getAllStoragePolicies were usable 
in a setStoragePolicy method.

Could we update the FileSystem specification documents?

{code}
+   * Set the storage policy for a given file or directory.
+   *
+   * @param path file or directory path.
+   * @param policyName the name of the target storage policy. The list
+   *                   of supported Storage policies can be retrieved
+   *                   via {@link #getStoragePolicyNames}.
+   */
+  public void setStoragePolicy(final Path path, final String policyName)
+      throws IOException {
{code}

Note that it's an optional operation and some implementations will throw 
UnsupportOperationException.

{code}
+  /**
+   * Retrieve all the storage policies supported by this file system.
+   *
+   * @return all storage policies supported by this filesystem.
+   * @throws IOException
+   */
+  public List<? extends BlockStoragePolicySpi> getAllStoragePolicies()
+      throws IOException {
{code}

Note that it's an optional operation and some implementations will throw 
UnsupportOperationException.

{code}
+   * @param policyName the name of the target storage policy. The list
+   *                   of supported Storage policies can be retrieved
+   *                   via {@link #getStoragePolicyNames}.
+   */
{code}

The method "getStoragePolicyNames" didn't make it into the patch. Update to 
point at new method?

{code}
+  public List<? extends BlockStoragePolicySpi> getAllStoragePolicies()
+      throws IOException {
{code}

Should this return type be Collection<? extends BlockStoragePolicySpi> ? does 
the ordering matter? Maybe it should be a Set?

{code}
+public interface BlockStoragePolicySpi {
+
{code}

Could we switch to calling the interface BlockStoragePolicy and make the one in 
HDFS "DFSBlockStoragePolicy" or the like?
"Spi" is a term of art that's going to be less accessible for folks.

{code}

+  StorageType[] getStorageTypes();
{code}

Should the various return types in BlockStoragePolicySpi be returning List or 
Set or SortedSet?

{code}
     return fs.createNonRecursive(f, permission, flags, bufferSize, 
replication, blockSize,
-        progress);
+                                 progress);
   }
{code}

nit: this whitespace fix doesn't appear related to the rest of the changes in 
the file (but I'm not sure what Hadoop's norm is for 'related')

> Storage policy APIs must be exposed via the FileSystem interface
> ----------------------------------------------------------------
>
>                 Key: HDFS-8345
>                 URL: https://issues.apache.org/jira/browse/HDFS-8345
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.7.0
>            Reporter: Arpit Agarwal
>            Assignee: Arpit Agarwal
>              Labels: BB2015-05-TBR
>         Attachments: HDFS-8345.01.patch, HDFS-8345.02.patch, 
> HDFS-8345.03.patch, HDFS-8345.04.patch, HDFS-8345.05.patch
>
>
> The storage policy APIs are not exposed via FileSystem. Since 
> DistributedFileSystem is tagged as LimitedPrivate we should expose the APIs 
> through FileSystem for use by other applications.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to