You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2019/07/29 20:34:26 UTC

[GitHub] [storm] agresch commented on a change in pull request #3094: STORM-3477 switch HDFS blobstore isRemoteBlobExists to use file exist…

agresch commented on a change in pull request #3094: STORM-3477 switch HDFS blobstore isRemoteBlobExists to use file exist…
URL: https://github.com/apache/storm/pull/3094#discussion_r308425045
 
 

 ##########
 File path: external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStore.java
 ##########
 @@ -336,6 +336,27 @@ public InputStreamWithMeta getBlob(String key, Subject who)
         }
     }
 
+    /**
+     * Checks if a blob exists.
+     *
+     * @param key blobstore key
+     * @param who subject
+     * @throws AuthorizationException if authorization is failed
+     * @throws KeyNotFoundException if key is not found
+     */
+    public boolean blobExists(String key, Subject who) throws AuthorizationException, KeyNotFoundException {
+        who = checkAndGetSubject(who);
+        validateKey(key);
+        SettableBlobMeta meta = getStoredBlobMeta(key);
+        aclHandler.hasPermissions(meta.get_acl(), READ, who, key);
+        try {
+            BlobStoreFile blobStoreFile = hbs.read(DATA_PREFIX + key);
+            return blobStoreFile.exists();
 
 Review comment:
   So basically we're saying that a KeyNotFoundException indicates the blobDoes not exist from line 350 and any other non-AuthorizationException would return true?
   
   
   
   

----------------------------------------------------------------
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