-
Notifications
You must be signed in to change notification settings - Fork 621
HDDS-6440. Handle custom metadata (x-amz-meta) during put-object through S3 API. #3728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 25 commits
202fc8f
67a99da
03be08e
87280e6
f63ca57
996afde
44180c1
c1c0454
af9ee6c
1e03a4f
1b12aad
1bbfac7
43efa39
73257bd
8d68c21
da17c8a
9db93fa
50b7946
32a9ad5
256951e
83626aa
ff1603b
b420b0d
e1db11e
7febc6a
84e5abf
8acd6c6
35c4773
0852059
07f84a5
02fb612
fe93b51
ff9ba65
7bd79b6
aafd1c6
4f4357b
e1f911a
8ea42b1
0025afe
13bd6ca
867fa27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ | |
| import org.apache.hadoop.hdds.client.ReplicationType; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.Map; | ||
| import java.util.HashMap; | ||
|
|
||
| /** | ||
| * A class that encapsulates OzoneKey. | ||
|
|
@@ -57,6 +59,8 @@ public class OzoneKey { | |
|
|
||
| private ReplicationConfig replicationConfig; | ||
|
|
||
| private Map<String, String> metadata = new HashMap<>(); | ||
|
|
||
| /** | ||
| * Constructs OzoneKey from OmKeyInfo. | ||
| * | ||
|
|
@@ -67,14 +71,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, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting the instance
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @neils-dev can you please explain, I am not sure I understood your comment.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure @kerneltime, the intialization for the creationTime, modification can retain its previous initialization prior to the change: now:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constructor called internally does the same, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! |
||
| ReplicationFactor.valueOf(replicationFactor))); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -94,6 +93,16 @@ public OzoneKey(String volumeName, String bucketName, | |
| this.replicationConfig = replicationConfig; | ||
| } | ||
|
|
||
| @SuppressWarnings("parameternumber") | ||
| public OzoneKey(String volumeName, String bucketName, | ||
| String keyName, long size, long creationTime, | ||
| long modificationTime, ReplicationConfig replicationConfig, | ||
| Map<String, String> metadata) { | ||
| this(volumeName, bucketName, keyName, size, creationTime, | ||
| modificationTime, replicationConfig); | ||
| this.metadata.putAll(metadata); | ||
| } | ||
|
|
||
| /** | ||
| * Returns Volume Name associated with the Key. | ||
| * | ||
|
|
@@ -154,6 +163,10 @@ public Instant getModificationTime() { | |
| * @return replicationType | ||
| */ | ||
|
|
||
| public Map<String, String> getMetadata() { | ||
| return metadata; | ||
| } | ||
|
|
||
| @Deprecated | ||
| @JsonIgnore | ||
| public ReplicationType getReplicationType() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.