network/service: Let `get_value` return a future returning a DhtEvent
So far to retrieve a value from the DHT, one would need to: 1. Trigger a DHT event query via `NetworkWorker.get_value`. 2. Somehow retrieve the event from `NetworkWorker.poll`, e.g. by having it return the responses as a stream. Instead of the above, this commit suggests having `NetworkService.get_value` return a future, eventually resolving to the DHT response. Internally this is coordinated via `futures::sync::oneshot`, maintaining a list of subscribers for a given DHT key, notifying each one when a new event comes in.
parent
31127944
Please register or sign in to comment