-
Notifications
You must be signed in to change notification settings - Fork 106
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
[WIP] kademlia dht #129
[WIP] kademlia dht #129
Conversation
Will be giving this a closer look soon. On a first skim, looks very thorough! To comply with the interface in #123, I think we should first determine what constitutes a "service" (this was inspired by Go) and whether "service" maps to any existing py-libp2p notions (CC @alexh). The JavaScript interface, on the other hand, doesn't need this notion as a parameter. |
From the go implementation I see that they convert the "service" into a I did some change in the code to make it comply to the 2 interfaces defined i #123. Everything is still a bit rough Some points I'm not sure how to tackle:
|
@zaibon great work! Looks like a very good start and agree that it's a bit rough, especially when we are initializing. I think a big part of that comes from adapting bmuller's kademlia implementation and jumping straight to peer discovery without solidifying peer routing and content routing. Here are my two cents.
I will ask either @robzajac or @alexh to take a look as well when they get the chance but everyone is AFK this week. Thank you! |
I agree with all these points that @zixuanzh made. I think after these changes are made we are close to being able to merge this. Everything in this looks good though, it looks like we are on the right track with this! Thank you so much for your hard work on this @zaibon, let me know if theres anything I can help with here. |
yep everything that has been said make sense. There is one thing though I'm not sure about. It seems in the go implementation of the kadmelia module, they keep a list of "providers" (https://github.com/libp2p/go-libp2p-kad-dht/blob/master/dht.go#L50) which is used to do content and peer routing. This "providers" list is used managed with 2 RPC call |
@zaibon looks like we don't need it immediately and agree that it is not a standard kademlia dht method. We can add them back in later on if we see a use case for them. |
Have a look at the libp2p Kademlia DHT spec (WIP) here: https://github.com/libp2p/specs/pull/108/files#diff-d1380783eeaa00e1c992decb33b995fdR219 I think of provider records as symlinks, or advertisements. Instead of storing the data associated with a key at a particular node, you store a link to the place where it can be found. This is useful in IPFS if you have a, say, 4TB file. The node holding it will advertise the content in the region of the DHT where interested parties will look for it. Nodes wanting to fetch the file will then connect to the provider directly. Once they have it, they too will become providers of the same record. |
@raulk Thanks for the clarification. Also from what I understand, the first thing to do before being able to progress is to adapt the bmuller's kademlia implementation to match what ipfs/libp2 does. This include:
|
I adapted the first comment of the PR to list all the sub tasks. @alexh I think there is enough work for both of us here, so if you want to help out you're welcome. Let me know how you want to distribute the work |
Hey @zaibon I think you might have more clarity into what a good work distribution would be. |
@alexh I've updated the first comment of the PR with the list of tasks that needs to done. |
@zaibon thanks for your hard work on this so far. We're going to pick up on your tasks above over the next 2-3 weeks as we complete other internal milestones as well. Our goal is definitely to ship peer discovery by the end of those 3 weeks. Feel free to jump back in whenever you have the cycles. Thanks again! |
We plan to merge this PR and create issues outlining the roadmap on development of our Kademlia implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will create an issue on what needs to be done
This is a bunch of code I started writing when I wanted to investigate the kadmelia module.This doesn't completely comply with the peer discovery introduced at : 17c778d
After some discussion here how to tackle this PR, here is the list of task that needs to be done in order to be able to merge this:
ADD_PROVIDER
andGET_PROVIDERS
rcp commands: https://github.com/libp2p/specs/pull/108/files#diff-d1380783eeaa00e1c992decb33b995fdR219What I've done so far: