-
Notifications
You must be signed in to change notification settings - Fork 5
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: ♻️ Separate MSP and BSP specific functionalities in Blockchain Service #386
refactor: ♻️ Separate MSP and BSP specific functionalities in Blockchain Service #386
Conversation
…specific functions
… of handler and into MSP/BSP specific handlers
…BSP specific handlers
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.
Nice job!
Future improvement: I suggest we separate the blockchain service command/event handlers by actor (MSP/BSP) as to avoid having all events and commands being implemented in a single place. It would be much clearer to the which actor is interested in.
It is clear though the separation of the two actors, but harder to maintain the codebase since the context is global.
if forest_root_write_result.is_ok() {
match managed_bsp_or_msp {
ManagedProvider::Msp(_) => {
self.msp_assign_forest_root_write_lock();
}
ManagedProvider::Bsp(_) => {
self.bsp_assign_forest_root_write_lock();
}
}
}
We can avoid this handling by having individual handlers for each actor.
@snowmead yeah I agree, I didn't want to over extend this PR, and the BSP/MSP specific commands was less of a problem in my view, than the other things I separated. But I agree, we can do that down the line too. |
This PR refactors some of the functionality in the
handler.rs
andutils.rs
files of the Blockchain Service, to the new fileshandler_msp.rs
andhandler_bsp.rs
. The goal is to keep BSP/MSP specific functionality better separated in the Blockchain Service.