-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Default transactions to abort on drop #32
Comments
After some more investigation, I learned that this would be a nontrivial feature. So I decided to go ahead and implement it, and this resulted in the indexed-db crate, that has a misuse-resistant API with transactions that always abort upon errors and never commit early. Do you want to keep this issue open to track this feature inside indexed_db_futures, or should we close it? :) |
Hey, thanks for bringing this up and sorry I'd abandoned this crate for so long. Let's keep this issue open please - I'll want to do some refactors around the crate and it'll be helpful to have this issue for reference |
Closes #32 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #32 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #32 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
Closes #25, #32, #39 BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
This issue has been included in v0.6.0 🎉 - Your friendly neighbourhood 🤖 semantic release bot |
Hey!
Here's an idea for indexed-db-futures v0.5: what if transactions aborted on drop, instead of committing on drop?
This'd make them farther away from the indexed-db standard, for sure, but the indexed-db standard is based on callbacks, which are pretty different from futures anyway. And, in Rust, it's very easy to miss one early-return point, to make sure that returning
Err
from a function aborts the transaction.TL;DR:
This will (AFAICT) commit the transaction if
do_some_check
were to return anErr
. The behavior I'd expect from the code if just reading it intuitively, would be for the transaction to be aborted.In order to get the behavior I'd instinctively expect, I need to use the following code, which is quite a bit less pleasant to both write and read:
WDYT about adding a
commit(self)
function totransaction
, that'd commit it (ie. just drop it), and to haveIdbTransaction
'sDrop
implementation abort the transaction if it has not been explicitly committed?Anyway, I'm just starting using indexed-db-futures, but it already seems much, much more usable than the web-sys version. So, thank you! :D
The text was updated successfully, but these errors were encountered: