bharatviswa504 commented on a change in pull request #2431:
URL: https://github.com/apache/ozone/pull/2431#discussion_r672998052
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
##########
@@ -529,6 +529,21 @@ public OzoneKeyDetails getKey(String key) throws
IOException {
return proxy.getKeyDetails(volumeName, name, key);
}
+ /**
+ *
+ * Return basic information about the key.
+ *
+ * If Key exists, return basic information about the key.
+ * If Key does not exist, throws an exception with error code KEY_NOT_FOUND
+ *
+ * @param key
+ * @return OzoneKey which gives basic information about the key.
+ * @throws IOException
+ */
+ public OzoneKey headObject(String key) throws IOException {
Review comment:
There is OzoneKey which does the same. To be clear, we can leave it as
headObject. (As main use of this API is for S3 headObject)
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
##########
@@ -1450,4 +1450,27 @@ public OzoneManagerProtocol getOzoneManagerClient() {
public Cache<URI, KeyProvider> getKeyProviderCache() {
return keyProviderCache;
}
+
+ @Override
+ public OzoneKey headObject(String volumeName, String bucketName,
+ String keyName) throws IOException {
+ Preconditions.checkNotNull(volumeName);
+ Preconditions.checkNotNull(bucketName);
+ Preconditions.checkNotNull(keyName);
+ OmKeyArgs keyArgs = new OmKeyArgs.Builder()
+ .setVolumeName(volumeName)
+ .setBucketName(bucketName)
+ .setKeyName(keyName)
+ .setRefreshPipeline(false)
+ .setSortDatanodesInPipeline(false)
Review comment:
Done
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java
##########
@@ -736,4 +736,20 @@ OzoneOutputStream createFile(String volumeName, String
bucketName,
*/
void setBucketQuota(String volumeName, String bucketName,
long quotaInNamespace, long quotaInBytes) throws IOException;
+
+ /**
+ *
+ * Return basic information about the key.
+ *
+ * If Key exists, return basic information about the key.
+ * If Key does not exist, throws an exception with error code KEY_NOT_FOUND
+ *
+ * @param volumeName
+ * @param bucketName
+ * @param keyName
+ * @return OzoneKey which gives basic information about the key.
+ * @throws IOException
+ */
Review comment:
I believe ObjectKey is OzoneKey. Rest updated as suggested
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java
##########
@@ -389,9 +389,15 @@ private LookupKeyResponse lookupKey(LookupKeyRequest
request,
.setRefreshPipeline(true)
.setSortDatanodesInPipeline(keyArgs.getSortDatanodes())
.setLatestVersionLocation(keyArgs.getLatestVersionLocation())
+ .setHeadOp(keyArgs.getHeadOp())
.build();
OmKeyInfo keyInfo = impl.lookupKey(omKeyArgs);
- resp.setKeyInfo(keyInfo.getProtobuf(false, clientVersion));
+
+ if (!omKeyArgs.isHeadOp()) {
+ resp.setKeyInfo(keyInfo.getProtobuf(false, clientVersion));
+ } else {
+ resp.setKeyInfo(keyInfo.getProtobuf(true, clientVersion));
+ }
Review comment:
Done
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
##########
@@ -1450,4 +1450,27 @@ public OzoneManagerProtocol getOzoneManagerClient() {
public Cache<URI, KeyProvider> getKeyProviderCache() {
return keyProviderCache;
}
+
+ @Override
+ public OzoneKey headObject(String volumeName, String bucketName,
+ String keyName) throws IOException {
+ Preconditions.checkNotNull(volumeName);
+ Preconditions.checkNotNull(bucketName);
+ Preconditions.checkNotNull(keyName);
+ OmKeyArgs keyArgs = new OmKeyArgs.Builder()
+ .setVolumeName(volumeName)
+ .setBucketName(bucketName)
+ .setKeyName(keyName)
+ .setRefreshPipeline(false)
+ .setSortDatanodesInPipeline(false)
Review comment:
Done
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
##########
@@ -529,6 +529,21 @@ public OzoneKeyDetails getKey(String key) throws
IOException {
return proxy.getKeyDetails(volumeName, name, key);
}
+ /**
+ *
+ * Return basic information about the key.
+ *
+ * If Key exists, return basic information about the key.
+ * If Key does not exist, throws an exception with error code KEY_NOT_FOUND
+ *
+ * @param key
+ * @return OzoneKey which gives basic information about the key.
+ * @throws IOException
+ */
+ public OzoneKey headObject(String key) throws IOException {
Review comment:
There is getKey which does the same. To be clear, we can leave it as
headObject. (As main use of this API is for S3 headObject)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]