Created
July 29, 2014 18:12
-
-
Save whyrusleeping/4717c758245df5bf8948 to your computer and use it in GitHub Desktop.
protobuf message type for dht messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dht; | |
//run `protoc --go_out=. *.proto` to generate | |
message DHTMessage { | |
enum MessageType { | |
PUT_VALUE = 0; | |
GET_VALUE = 1; | |
PING = 2; | |
FIND_NODE = 3; | |
} | |
required MessageType type = 1; | |
optional string key = 2; | |
optional bytes value = 3; | |
} |
(we implement both regular PUT/GET and the PROVIDER PUT/GET because some values are small enough to store in the DHT itself (i.e. IPNS mappings) while others are too large (regular objects)
Ive updated my type to reflect this and will be pushing it soon.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We'll need more message types ( to do the Sloppy part (Coral), Provide/FindProviders in
routing/routing.go
)e.g.
or something. The
PROVIDER
stuff is the sloppy put/get, meaning, instead of storing ONE value in the entire DHT, we store a set of values, or rather, a set of peers who can return the value. (if interested, see coral, dhash, mainlineDHT for why this is a good idea). and each item in the set gets put/expires independently. (avoids multiple-writer races, which would be bad if you had to GET -> modify -> PUT the set as a regular, single value)