This PR refactors the previously overly complex and problematic sendfil service.go into a few components that are more simple, easy to understand, and also hopefully work.
store/store.go - Encapsulation of mongo datastore operations, exposes an API with clean functionality supporting required operations on/around Txn structs.
waitrunner/waitrunner.go - A concurrent worker that waits for a single message to become active on chain, fail, or times out. Uses store.
waitmanager/waitmanager.go - Manages the async concurrent processes of monitoring many Txn's underlying filecoin message status. Allows subscription and notifies interested callers of updates. Uses waitrunner and store.
service.go - The gRPC service implementation which now includes only minimal logic.
This PR addresses other smaller feedback from the previous PR, I'll make note of those things in the code.
@jsign I noticed a couple more tests I want to write (the Store especially), but I think this is ready for some 👀. Feeling pretty good about it, but I'm sure there are some things to discuss.
This PR refactors the previously overly complex and problematic sendfil
service.go
into a few components that are more simple, easy to understand, and also hopefully work.store/store.go
- Encapsulation of mongo datastore operations, exposes an API with clean functionality supporting required operations on/aroundTxn
structs.waitrunner/waitrunner.go
- A concurrent worker that waits for a single message to become active on chain, fail, or times out. Usesstore
.waitmanager/waitmanager.go
- Manages the async concurrent processes of monitoring manyTxn
's underlying filecoin message status. Allows subscription and notifies interested callers of updates. Useswaitrunner
andstore
.service.go
- The gRPC service implementation which now includes only minimal logic.This PR addresses other smaller feedback from the previous PR, I'll make note of those things in the code.