-
Notifications
You must be signed in to change notification settings - Fork 152
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
Execute Transaction<T>.Actions
all or nothing at all
#1275
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1275 +/- ##
==========================================
+ Coverage 83.96% 84.11% +0.15%
==========================================
Files 402 407 +5
Lines 34464 34987 +523
==========================================
+ Hits 28937 29430 +493
- Misses 3700 3730 +30
Partials 1827 1827
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that need to rebase.
69b6474
to
edeb6ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to apply reviews 🙏🏻 I believe this is my last review 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
@planetarium/libplanet PTAL. |
@planetarium/libplanet All green now. Please take a look again! |
This addresses fixes #1267.
Previously,
Transaction<T>.Actions
had been executed and affected states whether the actions throw an exception or not. However, as the term “transaction” in computer science in general imply it's atomic (i.e., executed all or nothing), this behavior had been quite misleading.This patch regards such previous behavior as a bug, and fixes it so that if any action in a
Transaction<T>
throws an exception all actions in the transaction do not commit any state changes to the currentIStore
.However, there is still a quirk for it:
IActionRenderer<T>
receives render events caused by unsuccessful transactions too, as it has done. In other words, transactions' atomicity still is not guaranteed for action renderers. In order to work around this quirk, this patch introducesAtomicActionRenderer<T>
as well. If anIActionRenderer<T>
is wrapped byAtomicActionRenderer<T>
the inner action renderer will receive noRenderActionError()
/UnrenderActionError()
events except for block actions (since they do not belong to any transactions).The reasons why I stick with the existing behavior for action renderers are:
IActionRenderer<T>
no more natural. BecauseRenderActionError()
/UnrenderActionError()
methods are no more necessary.IActionRenderer<T>
is one of the key interfaces game app programmers must implement. For example, such change on the interface would require many changes on Nine Chronicles.Transaction<T>
s' results #1156.For details, please read the added changelogs and XML doc comments too.