Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Objects rewrite completely/correctly #81

Open
ralpha opened this issue Aug 6, 2021 · 1 comment
Open

Support Objects rewrite completely/correctly #81

ralpha opened this issue Aug 6, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ralpha
Copy link

ralpha commented Aug 6, 2021

Currently Objects rewrite is not fully supported.
The is because the requester should check if the done flag is set to true, as described here:

This method copies data using multiple requests so large objects can be copied with a normal length timeout per request rather than one very long timeout for a single request. In such cases, you must keep calling the endpoint until the rewrite response done flag is true. If the flag is false, include the rewriteToken that's returned in the response in the subsequent request. [...]
--- https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite

In order to properly support this, the request should be repeated as described by the documentation.
Right now the code does not check if the flag is set to done. And just returns the Object.
Although it does look like (reading for documentation) the resource item will only be present if the rewrite is completed in that 1 transaction. So the deserialization will fail because the resource in RewriteResponse is not marked as Option<Object>.

So currently the function call will fail on the deserialization if the object failed to transfer. Which is less then ideal. It should do multiple transactions or fail by checking if the done flag was set to false.

@ThouCheese ThouCheese added the bug Something isn't working label Sep 25, 2021
@ThouCheese
Copy link
Owner

Yeah that is indeed a mistake. A pull request that fixes this is definitely welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants