| 1 |
// Install protoc compiler https://github.com/google/protobuf/releases |
| 2 |
// Install gogofaster program: |
| 3 |
// go get -u github.com/gogo/protobuf/protoc-gen-gogofaster |
| 4 |
// protoc --proto_path=../../vendor:. --gogofaster_out=. control.proto |
| 5 |
// Note that we use vendored gogoprotobuf path in example above. |
| 6 |
syntax = "proto3"; |
| 7 |
|
| 8 |
package controlpb; |
| 9 |
|
| 10 |
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
| 11 |
|
| 12 |
option (gogoproto.equal_all) = true; |
| 13 |
option (gogoproto.populate_all) = true; |
| 14 |
option (gogoproto.testgen_all) = true; |
| 15 |
|
| 16 |
enum MethodType { |
| 17 |
option (gogoproto.goproto_enum_prefix) = false; |
| 18 |
|
| 19 |
NODE = 0 [(gogoproto.enumvalue_customname) = "MethodTypeNode"]; |
| 20 |
UNSUBSCRIBE = 1 [(gogoproto.enumvalue_customname) = "MethodTypeUnsubscribe"]; |
| 21 |
DISCONNECT = 2 [(gogoproto.enumvalue_customname) = "MethodTypeDisconnect"]; |
| 22 |
SHUTDOWN = 3 [(gogoproto.enumvalue_customname) = "MethodTypeShutdown"]; |
| 23 |
SURVEY_REQUEST = 4 [(gogoproto.enumvalue_customname) = "MethodTypeSurveyRequest"]; |
| 24 |
SURVEY_RESPONSE = 5 [(gogoproto.enumvalue_customname) = "MethodTypeSurveyResponse"]; |
| 25 |
} |
| 26 |
|
| 27 |
message Command { |
| 28 |
string uid = 1 [(gogoproto.customname) = "UID", (gogoproto.jsontag) = "uid"]; |
| 29 |
MethodType method = 2 [(gogoproto.jsontag) = "method"]; |
| 30 |
bytes params = 3 [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "params", (gogoproto.nullable) = false]; |
| 31 |
} |
| 32 |
|
| 33 |
message Node { |
| 34 |
string uid = 1 [(gogoproto.customname) = "UID", (gogoproto.jsontag) = "uid"]; |
| 35 |
string name = 2 [(gogoproto.jsontag) = "name"]; |
| 36 |
string version = 3 [(gogoproto.jsontag) = "version"]; |
| 37 |
uint32 num_clients = 4 [(gogoproto.jsontag) = "num_clients"]; |
| 38 |
uint32 num_users = 5 [(gogoproto.jsontag) = "num_users"]; |
| 39 |
uint32 num_channels = 6 [(gogoproto.jsontag) = "num_channels"]; |
| 40 |
uint32 uptime = 7 [(gogoproto.jsontag) = "uptime"]; |
| 41 |
Metrics metrics = 8 [(gogoproto.jsontag) = "metrics"]; |
| 42 |
} |
| 43 |
|
| 44 |
message Metrics { |
| 45 |
double interval = 1 [(gogoproto.jsontag) = "interval"]; |
| 46 |
map<string, double> items = 2 [(gogoproto.jsontag) = "items"]; |
| 47 |
} |
| 48 |
|
| 49 |
message Unsubscribe { |
| 50 |
string channel = 1 [(gogoproto.jsontag) = "channel"]; |
| 51 |
string user = 2 [(gogoproto.jsontag) = "user"]; |
| 52 |
} |
| 53 |
|
| 54 |
message Disconnect { |
| 55 |
string user = 1 [(gogoproto.jsontag) = "user"]; |
| 56 |
repeated string whitelist = 2 [(gogoproto.jsontag) = "whitelist"]; |
| 57 |
uint32 code = 3 [(gogoproto.jsontag) = "code"]; |
| 58 |
string reason = 4 [(gogoproto.jsontag) = "reason"]; |
| 59 |
bool reconnect = 5 [(gogoproto.jsontag) = "reconnect"]; |
| 60 |
} |
| 61 |
|
| 62 |
message SurveyRequest { |
| 63 |
uint64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id"]; |
| 64 |
string op = 2 [(gogoproto.jsontag) = "op"]; |
| 65 |
bytes data = 3 [(gogoproto.jsontag) = "data"]; |
| 66 |
} |
| 67 |
|
| 68 |
message SurveyResponse { |
| 69 |
uint64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id"]; |
| 70 |
uint32 code = 3 [(gogoproto.jsontag) = "code"]; |
| 71 |
bytes data = 4 [(gogoproto.jsontag) = "data"]; |
| 72 |
} |