Skip to content

HDDS-16039. Introduce S3StorageClass mapping to OzoneStoragePolicy. - #11229

Open
devmadhuu wants to merge 1 commit into
apache:HDDS-11233from
devmadhuu:HDDS-16039
Open

HDDS-16039. Introduce S3StorageClass mapping to OzoneStoragePolicy.#11229
devmadhuu wants to merge 1 commit into
apache:HDDS-11233from
devmadhuu:HDDS-16039

Conversation

@devmadhuu

Copy link
Copy Markdown
Contributor

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 incoming x-amz-storage-class header.
  • fromStoragePolicy(StoragePolicy) — go the other way, for building responses.

This PR is infrastructure only — no caller uses S3StorageClass yet. 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 TestS3StorageClass covers:

  • S3 string → enum for all three values, plus rejects null and unknown values.
  • Ozone StoragePolicy → enum for all three, plus rejects null.
  • Round-trip consistency across all enum values.

@devmadhuu
devmadhuu marked this pull request as ready for review September 11, 2026 11:09
throw new IllegalArgumentException("Not supported s3StorageClass: null");
}
try {
return S3StorageClass.valueOf(s3StorageClass.toUpperCase());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants