Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add minimal Kademlia DHT spec #108
Add minimal Kademlia DHT spec #108
Changes from 4 commits
5378e61
ee9734b
8b89dc2
cb971aa
aee103e
4d43958
55d32ff
3de65ae
6909f8a
b3693d0
f05ee26
6ae2551
0126af1
008f1a8
c21ca3a
f240a22
6c1c224
defe08d
e1442fa
26dd2f3
a9ec523
77168f9
dbe1ff7
aa7e8fc
d742e2e
9355a8f
072360f
c4d4b53
b074091
a065aac
20b3b73
3e13846
6ec65b5
1dcb218
c755a41
e9c18bd
dab4549
324f915
dbd17a2
3e6f8f5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It is not clear to me what is this document a spec of? This paragraph describes our implementation, not the spec of the protocol (which is implementation-agnostic). E.g. it is an implementation detail that we use kbucket data structure. Other places in our stack use XOR-tries instead (which is generally recommended). So, what is this a spec of? Or is this document a description of an 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.
A protocol spec would be worded differently. It would say: An implementation of a Kademlia node must maintain K peers with shared prefix of length L, for every L.
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.
Good point. This should be a specification of the protocol. Not a description of a specific implementation.
Thanks. 9355a8f refines this section, treating the data structure as an implementation detail. The section now contains your generic description using key prefix lengths.
I was not aware of XOR-tries. I will take a deeper look. With 9355a8f the specification suggests XOR-tries as one possible data structure.
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.
nit (feel free to ignore): perhaps "should"? For a while go-ipfs had a non-pure function for IPNS records since it relied on finding the corresponding public key. As mentioned above those keys are now embedded.
I totally agree that having non-pure functions here is a bit of a disaster, so maybe leaving it as "is" makes the most sense
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.
Demoted to
should
with 3e13846. Thanks for the background @aschmahmann.To be honest, I don't think there is much value in including this sample interface in the first place, given that such interface is likely only idiomatic in its own language. E.g. rust-libp2p is actor / message-passing based, thus a synchronous interface would not fit. That said, and given that this has been discussed in this pull request at length in the past, I don't mind including it here.
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.
Ya, it's probably fine. Once we've got something we can start to clean it up, including removing language specific details that seem extraneous in a spec.
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.
This is generic to all Puts/Gets. Your implementation can do whatever as long as you only return valid data.
Your network may have implied and/or explicit expirations times per record type.
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.
This is an artifact of past versions of this pull request. Thinking about it some more, I am in favor of removing it. To me it is implementation specific. 1dcb218 removes it.
@aschmahmann let me know if you disagree.
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.
This seems to be a copy-paste error from the above
closerPeers
field. Am I missing something?