Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will provide content but not fetch content #14

Closed
alanshaw opened this issue Jul 22, 2019 · 6 comments
Closed

Will provide content but not fetch content #14

alanshaw opened this issue Jul 22, 2019 · 6 comments

Comments

@alanshaw
Copy link
Member

  1. If our node wants to provide content, we get the delegate to "provide" it by calling /api/v0/refs, which will slurp the content up from our node (assuming it is connected) and hence the delegate will start providing the content (until next GC).

As part of the provide call, we tell the delegate to connect to a set of bootstrap nodes. Why is that? It's not doing what the comment says: "call swarm.connect on the delegated node to us, to ensure we are connected".

  1. If our node wants to fetch some content, then we can use the delegate to find peers that have it, but the delegate will not actually fetch the content for us.

That's ok, but it's not symmetric with providing (is that intended?), and is not much use in the browser because we're unlikely to be able to connect to those providers.

I appreciate this module is meant for routing and not relay. I just wanted to get some clarification on these details and maybe suggest that they are documented on the README along with the API endpoints that are required to be open an available on the delegate.

@jacobheun @daviddias

@daviddias
Copy link
Member

daviddias commented Jul 22, 2019

As part of the provide call, we tell the delegate to connect to a set of bootstrap nodes. Why is that?

Good questions. Can you point to the code that is doing that? Is this on go, js or both?

That's ok, but it's not symmetric with providing (is that intended?), and is not much use in the browser because we're unlikely to be able to connect to those providers.

It was intended as the hypothesis was that we would use Relay to connect to that final destination node. Now that the relays are shutdown, the story is different.

What I'm realizing is that JS IPFS does need to have its own dedicated infrastructure:

All of these pieces should be no more than an ipfs/libp2p node with some config set

@alanshaw
Copy link
Member Author

alanshaw commented Jul 23, 2019

As part of the provide call, we tell the delegate to connect to a set of bootstrap nodes. Why is that?

Good questions. Can you point to the code that is doing that? Is this on go, js or both?

const addrs = this.bootstrappers.map((addr) => {
return addr.encapsulate(`/p2p-circuit/ipfs/${this.peerId.toB58String()}`)
})
const results = await Promise.all(
addrs.map((addr) => {
return this.swarm.connect(addr.toString()).catch(() => {})

That's ok, but it's not symmetric with providing (is that intended?), and is not much use in the browser because we're unlikely to be able to connect to those providers.

It was intended as the hypothesis was that we would use Relay to connect to that final destination node. Now that the relays are shutdown, the story is different.

Gotcha.

What I'm realizing is that JS IPFS does need to have its own dedicated infrastructure:

  • preload nodes

Got.

Need, need.

  • relay node for this issue (can be the same as the above one, but might be useful to be different)

We'd not be able to force people using these modules to use a particular relay would we? I am +1 on "another relay for JS IPFS" though 😂

  • websocket bootstrappers

Got. Right?

All of these pieces should be no more than an ipfs/libp2p node with some config set

👍

@daviddias
Copy link
Member

@alanshaw now that I see the code, what I suspect is that the believe (I say believe because I couldn't find it documented anywhere) is that the Bootstrappers would also be the relays, which is not the case.

On the JS IPFS Infrastructure. As you say, we have multiple of those pieces, but currently it is a black box for users. We should document that in addition to what js-ipfs is capable, we also have deployed all of those for very specific reasons.

@alanshaw
Copy link
Member Author

refs ipfs/js-ipfs#2231

@jacobheun
Copy link
Contributor

and is not much use in the browser because we're unlikely to be able to connect to those providers.

This is the case now, but if we have more nodes leveraging public delegates the problem should go away, because we should find the delegate nodes in the provider lookup instead of the origin nodes.

The lack of symmetry is really a hack on not using a provide api. A clearer api might be to actually tell the delegate node to provide, and then it would fetch the content from us before it announced, rather than us just telling it to pull from us and then assume it's registering as a provider of that.

@achingbrain
Copy link
Member

This module had fetch methods added several years ago, please re-open if you're still having problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants