You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2024/11/05 08:25:12 UTC
[I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Xuanwo opened a new issue, #5286:
URL: https://github.com/apache/opendal/issues/5286
### Discussed in https://github.com/apache/opendal/discussions/5223
<div type='discussions-op-text'>
<sup>Originally posted by **Xuanwo** October 22, 2024</sup>
OpenDAL now supports the use of `"*"` in `if_none_match` to perform conditional write operations:
```rust
let _ = op.write_with(path, bs).if_none_match("*").await?;
```
However, it's somewhat difficult to grasp at first glance. Do you think it's a good idea to include `if_not_exists`?
So we can write code like:
```rust
let _ = op.write_with(path, bs).if_not_exists(true).await?;
```
---
After this change, we will still allow users to use `if_none_match("*")`, but we will no longer document it, making it a service implementation detail.</div>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #5286:
URL: https://github.com/apache/opendal/issues/5286#issuecomment-2459479614
> Can I take this?
Of course. Thank you in advance, have fun!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Posted by "swanandx (via GitHub)" <gi...@apache.org>.
swanandx commented on issue #5286:
URL: https://github.com/apache/opendal/issues/5286#issuecomment-2466654931
why are we passing a boolean to `if_not_exists` ? what will be behavior when we pass `false`?
```rust
let _ = op.write_with(path, bs).if_not_exists(true).await?;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #5286:
URL: https://github.com/apache/opendal/issues/5286#issuecomment-2467815688
> why are we passing a boolean to `if_not_exists` ?
Passing a boolean into `if_not_exists` make it easier to write code like:
```rust
async fn users_logic(require_not_exists: bool) {
op.write_with(path, content).if_not_exists(require_not_exists).await;
}
```
Instead of:
```rust
async fn users_logic(require_not_exists: bool) {
if require_not_exists {
op.write_with(path, content).if_not_exists().await;
} else {
op.write_with(path, content).await;
}
}
```
> what will be behavior when we pass `false`?
This is a condition. While it's set to false, no such condition will be applied to this write operation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Posted by "kemingy (via GitHub)" <gi...@apache.org>.
kemingy commented on issue #5286:
URL: https://github.com/apache/opendal/issues/5286#issuecomment-2459476103
Can I take this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add `if_not_exists` in `OpWrite` to make behavior more clear [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #5286: Add `if_not_exists` in `OpWrite` to make behavior more clear
URL: https://github.com/apache/opendal/issues/5286
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org