feat: add GetRawSrcKey method to Client interface and implementations #21
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.
变更背景
在使用
Copy()
API 时,通过 CopyWithRawSrcKey()
option,可以让业务在跨桶复制场景下,直接指定包含 bucket 信息的原始 key。由于每个 client 实例与单独的 bucket 绑定,未使用 CopyWithRawSrcKey()
时,无法在同一个 client 内获取多个 bucket 的 key。虽然业务层可以指定带有 bucket 的 rawKey,但原有 client 实现没有暴露获取带前缀 key 的方法,导致无法获取完整的 raw key 路径。
主要变更
• 新增
GetRawSrcKey(ctx, key)
到 Client
接口。• 在 S3 和 OSS 实现中补充该方法,返回
/<bucket>/<prefixed-key>
格式的完整路径。影响评估
• 纯新增,向后兼容,不影响现有功能。
• 方便业务层获取 bucket + key 的完整路径,便于应对复杂的跨桶复制场景。