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

Add DHT record code #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mildred
Copy link

@mildred mildred commented Feb 25, 2017

As discussed in libp2p/go-libp2p-kad-dht#50 (comment), I want to reference IPFS DHT records using CID. This PR allocates a code for that.

@hsanjuan
Copy link
Contributor

hsanjuan commented Mar 1, 2017

If I follow your comments, this is the code you propose for a custom record format which is referenced from the DHT?

I think it would be good if you accompanied this with an actual implementation of the codec for that format so that we can assure that codes in the table have real usage, but I'm not sure about the policy. @Kubuxu @whyrusleeping can you help?

@mildred
Copy link
Author

mildred commented Mar 6, 2017

I have working code here : https://github.com/mildred/ipfs-objects/

What it does is advertise a CID for a DHT record. The lookup process for those records is a little different. Instead of looking it up directly in the DHT, this CID is looked up instead, then on the resulting list of peers, a direct record query is isued, only to the peers advertising for that record through the CID.

This allows to advertise records that are not understandable my most peers, because when putting a record in the DHT, if the peer that is designed to store it doesn't understand its meaning and how to validate it, it will refuse to store it.

This method allows only peers that understand the record to actually host it.

Here is the actual function that takes a record key and convert it to a CID: https://github.com/mildred/ipfs-objects/blob/master/src/ipobj/interfaces.go#L20-L29

@daviddias
Copy link
Member

DHT Records should follow IPRS (or an updated version of that spec), they should be standard dag-pb or dag-cbor objects. I'm not seeing a reason to call a record another format.

@daviddias daviddias mentioned this pull request Mar 8, 2017
@mildred
Copy link
Author

mildred commented Mar 8, 2017

There are many reasons not to follow this spec (simplicity, application specific) but the most important thing for me seems to be that IPRS assumes that every node of the network agrees on predefined validity schemes, and to use a validity scheme, all the network must recognize it.

The system I'm creating doesn't use a validity scheme that is recognized by the whole network. As such, the record cannot be present on just any node of the DHT and there is a need to advertise where this record can be found. To locate something on peers of the DHT, the thing must be identified by a CID. As such, I needed to allocate a code to locate DHT records.

If it is not desirable to have a code allocated for this specifically, I suggest to allocate codes for application specific usages.

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

Successfully merging this pull request may close these issues.

3 participants