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

BREAKING: Implement more of the R2 API #627

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fisherdarling
Copy link
Contributor

@fisherdarling fisherdarling commented Aug 29, 2024

This PR adds two missing parts of the R2 API:

  • An (accidentally) undocmented startAfter option in R2's list objects call
  • R2 PutObject Conditional Support.
    • This is a BREAKING change. When a provided conditional to an R2 PutObject fails, the resultant Object could be null, or None in Rust. The returned object from a PUT is not a Option<Object>.

This API is successfully being used to implement a compare-and-swap (CAS) primitive for an internal project. We ended up not needing the list changes, but I thought it'd be useful nonetheless.

Tasks:

  • clean up workers-rs tests

This commit adds missing `Conditional` operations to the
R2 `PutOptionsBuilder`. This is a breaking change, because after
this change, an R2 put may return `None`.
This adds the `startAfter` list option which is implemented,
however undocumented. This is equivalent to the `marker` field
in the s3 api.
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 this pull request may close these issues.

1 participant