Hi, the Cloudflare R2 bindings as of compatibility_date = "2022-05-31"
don’t seem to support conditional PUTs (say using If-Match
). Is that by design?
If yes, what’s the recommended way to avoid conflicting writes to the same R2 object?
If no, how do I go about doing it?
I’m not aware of the .put()
Workers binding for R2 ever supporting conditionals - it’s not documented in Workers API reference · Cloudflare R2 docs
Are you saying this used to be supported in the past?
I’'m not saying that. I’m asking if this is
Supported in the storage backend but not exposed in the API binding, i.e. an API oversight, or
Not expected to be supported, as a conscious design choice.
If it’s the latter, what is the recommended way to prevent race conditions in concurrent read-writes to an R2 object?
vlovich
September 21, 2022, 7:30pm
4
It’s in there now although the docs are a bit stale at the moment. Basically, if the S3 interface supports something but bindings don’t, it’s highly likely we’ll get around to it eventually.
Changes last week:
R2 put bindings options can now have an onlyIf field similar to get that does a conditional upload.
Allow deleting multiple keys at once in R2 bindings.
Added support for SHA-1, SHA-256, SHA-384, SHA-512 checksums in R2 put options.
User-specified object checksums will now be available in the R2 get/head bindings response. MD5 is included by default for non-multipart uploaded objects.
Updated V8 to 10.6.
2 Likes
system
Closed
September 25, 2022, 1:18pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.