mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 13:45:52 +03:00
[GH-ISSUE #299] Support for preconditions #2210
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#2210
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @charleskorn on GitHub (Aug 5, 2020).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/299
Does this server support preconditions? (https://cloud.google.com/storage/docs/generations-preconditions#_Preconditions)
I've tried adding the following to my upload code:
But the server always overwrites the object, even if it exists, instead of returning a HTTP 412 response. I can see that the upload URL contains
ifGenerationMatch=0in the server's logs.@someone1 commented on GitHub (Aug 27, 2020):
Yikes, the
v.1.20.0release was a breaking one - all my tests started to fail. Glad to see some progress being made on this but maybe we can keep the original behavior of allowing the request through vs a 501 response?@someone1 commented on GitHub (Aug 27, 2020):
A quick follow-up: was the implementation in #300 the correct placement for such a feature? The generation feature seems backend dependent (e.g. the memory backend supports file generations whereas the file backend does not). Would it have made more sense to expand the
Storageinterface with aCreateObjectIfGenerationMatchor something to be used instead ofCreateObjectas needed, or expandCreateObjectto take in a precondition struct to process? This way, each backend can properly implement the features it supports (with locking) vs the current approach.Thoughts?
cc @fsouza
@fsouza commented on GitHub (Aug 27, 2020):
Ugh, sorry about that :(( We should expand our shared tests to cover more behaviors. I'll make sure to keep an eye for that in the future (most of my use cases are using the memory backend :/).
I feel like extending the backend's CreateObject method is the best approach here, the same way we extended CreateBucket to pass versioningEnabled.
@bmansoob commented on GitHub (Apr 27, 2022):
👋 @fsouza
I see generation support has been added in https://github.com/fsouza/fake-gcs-server/pull/735 at the same layer as in #300.
I added support for this in the memory backend here. I wanted to confirm with you first, before opening a pull request, that do you still plan on tackling this in a backend specific way.