HDDS-16039. Introduce S3StorageClass mapping to OzoneStoragePolicy. - #11229
Open
devmadhuu wants to merge 1 commit into
Open
HDDS-16039. Introduce S3StorageClass mapping to OzoneStoragePolicy.#11229devmadhuu wants to merge 1 commit into
devmadhuu wants to merge 1 commit into
Conversation
devmadhuu
marked this pull request as ready for review
September 11, 2026 11:09
F64116045
reviewed
Sep 12, 2026
| throw new IllegalArgumentException("Not supported s3StorageClass: null"); | ||
| } | ||
| try { | ||
| return S3StorageClass.valueOf(s3StorageClass.toUpperCase()); |
Contributor
There was a problem hiding this comment.
Thanks @devmadhuu.
I wonder would Locale.ROOT be safer here? toUpperCase() uses the JVM's default locale.
For example, under Turkish locale, "standard_ia" becomes "STANDARD_İA", which does not match the enum constant.
The Java documentation recommends Locale.ROOT for locale-independent strings such as protocol keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR is to introduce
S3StorageClass— a small enum that maps AWS S3 storage class strings (STANDARD,STANDARD_IA,GLACIER) to Ozone storage policies (HOT,WARM,COLD).Two helper methods on the enum:
fromS3StorageClass(String)— parse the value of an incomingx-amz-storage-classheader.fromStoragePolicy(StoragePolicy)— go the other way, for building responses.This PR is infrastructure only — no caller uses
S3StorageClassyet. The S3 write path (PutObject) and read path (GetObject) will start calling it in follow-up PRs.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16039
How was this patch tested?
New unit test
TestS3StorageClasscovers:nulland unknown values.StoragePolicy→ enum for all three, plus rejectsnull.