messages.proto 720 Bytes
Newer Older
1 2 3 4
package dht;

//run `protoc --go_out=. *.proto` to generate

5
message PBDHTMessage {
6 7 8
	enum MessageType {
		PUT_VALUE = 0;
		GET_VALUE = 1;
9 10 11 12
		ADD_PROVIDER = 2;
		GET_PROVIDERS = 3;
		FIND_NODE = 4;
		PING = 5;
Jeromy's avatar
Jeromy committed
13
		DIAGNOSTIC = 6;
14 15
	}

16 17 18 19 20
	message PBPeer {
		required string id = 1;
		required string addr = 2;
	}

21 22 23
	required MessageType type = 1;
	optional string key = 2;
	optional bytes value = 3;
24 25

	// Unique ID of this message, used to match queries with responses
26
	required string id = 4;
27 28 29

	// Signals whether or not this message is a response to another message
	optional bool response = 5;
30
	optional bool success = 6;
31 32 33

	// Used for returning peers from queries (normally, peers closer to X)
	repeated PBPeer peers = 7; 
34
}