rakeshadr commented on code in PR #11626:
URL: https://github.com/apache/ozone/pull/11626#discussion_r4583602279
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java:
##########
@@ -852,6 +852,24 @@ OmMultipartInfo initiateMultipartUpload(String volumeName,
String
Map<String, String> metadata, Map<String, String> tags)
throws IOException;
+ /**
+ * Initiate Multipart upload.
+ * @param volumeName Name of the Volume
+ * @param bucketName Name of the Bucket
+ * @param keyName Name of the Key
+ * @param replicationConfig Replication config
+ * @param metadata Custom key value metadata
+ * @param tags Tags used for S3 object tags
+ * @param storagePolicy StoragePolicy of the key, or null to inherit the
bucket's
+ * @return {@link OmMultipartInfo}
+ * @throws IOException
+ */
+ OmMultipartInfo initiateMultipartUpload(String volumeName, String
+ bucketName, String keyName, ReplicationConfig replicationConfig,
+ Map<String, String> metadata, Map<String, String> tags,
+ @Nullable StoragePolicy storagePolicy)
Review Comment:
I think we can create MPU options with builder pattern to avoid overloaded
APIs for every new parameter addition. Probably in this PR or you can create
separate task, if required.
Something like below,
The new public API `#initiateMultipartUpload(keyName, config, metadata,
tags, keyStoragePolicy)`
```
public final class MultipartUploadOptions {
private final ReplicationConfig replicationConfig;
private final Map<String, String> metadata;
private final Map<String, String> tags;
private final StoragePolicy storagePolicy;
private MultipartUploadOptions(Builder b) {
this.replicationConfig = b.replicationConfig;
this.metadata = b.metadata != null
? Collections.unmodifiableMap(b.metadata) : Collections.emptyMap();
this.tags = b.tags != null
? Collections.unmodifiableMap(b.tags) : Collections.emptyMap();
this.storagePolicy = b.storagePolicy;
}
public ReplicationConfig getReplicationConfig() { return
replicationConfig; }
public Map<String, String> getMetadata() { return metadata; }
public Map<String, String> getTags() { return tags; }
@Nullable
public StoragePolicy getStoragePolicy() { return storagePolicy; }
public static class Builder {
private ReplicationConfig replicationConfig;
private Map<String, String> metadata;
private Map<String, String> tags;
private StoragePolicy storagePolicy;
public Builder setReplicationConfig(ReplicationConfig config) {
this.replicationConfig = config;
return this;
}
public Builder setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
return this;
}
public Builder addTag(String key, String value) {
if (this.tags == null) { this.tags = new LinkedHashMap<>(); }
this.tags.put(key, value);
return this;
}
public Builder setTags(Map<String, String> tags) {
this.tags = tags;
return this;
}
public Builder setStoragePolicy(StoragePolicy policy) {
this.storagePolicy = policy;
return this;
}
public MultipartUploadOptions build() {
return new MultipartUploadOptions(this);
}
}
```
--
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]