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

docs: update comment about r2 requiring locks #2261

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

cmackenzie1
Copy link
Contributor

Description

Cloudflare R2 doesn't require the use of an external lock when using conditional operation headers like so:

let s3 = AmazonS3Builder::from_env()
    .with_url(url)
    .with_region("auto")
    .with_access_key_id(&config.s3_access_key_id)
    .with_secret_access_key(&config.s3_secret_access_key)
    .with_endpoint(&config.s3_endpoint)
    // Allows using S3-API without an external locking provider since Cloudflare R2
    // provides atomic Put and Copy.
    .with_config(
        AmazonS3ConfigKey::CopyIfNotExists,
        "header: cf-copy-destination-if-none-match: *".to_string(),
    )
    .build()

Related Issue(s)

Documentation

Cloudflare R2 doesn't require the use of an external lock when using conditional operation headers like so:

```rust
let s3 = AmazonS3Builder::from_env()
    .with_url(url)
    .with_region("auto")
    .with_access_key_id(&config.s3_access_key_id)
    .with_secret_access_key(&config.s3_secret_access_key)
    .with_endpoint(&config.s3_endpoint)
    // Allows using S3-API without an external locking provider since Cloudflare R2
    // provides atomic Put and Copy.
    .with_config(
        AmazonS3ConfigKey::CopyIfNotExists,
        "header: cf-copy-destination-if-none-match: *".to_string(),
    )
    .build()
```

- https://developers.cloudflare.com/r2/api/s3/extensions/#putobject-1
- https://github.com/apache/arrow-rs/blob/c6ba0f764a9142b74c9070db269de04d2701d112/object_store/src/aws/precondition.rs#L29-L42
@rtyler rtyler enabled auto-merge (rebase) March 7, 2024 05:40
@rtyler rtyler merged commit 1ddb616 into delta-io:main Mar 7, 2024
20 checks passed
@cmackenzie1 cmackenzie1 deleted the cole/update-r2-docs branch March 7, 2024 16:43
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.

2 participants