Repository navigation
feat(bucket): add server-side copy and check rename and copy before the request - #90
Merged
Merged
Conversation
…he request
The Data Proxy copies an object within the object store through
PUT /v1/buckets/{bucket}/{object}/copy?name=<target>. BucketsClient gets a
copyObject method for it and the namespace an ebrains.bucket.copyObject
function, next to renameObject.
The copy endpoint takes the name as one percent-encoded path segment. A
folder name ends with "/", and sent as path segments the request path
holds "folder//copy"; the proxy collapses the double slash before it reads
the name, copies a single object that does not exist and reports the
failure only by mail. The other endpoints keep the path segments, since
their signed temporary URLs need real separators.
Rename and copy answer 201 and complete in the background, and a failed
operation is reported only by mail. Both functions therefore check that
the source exists and that the target is free before the request, with an
Overwrite option to replace the target, and both pass
send_success_email=false unless SendSuccessEmail is true. Before this the
rename required a 200 and so threw on every rename the proxy accepted, and
each rename mailed the account. The options and defaults follow
DataproxyFile.rename and copy_to in ebrains-storage.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Test Results767 tests 756 ✅ 50s ⏱️ Results for commit 6d5f0a5. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #90 +/- ##
==========================================
+ Coverage 89.04% 89.28% +0.24%
==========================================
Files 109 112 +3
Lines 3002 3079 +77
==========================================
+ Hits 2673 2749 +76
- Misses 329 330 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…oss folder and object names The proxy accepts such a request and reports the outcome only by mail, and with Overwrite=true the target check no longer stood in the way. The names are now compared before anything is listed: equal names, a folder name paired with an object name, and a target within the source folder are refused. The listing helper gets tests of its own, the functions tests of a folder request that goes through, and the client tests of the target's query encoding and of the warning state after a copy. The class header names the copy endpoint as the one that takes the name as a single segment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The mock answers requests in the order the responses were queued, and the rename and copy functions list the source, then the target, before they send the request. The tests assert on requests by index, so each queued response now carries a trailing comment naming the step it answers, and the class help and the moveFunction parameter state the pairing and the check order once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.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.
The Data Proxy copies an object within the object store through
PUT /v1/buckets/{bucket}/{object}/copy?name=<target>.BucketsClientgets acopyObjectmethod for it and the namespace anebrains.bucket.copyObjectfunction, next torenameObject. A folder is copied with everything in it when both names end with/.The copy endpoint takes the name as one percent-encoded path segment. A folder name ends with
/, and sent as path segments the request path holdsfolder//copy; the proxy collapses the double slash before it reads the name, copies a single object that does not exist, and reports the failure only by mail, as described in HumanBrainProject/ebrains-storage#60. The other endpoints keep the path segments, since the signed temporary URLs they return need real separators.Rename and copy answer
201 "Your copy is processing"and complete in the background, and a failed operation is reported only by mail. Both functions therefore check that the source exists (EBRAINS:Bucket:ObjectNotFound) and that the target is free (EBRAINS:Bucket:TargetExists) before the request, withOverwrite=trueto replace the target. Both passsend_success_email=falseunlessSendSuccessEmail=true. Before this change the rename required a 200, so it threw on every rename the proxy accepted, and each rename mailed the account. The options and defaults followDataproxyFile.rename()andcopy_to()in ebrains-storage (HumanBrainProject/ebrains-storage#55, HumanBrainProject/ebrains-storage#63).The live tests gain a folder copy, a single-object copy and a rename, each polling the listing until the proxy has completed the operation.
🤖 Generated with Claude Code