Refactoring part 1: relocate sagas and add helpful comments
In the progressive code cleanup, I've decided to break it up in a few logical parts so it's easier to follow and track. And also it'll allow me to break in between the cleanups and work on net new features for Sia-UI.
The first part is cleaning up Sagas. For contributors interested in what Sagas are, you can learn more about it here: https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf
TLDR; it's a way to break down async business logic by using generator functions.
We're moving around various functions to have a more logical split of sagas.
Currently, the saga code is split into two files: index.ts
and wallet.ts
This is because at the start, the majority of sagas were wallet specific, while the rest of the modules didn't have much business logic attached. This got messier as time went on, and other modules developed in complexity.
I'm currently in the process of splitting it into the follow:
- wallet.ts
- renter.ts
- host.ts
- utility.ts
- polling.ts
- index.ts
Gateway and Consensus is still managed in the index.ts
file because each one only requires one worker atm. We can split those out if they get complex in the future.