sarvekshayr commented on code in PR #12213:
URL: https://github.com/apache/ozone/pull/12213#discussion_r4766355158
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java:
##########
@@ -69,10 +73,25 @@ public class PutKeyHandler extends KeyHandler {
description = "Store key only if it already exists and its generation
matches the value provided")
private Long expectedGeneration;
+ @Option(names = {"--storage-policy", "-s"},
+ description = "Key StoragePolicy. Allowed values: HOT, WARM, COLD, null.
"
+ + "If not specified, the key inherits the StoragePolicy of the
bucket.")
+ private String storagePolicyStr;
+
+ private static final String NULL_STORAGE_POLICY = "null";
+
@Override
protected void execute(OzoneClient client, OzoneAddress address)
throws IOException {
+ StoragePolicy storagePolicy = parseStoragePolicy(storagePolicyStr);
+ // TODO(HDDS-16679): Streaming writes support StoragePolicy.
+ Preconditions.checkArgument(!(stream && storagePolicy != null),
+ "--storage-policy is not supported together with --stream");
+ // TODO(HDDS-17963): rewriteKey supports StoragePolicy.
+ Preconditions.checkArgument(!(expectedGeneration != null && storagePolicy
!= null),
+ "--storage-policy is not supported together with
--expected-generation");
Review Comment:
If there is a requirement, please consider supporting it. Otherwise, we can
keep them explicitly mutually exclusive and enforce that at parse time with a
picocli `@ArgGroup(exclusive = true, multiplicity = "0..1")` containing just
these two options.
--
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]