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

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

5
message Message {
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
	message Peer {
17 18 19 20
		required string id = 1;
		required string addr = 2;
	}

21
	// defines what type of message it is.
22
	required MessageType type = 1;
23 24 25 26 27 28

	// defines what coral cluster level this query/response belongs to.
	optional int32 clusterLevelRaw = 10;

	// Used to specify the key associated with this message.
	// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
29
	optional string key = 2;
30

31 32 33
	// Used to return a value
	// PUT_VALUE, GET_VALUE
	optional bytes value = 3;
34

35 36 37
	// Used to return peers closer to a key in a query
	// GET_VALUE, GET_PROVIDERS, FIND_NODE
	repeated Peer closerPeers = 8;
38

39 40 41
	// Used to return Providers
	// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
	repeated Peer providerPeers = 9;
42
}