You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
I've been exploring what an async iterator based discovery interface might look like. The following gist is a rough sketch (very unlikely to actually run) of what it could be like.
TLDR: it's just an (async) iterator that yields PeerInfo instances.
In the gist I've explored what it might be like to use these in a libp2p node, which would need for them to be abortable (stop when the libp2p node stops) and recoverable (when they error, restart them).
To be abortable I've used an AbortController which is used by the fetch API in the browser. This is just one way of giving us the ability to halt async iteration from the outside (it's kinda cool IMHO). We could use this to implement abortable methods throughout libp2p.
We should talk about what happens when we recieve a PeerInfo from a discovery module and how we can communicate that to where it needs to be.
I've been exploring what an async iterator based discovery interface might look like. The following gist is a rough sketch (very unlikely to actually run) of what it could be like.
TLDR: it's just an (async) iterator that yields PeerInfo instances.
In the gist I've explored what it might be like to use these in a libp2p node, which would need for them to be abortable (stop when the libp2p node stops) and recoverable (when they error, restart them).
To be abortable I've used an
AbortControllerwhich is used by thefetchAPI in the browser. This is just one way of giving us the ability to halt async iteration from the outside (it's kinda cool IMHO). We could use this to implement abortable methods throughout libp2p.We should talk about what happens when we recieve a
PeerInfofrom a discovery module and how we can communicate that to where it needs to be.https://gist.github.com/alanshaw/ff657468939a1795aa5b9ac626121c48
@libp2p/javascript-team I'd love to hear your thoughts on this! 🚀 ✨
refs ipfs/js-ipfs#1670