You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/03/09 17:38:44 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #1553: Simplify some VolumeManager tooling

milleruntime commented on a change in pull request #1553: Simplify some VolumeManager tooling
URL: https://github.com/apache/accumulo/pull/1553#discussion_r389818030
 
 

 ##########
 File path: server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
 ##########
 @@ -381,35 +343,17 @@ public boolean isReady() throws IOException {
 
   @Override
   public FileStatus[] globStatus(Path pathPattern) throws IOException {
-    return getVolumeByPath(pathPattern).getFileSystem().globStatus(pathPattern);
+    return getFileSystemByPath(pathPattern).globStatus(pathPattern);
   }
 
   @Override
   public Path matchingFileSystem(Path source, Set<String> options) {
-    try {
-      if (ViewFSUtils.isViewFS(source, hadoopConf)) {
-        return ViewFSUtils.matchingFileSystem(source, options, hadoopConf);
-      }
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-
-    URI uri1 = source.toUri();
-    for (String option : options) {
-      URI uri3 = URI.create(option);
-      if (uri1.getScheme().equals(uri3.getScheme())) {
-        String a1 = uri1.getAuthority();
-        String a2 = uri3.getAuthority();
-        if ((a1 == null && a2 == null) || (a1 != null && a1.equals(a2)))
-          return new Path(option);
-      }
-    }
-    return null;
-  }
-
-  @Override
-  public ContentSummary getContentSummary(Path dir) throws IOException {
-    return getVolumeByPath(dir).getFileSystem().getContentSummary(dir);
+    URI sourceUri = source.toUri();
+    return options.stream().filter(opt -> {
+      URI optUri = URI.create(opt);
+      return sourceUri.getScheme().equals(optUri.getScheme())
+          && Objects.equals(sourceUri.getAuthority(), optUri.getAuthority());
+    }).map((String opt) -> new Path(opt)).findFirst().orElse(null);
 
 Review comment:
   Nice replacement.  Could use method reference here too:
   ```suggestion
       }).map(Path::new).findFirst().orElse(null);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services