helia
helia copied to clipboard
feat: pass initial providers to session
For when you know that certain peers have some or all of the blocks you want, allow passing providers to session implementations to start from instead of always querying the routing/connected peers.
const buf = await helia.blockstore.get(cid, {
providers: [
peerId1,
peerId2
]
})
Session implementations accept an array of PeerId | Multiaddr | Multiaddr[] and use them if they can or discard them if they can't.
Change checklist
- [x] I have performed a self-review of my own code
- [x] I have made corresponding changes to the documentation if necessary (this includes comments as well)
- [x] I have added tests that prove my fix is effective or that my feature works
note that this is related to https://discuss.ipfs.tech/t/helia-not-using-bitswap-even-though-dialed-to-nodes/19234/10 even though it may no longer be needed, it should prove useful for some situations.