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

Allow setting metadata atomically on initial upload #84

Open
broccolihighkicks opened this issue Aug 23, 2021 · 1 comment · May be fixed by #105
Open

Allow setting metadata atomically on initial upload #84

broccolihighkicks opened this issue Aug 23, 2021 · 1 comment · May be fixed by #105

Comments

@broccolihighkicks
Copy link

broccolihighkicks commented Aug 23, 2021

The "create and then update" workflow does not work well in some cases.

E.g. I am setting obj.cache_control = Some("no-store".to_string()); obj.update().await to prevent GCS's default forced cache of one hour (which cannot be circumvented from the browser).

Two issues:

    1. Sometimes that update request succeeds but the metadata of the object is not updated for some reason (I think this may be an error Google's end when writing the same object many times).
    1. If I am creating/updating the object, it may have been replaced by the time the update runs.

Is it possible to add metadata to Object::create so that this happens in one single request instead of two?

This would solve the two issues above by making object-creation-with-metadata a single atomic step.

@broccolihighkicks broccolihighkicks changed the title Allow setting metadata on initial upload Allow setting metadata atomically on initial upload Aug 24, 2021
@ThouCheese
Copy link
Owner

Hi @broccolihighkicks, sorry for the late response. This is something that can definitely be implemented. Currently, cloud_storage uses the 'Single request' upload scheme. This would require us the switch to multipart form uploads (described just below). Since reqwest supports multipart form requests out of the box, an implementation of this should be straightforward. Would you like to contribute on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants