feat(services/oss): support content_encoding in write operations#7658
Open
ITpandaffm wants to merge 1 commit into
Open
feat(services/oss): support content_encoding in write operations#7658ITpandaffm wants to merge 1 commit into
ITpandaffm wants to merge 1 commit into
Conversation
Signed-off-by: 旻序 <fuming.ffm@alibaba-inc.com>
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.
Which issue does this PR close?
Closes #7656.
Rationale for this change
The OSS backend currently does not honor
OpWrite::content_encoding(), eventhough the write option already exists and other object storage backends such as
S3 and GCS support it.
Users who upload gzip/br/deflate objects to Aliyun OSS through OpenDAL cannot
preserve the
Content-Encodingmetadata. This breaks CDN/browser transparentdecompression for compressed static objects.
What changes are included in this PR?
core/services/oss/src/backend.rswrite_with_content_encoding: truein the OSS capability table.core/services/oss/src/core.rshttp::header::CONTENT_ENCODING.args.content_encoding()in shared write metadata headers, coveringPutObjectandAppendObject.content_encodingparameter tooss_initiate_uploadand set theheader on
InitiateMultipartUpload.core/services/oss/src/writer.rsself.op.content_encoding()intooss_initiate_uploadfor multipartwrites.
Are there any user-facing changes?
Yes. OSS now advertises
write_with_content_encoding, andop.write_with(...).content_encoding(...)will preserveContent-Encodingmetadata on written objects.
Existing users who do not set
content_encodingare unaffected.Tests
cargo fmt --checkcargo check -p opendal --features services-oss --no-default-featurescargo clippy -p opendal --features services-oss --no-default-features -- -D warningscargo test -p opendal-service-oss --no-default-features