@@ -17,13 +17,8 @@ service FunctionRpc {
17
17
}
18
18
19
19
message StreamingMessage {
20
- // Used to identify message between host and worker
21
20
string request_id = 1 ;
22
-
23
- // Payload of the message
24
21
oneof content {
25
-
26
- // Worker initiates stream
27
22
StartStream start_stream = 20 ;
28
23
29
24
// Host sends capabilities/init data to worker
@@ -53,17 +48,12 @@ message StreamingMessage {
53
48
// Worker responds after loading with the load result
54
49
FunctionLoadResponse function_load_response = 9 ;
55
50
56
- // Host requests a given invocation
57
51
InvocationRequest invocation_request = 4 ;
58
-
59
- // Worker responds to a given invocation
60
52
InvocationResponse invocation_response = 5 ;
61
-
62
53
// Host sends cancel message to attempt to cancel an invocation.
63
54
// If an invocation is cancelled, host will receive an invocation response with status cancelled.
64
55
InvocationCancel invocation_cancel = 21 ;
65
56
66
- // Worker logs a message back to the host
67
57
RpcLog rpc_log = 2 ;
68
58
}
69
59
}
@@ -73,15 +63,11 @@ message StreamingMessage {
73
63
// protocol type
74
64
// protocol version
75
65
76
- // Worker sends the host information identifying itself
77
66
message StartStream {
78
- // id of the worker
79
67
string worker_id = 2 ;
80
68
}
81
69
82
- // Host requests the worker to initialize itself
83
70
message WorkerInitRequest {
84
- // version of the host sending init request
85
71
string host_version = 1 ;
86
72
87
73
// A map of host supported features/capabilities
@@ -92,40 +78,27 @@ message WorkerInitRequest {
92
78
map <string , RpcLog.Level > log_categories = 3 ;
93
79
}
94
80
95
- // Worker responds with the result of initializing itself
96
81
message WorkerInitResponse {
97
- // Version of worker
98
82
string worker_version = 1 ;
99
83
// A map of worker supported features/capabilities
100
84
map <string , string > capabilities = 2 ;
101
-
102
- // Status of the response
103
85
StatusResult result = 3 ;
104
86
}
105
87
106
- // Used by the host to determine success/failure/cancellation
107
88
message StatusResult {
108
- // Indicates Failure/Success/Cancelled
109
89
enum Status {
110
90
Failure = 0 ;
111
91
Success = 1 ;
112
92
Cancelled = 2 ;
113
93
}
114
- // Status for the given result
115
94
Status status = 4 ;
116
-
117
- // Specific message about the result
118
95
string result = 1 ;
119
-
120
- // Exception message (if exists) for the status
121
96
RpcException exception = 2 ;
122
-
123
97
// Captured logs or relevant details can use the logs property
124
98
repeated RpcLog logs = 3 ;
125
99
}
126
100
127
101
// TODO: investigate grpc heartbeat - don't limit to grpc implemention
128
-
129
102
// Message is empty by design - Will add more fields in future if needed
130
103
message WorkerHeartbeat {}
131
104
@@ -135,170 +108,113 @@ message WorkerTerminate {
135
108
google.protobuf.Duration grace_period = 1 ;
136
109
}
137
110
138
- // Host notifies worker of file content change
139
111
message FileChangeEventRequest {
140
- // Types of File change operations (See link for more info: https://msdn.microsoft.com/en-us/library/t6xf43e0(v=vs.110).aspx)
112
+ // https://msdn.microsoft.com/en-us/library/t6xf43e0(v=vs.110).aspx
141
113
enum Type {
142
- Unknown = 0 ;
114
+ Unknown = 0 ;
143
115
Created = 1 ;
144
116
Deleted = 2 ;
145
117
Changed = 4 ;
146
118
Renamed = 8 ;
147
119
All = 15 ;
148
120
}
149
121
150
- // type for this event
151
122
Type type = 1 ;
152
-
153
- // full file path for the file change notification
154
123
string full_path = 2 ;
155
-
156
- // Name of the function affected
157
124
string name = 3 ;
158
125
}
159
126
160
- // Indicates whether worker reloaded successfully or needs a restart
161
127
message WorkerActionResponse {
162
- // indicates whether a restart is needed, or reload succesfully
163
128
enum Action {
164
129
Restart = 0 ;
165
130
Reload = 1 ;
166
131
}
167
132
168
- // action for this response
169
133
Action action = 1 ;
170
-
171
- // text reason for the response
172
134
string reason = 2 ;
173
135
}
174
136
175
- // NOT USED
176
137
message WorkerStatusRequest {
177
138
}
178
139
179
- // NOT USED
180
140
message WorkerStatusResponse {
181
141
}
182
142
183
- // Host tells the worker to load a Function
184
143
message FunctionLoadRequest {
185
144
// unique function identifier (avoid name collisions, facilitate reload case)
186
145
string function_id = 1 ;
187
-
188
- // Metadata for the request
189
146
RpcFunctionMetadata metadata = 2 ;
190
147
}
191
148
192
- // Worker tells host result of reload
193
149
message FunctionLoadResponse {
194
- // unique function identifier
195
150
string function_id = 1 ;
196
-
197
- // Result of load operation
198
151
StatusResult result = 2 ;
199
152
// TODO: return type expected?
200
153
}
201
154
202
- // Information on how a Function should be loaded and its bindings
203
155
message RpcFunctionMetadata {
204
156
// TODO: do we want the host's name - the language worker might do a better job of assignment than the host
205
157
string name = 4 ;
206
158
207
- // base directory for the Function
208
159
string directory = 1 ;
209
-
210
- // Script file specified
211
160
string script_file = 2 ;
212
-
213
- // Entry point specified
214
161
string entry_point = 3 ;
215
162
216
- // Bindings info
217
163
map <string , BindingInfo > bindings = 6 ;
164
+
165
+ // not adding disabled or excluded as those (currently) are only relevant to host
218
166
}
219
167
220
- // Host requests worker to invoke a Function
221
168
message InvocationRequest {
222
- // Unique id for each invocation
223
169
string invocation_id = 1 ;
224
-
225
- // Unique id for each Function
226
170
string function_id = 2 ;
227
-
228
- // Input bindings (include trigger)
229
171
repeated ParameterBinding input_data = 3 ;
230
-
231
- // binding metadata from trigger
232
172
map <string , TypedData > trigger_metadata = 4 ;
233
173
}
234
174
235
- // Host requests worker to cancel invocation
236
175
message InvocationCancel {
237
- // Unique id for invocation
238
176
string invocation_id = 2 ;
239
-
240
- // Time period before force shutdown
241
177
google.protobuf.Duration grace_period = 1 ; // could also use absolute time
242
178
}
243
179
244
- // Worker responds with status of Invocation
245
180
message InvocationResponse {
246
- // Unique id for invocation
247
181
string invocation_id = 1 ;
248
-
249
- // Output binding data
250
182
repeated ParameterBinding output_data = 2 ;
251
-
252
- // data returned from Function (for $return and triggers with return support)
253
183
TypedData return_value = 4 ;
254
-
255
- // Status of the invocation (success/failure/canceled)
256
184
StatusResult result = 3 ;
257
185
}
258
186
259
- // Used to encapsulate data which could be a variety of types
260
187
message TypedData {
261
188
oneof data {
262
189
string string = 1 ;
263
190
string json = 2 ;
264
191
bytes bytes = 3 ;
265
192
bytes stream = 4 ;
266
193
RpcHttp http = 5 ;
267
- sint64 int = 6 ;
194
+ sint64 int = 6 ;
268
195
double double = 7 ;
269
196
}
270
197
}
271
198
272
- // Used to describe a given binding on invocation
273
199
message ParameterBinding {
274
- // Name for the binding
275
200
string name = 1 ;
276
-
277
- // Data for the binding
278
201
TypedData data = 2 ;
279
202
}
280
203
281
- // Used to describe a given binding on load
282
204
message BindingInfo {
283
- // Indicates whether it is an input or output binding (or a fancy inout binding)
284
- enum Direction {
285
- in = 0 ;
286
- out = 1 ;
287
- inout = 2 ;
288
- }
289
-
290
- // Type of binding (e.g. HttpTrigger)
291
205
string type = 2 ;
292
-
293
- // Direction of the given binding
294
206
Direction direction = 3 ;
207
+
208
+ enum Direction {
209
+ in = 0 ;
210
+ out = 1 ;
211
+ inout = 2 ;
212
+ }
295
213
}
296
214
297
- // Used to send logs back to the Host
298
215
message RpcLog {
299
216
// Matching ILogger semantics
300
217
// https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs
301
- // Level for the Log
302
218
enum Level {
303
219
Trace = 0 ;
304
220
Debug = 1 ;
@@ -309,42 +225,24 @@ message RpcLog {
309
225
None = 6 ;
310
226
}
311
227
312
- // Unique id for invocation (if exists)
313
228
string invocation_id = 1 ;
314
-
315
- // TOD: This should be an enum
316
- // Category for the log (startup, load, invocation, etc.)
317
229
string category = 2 ;
318
-
319
- // Level for the given log message
320
230
Level level = 3 ;
321
-
322
- // Message for the given log
323
231
string message = 4 ;
324
-
325
- // Id for the even associated with this log (if exists)
326
232
string event_id = 5 ;
327
-
328
- // Exception (if exists)
329
233
RpcException exception = 6 ;
330
234
331
235
// json serialized property bag, or could use a type scheme like map<string, TypedData>
332
236
string properties = 7 ;
333
237
}
334
238
335
- // Encapsulates an Exception
336
239
message RpcException {
337
- // Source of the exception
338
240
string source = 3 ;
339
-
340
- // Stack trace for the exception
341
241
string stack_trace = 1 ;
342
-
343
- // Textual message describing hte exception
344
242
string message = 2 ;
345
243
}
346
244
347
- // TODO - solidify this or remove it
245
+ // TODO - solidify this
348
246
message RpcHttp {
349
247
string method = 1 ;
350
248
string url = 2 ;
@@ -353,6 +251,6 @@ message RpcHttp {
353
251
map <string ,string > params = 10 ;
354
252
string status_code = 12 ;
355
253
map <string ,string > query = 15 ;
356
- bool enable_content_negotiation = 16 ;
254
+ bool is_raw = 16 ;
357
255
TypedData rawBody = 17 ;
358
256
}
0 commit comments