imp
imp copied to clipboard
Channel usage
What is the best way to utilize channels for event/message passing in imp?
- one complication is that mothra is dependent on an older version of tokio bc of libp2p.
Options:- https://docs.rs/tokio-compat/0.1.5/tokio_compat/
- callbacks between mothra and P2P service
Once a solution is settled on it should probably be pushed to mothra to abstract away the issue
- another issue is the design of two way communication between services.
- Do I create a separate tx/rx pair for each communication dir?
- would broadcast channels help?
https://docs.rs/tokio/0.2.18/tokio/sync/broadcast/index.html
-
consider just using the watch channel for shutdown command
-
combining mpsc and oneshot might be a hand way to setup a req/resp style pattern
-
should I design an event bus abstraction to simplify usage?