You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/22 23:25:54 UTC

[GitHub] [ozone] neils-dev commented on a diff in pull request #3728: HDDS-6440. Handle custom metadata (x-amz-meta) during put-object through S3 API.

neils-dev commented on code in PR #3728:
URL: https://github.com/apache/ozone/pull/3728#discussion_r978156777


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneKey.java:
##########
@@ -67,14 +70,9 @@ public OzoneKey(String volumeName, String bucketName,
                   String keyName, long size, long creationTime,
                   long modificationTime, ReplicationType type,
                   int replicationFactor) {
-    this.volumeName = volumeName;
-    this.bucketName = bucketName;
-    this.name = keyName;
-    this.dataSize = size;
-    this.creationTime = Instant.ofEpochMilli(creationTime);
-    this.modificationTime = Instant.ofEpochMilli(modificationTime);
-    this.replicationConfig = ReplicationConfig.fromTypeAndFactor(type,
-            ReplicationFactor.valueOf(replicationFactor));
+    this(volumeName, bucketName, keyName, size, creationTime, modificationTime,
+            ReplicationConfig.fromTypeAndFactor(type,

Review Comment:
   Setting the instance `this(creationTime, modificationTime ) `can remain initialized with `Instant.ofEpochMilli(creationTime)` and `Instant.ofEpochMilli(modificationTime) `respectively.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneKeyDetails.java:
##########
@@ -58,8 +56,8 @@ public OzoneKeyDetails(String volumeName, String bucketName, String keyName,
     super(volumeName, bucketName, keyName, size, creationTime,
         modificationTime, type, replicationFactor);
     this.ozoneKeyLocations = ozoneKeyLocations;
-    this.metadata = metadata;
     this.feInfo = feInfo;
+    this.getMetadata().putAll(metadata);

Review Comment:
   Thanks @DaveTeng0  for this important patch to handle user defined metadata supplied through the s3 interface.
   Setting the metadata member of the `OzoneKey` class that` OzoneKeyDetails` is extended from should be done by a setter method or a protected member.  Perhaps a setter method can be provided by the `OzoneKey` class to set the metadata member or the `OzoneKey` _private_ metadata member can be made accessible by changing to `protected`.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org