greenwich commented on code in PR #12232:
URL: https://github.com/apache/ozone/pull/12232#discussion_r4793564820


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/S3StorageClassResolver.java:
##########
@@ -76,6 +92,73 @@ public S3StorageClassResolver(ConfigurationSource conf) {
         getConfiguredStoragePolicy(conf, 
OZONE_S3G_STORAGE_CLASS_STANDARD_IA_STORAGE_POLICY));
     standardUsesClientDefault = 
conf.getBoolean(OZONE_S3G_STANDARD_STORAGE_CLASS_USE_CLIENT_DEFAULT_KEY,
         OZONE_S3G_STANDARD_STORAGE_CLASS_USE_CLIENT_DEFAULT_DEFAULT);
+    clientOverride = getConfiguredClientOverride(conf);
+  }
+
+  /**
+   * Resolves a write request's storage class header into replication and 
storage policy, applying the
+   * {@link ClientOverride} mode.
+   *
+   * <p>Without the header, replication comes from client replication, then 
bucket replication, or null so the server
+   * applies its default, and no storage policy is sent, so OM applies the 
bucket policy or the cluster default.
+   * With the header:
+   * <ul>
+   *   <li>{@link ClientOverride#ALLOW}: replication from {@link 
#resolveReplicationConfig} and the storage policy
+   *   from {@link #toSpec}.</li>
+   *   <li>{@link ClientOverride#IGNORE}: the header is validated, then the 
result is the same as without it.</li>
+   *   <li>{@link ClientOverride#REJECT}: as {@code ALLOW}, but the write is 
rejected if its replication differs from
+   *   the replication without the header, when that is known, or if it has a 
storage policy other than the bucket's,
+   *   including on a bucket without one.</li>
+   * </ul>
+   *
+   * @param s3StorageClass the x-amz-storage-class header value, or null
+   * @param storageConfigHeader the storage-config header value, or null
+   * @param clientReplicationConfig replication from the gateway's 
ozone.replication settings, or null
+   * @param bucketReplicationConfig the bucket's default replication, or null
+   * @param bucketStoragePolicy the bucket's storage policy, or null
+   * @throws OS3Exception with {@code INVALID_STORAGE_CLASS} if the class is 
unknown, its EC layout header is invalid,
+   *     or, in {@code REJECT} mode, it conflicts with the bucket
+   */
+  @Nonnull
+  public ResolvedStorageClass resolve(@Nullable String s3StorageClass, 
@Nullable String storageConfigHeader,

Review Comment:
   Just a thought: in the `reject` mode should we reject any class whose 
replication cannot be compared (maybe except `STANDARD`)?



-- 
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]

Reply via email to