feat(services/s3): support source-side conditional copy#7614
Open
YuangGao wants to merge 3 commits into
Open
Conversation
dentiny
reviewed
May 25, 2026
| /// destination object's ETag matches the given value. | ||
| pub if_match: Option<String>, | ||
|
|
||
| /// Sets the condition that copy operation will succeed only if the source |
Member
There was a problem hiding this comment.
S3 copy supports multiple conditions, do we want to support them all, so we could declare we support S3 condition copy with source check?
x-amz-copy-source: CopySource
x-amz-copy-source-if-match: CopySourceIfMatch
x-amz-copy-source-if-modified-since: CopySourceIfModifiedSince
x-amz-copy-source-if-none-match: CopySourceIfNoneMatch
x-amz-copy-source-if-unmodified-since: CopySourceIfUnmodifiedSinceref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html#API_CopyObject_RequestSyntax
Contributor
Author
There was a problem hiding this comment.
got it, makes sense, I will extend this PR to support all of them
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 #7090.
Rationale for this change
Destination-side
If-Matchprotects the destination from being overwritten. Source-sidex-amz-copy-source-if-*is the other half: it lets callers gate a copy on the source object's state, closing the race betweenstat(src)andcopy(src, dst).S3 CopyObject accepts four source-side conditions, mirroring the standard HTTP conditional set already exposed on
OpStat/OpRead:x-amz-copy-source-if-match(ETag)x-amz-copy-source-if-none-match(ETag)x-amz-copy-source-if-modified-since(HTTP-date)x-amz-copy-source-if-unmodified-since(HTTP-date)What changes are included in this PR?
Core:
Capability::copy_with_source_if_{match,none_match,modified_since,unmodified_since}.OpCopy/CopyOptions, builders onFutureCopy. ETag fields useOption<String>, time fields useOption<Timestamp>(same type already used byOpStat/OpRead).correctness_check.rsand thecapability-checklayer.S3:
trueon the S3 capability.s3_copy_objectands3_complete_multipart_copyinject the fourx-amz-copy-source-if-*headers when set.Tests:
test_copy_with_source_if_match_match/_mismatchand the symmetrictest_copy_with_source_if_none_match_*pair incore/tests/behavior/async_copy.rs. Time-based conditions share the same plumbing and are covered by the capability + correctness checks.Are there any user-facing changes?
Yes, additive only —
op.copy_with(from, to).source_if_match(etag)(and the three siblings) are new opt-in builders. Existingop.copy(from, to)is unchanged.AI Usage Statement
AI-assisted implementation.