-
Notifications
You must be signed in to change notification settings - Fork 6
/
grpc-bus.proto
152 lines (131 loc) · 3.14 KB
/
grpc-bus.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
syntax="proto3";
package grpcbus;
// Wrapper for a message from client
message GBClientMessage {
// Service management
GBCreateService service_create = 1;
GBReleaseService service_release = 2;
// Call management
GBCreateCall call_create = 3;
// Terminates a call
GBCallEnd call_end = 4;
GBSendCall call_send = 5;
}
message GBServerMessage {
// service management responses
GBCreateServiceResult service_create = 1;
GBReleaseServiceResult service_release = 2;
// Call management
GBCreateCallResult call_create = 3;
GBCallEvent call_event = 4;
GBCallEnded call_ended = 5;
}
// Information about a service
message GBServiceInfo {
// Endpoint
string endpoint = 1;
// Fully qualified service identifier
string service_id = 2;
// TODO: figure out how to serialize credentials
}
// Initialize a new Service.
message GBCreateService {
// ID of the service, client-generated, unique.
int32 service_id = 1;
GBServiceInfo service_info = 2;
}
// Release an existing / pending Service.
message GBReleaseService {
int32 service_id = 1;
}
message GBMetadataValues {
repeated string values = 1;
}
message GBCallInfo {
string method_id = 1;
bytes bin_argument = 2;
// Meta is a map from string to []string
// e.g: https://godoc.org/google.golang.org/grpc/metadata#MD
map<string, GBMetadataValues> metadata = 3;
}
// Create a call
message GBCreateCall {
int32 service_id = 1;
int32 call_id = 2;
// Info
GBCallInfo info = 3;
}
// When the call is ended
message GBCallEnded {
int32 call_id = 1;
int32 service_id = 2;
}
// End the call
message GBEndCall {
int32 call_id = 1;
int32 service_id = 2;
}
// Send a message on a streaming call
message GBSendCall {
int32 call_id = 1;
int32 service_id = 2;
bytes bin_data = 3;
// Do we want to just send end() over a streaming call?
bool is_end = 4;
}
// Result of attempting to create a service
message GBCreateServiceResult {
// ID of service, client-generated, unique
int32 service_id = 1;
// Result
ECreateServiceResult result = 2;
// Error details
string error_details = 3;
enum ECreateServiceResult {
// Success
SUCCESS = 0;
// Invalid service ID, retry with a new one.
INVALID_ID = 1;
// GRPC internal error constructing the service.
GRPC_ERROR = 2;
}
}
// When the server releases a service
message GBReleaseServiceResult {
int32 service_id = 1;
}
// Result of creating a call.
// This is sent immediately after starting call.
message GBCreateCallResult {
int32 call_id = 1;
int32 service_id = 4;
// Result
ECreateCallResult result = 2;
string error_details = 3;
enum ECreateCallResult {
// Success
SUCCESS = 0;
// Invalid call ID, retry with a new one.
INVALID_ID = 1;
// GRPC internal error initializing the call
GRPC_ERROR = 2;
}
}
// Received message during streaming call.
message GBCallEvent {
// Call ID
int32 call_id = 1;
// Service ID
int32 service_id = 4;
// Event ID
string event = 2;
// JSON data.
string json_data = 3;
// Binary data
bytes bin_data = 5;
}
// Terminate a call
message GBCallEnd {
int32 call_id = 1;
int32 service_id = 2;
}