-
Notifications
You must be signed in to change notification settings - Fork 95
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
Refactor/303 round return storage actions #367
base: master
Are you sure you want to change the base?
Conversation
+ remove_contributor_unsafe + remove_locks_unsafe + remove_chunk_contributions_unsafe
+ try_lock_chunk
@kellpossible would you mind communicating the change you are making and what problem does it solve? So far I can see that instead of calling methods of storage, function returns a vec of actions. It means that if the function fails half way, nothing gets written to the storage and it's easier to rollback. |
@ibaryshnikov valid concerns. A few reasons:
That's an interesting benefit I hadn't considered.
I guess that would depend on the code which takes the actions and performs the processing, they can decide whether failure of one action should prevent the execution of subsequent actions. It would be context specific.
At the moment they both have a logical root in some method of |
If we can write code that behaves more predictably, and explicitly (less hidden side effects), then hopefully we can reduce the amount of debugging required in the first place. |
For some more context about these changes, I'm currently working on #365 which has some failing unit tests. As part of diagnosing/fixing this I would like to write some more unit tests for |
I'm quite skeptical about this change, because it doesn't address the cause of the problem, which is the lack of transactions when working with file system. |
@ibaryshnikov the cause of which problem specifically? This pull request not claiming to help address anything more than the issues that have been referenced. Are you're worried that the changes pose an unacceptable risk to the system that is in production? |
the incorrect state of the transcript
I don't think it does any harm, but it doesn't reduce the number of fs calls either |
@ibaryshnikov I'm guessing we probably had the similar discussion on slack, but for the sake of others reviewing/reading, I'll reply here too. This is a quality of life refactor, only claiming to help address this issues referenced in the description and my comment above. It doesn't attempt to modify the observable functionality of the software or try to fix any bugs. Why is it important that this particular pull request addresses the incorrect state of the transcript and reduce the number of fs calls? Could not those issues be addressed in a separate pull request? |
7b71127
to
33ca464
Compare
From the conversation in the meeting today, I should mention that this PR is not intended to introduce a universal way to interact with the storage layer, but more is designed to introduce a separation of concerns between managing the state of the @ibaryshnikov you mentioned the use of This chapter https://livebook.manning.com/book/functional-programming-in-c-sharp-second-edition/chapter-3/v-5/122 (read quickly the free preview has a time limit eek) has a great overview of the problem that this PR is attempting to address. Rust avoids some of the pitfalls of impurity by requiring us to be explicate about the mutability of input arguments, however there still remains many problems with allowing I think the pattern used here is also a bit similar to the command design pattern. If you ignore the concerns about subclasses (we are using Rust after all!), conceptually replace the "User Interface" code with "Round" and replace "Business Logic" with "File System Operations" the analogy partly fits. What is different from their example is that the code to execute the command currently lives in the |
This PR now needs to be rebased |
Perform refactor #303
Dependent on #361 (please do not merge before that)