@@ -17,13 +17,8 @@ service FunctionRpc {
1717}
1818
1919message StreamingMessage {
20- // Used to identify message between host and worker
2120 string request_id = 1 ;
22-
23- // Payload of the message
2421 oneof content {
25-
26- // Worker initiates stream
2722 StartStream start_stream = 20 ;
2823
2924 // Host sends capabilities/init data to worker
@@ -53,17 +48,12 @@ message StreamingMessage {
5348 // Worker responds after loading with the load result
5449 FunctionLoadResponse function_load_response = 9 ;
5550
56- // Host requests a given invocation
5751 InvocationRequest invocation_request = 4 ;
58-
59- // Worker responds to a given invocation
6052 InvocationResponse invocation_response = 5 ;
61-
6253 // Host sends cancel message to attempt to cancel an invocation.
6354 // If an invocation is cancelled, host will receive an invocation response with status cancelled.
6455 InvocationCancel invocation_cancel = 21 ;
6556
66- // Worker logs a message back to the host
6757 RpcLog rpc_log = 2 ;
6858 }
6959}
@@ -73,15 +63,11 @@ message StreamingMessage {
7363// protocol type
7464// protocol version
7565
76- // Worker sends the host information identifying itself
7766message StartStream {
78- // id of the worker
7967 string worker_id = 2 ;
8068}
8169
82- // Host requests the worker to initialize itself
8370message WorkerInitRequest {
84- // version of the host sending init request
8571 string host_version = 1 ;
8672
8773 // A map of host supported features/capabilities
@@ -92,40 +78,27 @@ message WorkerInitRequest {
9278 map <string , RpcLog.Level > log_categories = 3 ;
9379}
9480
95- // Worker responds with the result of initializing itself
9681message WorkerInitResponse {
97- // Version of worker
9882 string worker_version = 1 ;
9983 // A map of worker supported features/capabilities
10084 map <string , string > capabilities = 2 ;
101-
102- // Status of the response
10385 StatusResult result = 3 ;
10486}
10587
106- // Used by the host to determine success/failure/cancellation
10788message StatusResult {
108- // Indicates Failure/Success/Cancelled
10989 enum Status {
11090 Failure = 0 ;
11191 Success = 1 ;
11292 Cancelled = 2 ;
11393 }
114- // Status for the given result
11594 Status status = 4 ;
116-
117- // Specific message about the result
11895 string result = 1 ;
119-
120- // Exception message (if exists) for the status
12196 RpcException exception = 2 ;
122-
12397 // Captured logs or relevant details can use the logs property
12498 repeated RpcLog logs = 3 ;
12599}
126100
127101// TODO: investigate grpc heartbeat - don't limit to grpc implemention
128-
129102// Message is empty by design - Will add more fields in future if needed
130103message WorkerHeartbeat {}
131104
@@ -135,170 +108,113 @@ message WorkerTerminate {
135108 google.protobuf.Duration grace_period = 1 ;
136109}
137110
138- // Host notifies worker of file content change
139111message 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
141113 enum Type {
142- Unknown = 0 ;
114+ Unknown = 0 ;
143115 Created = 1 ;
144116 Deleted = 2 ;
145117 Changed = 4 ;
146118 Renamed = 8 ;
147119 All = 15 ;
148120 }
149121
150- // type for this event
151122 Type type = 1 ;
152-
153- // full file path for the file change notification
154123 string full_path = 2 ;
155-
156- // Name of the function affected
157124 string name = 3 ;
158125}
159126
160- // Indicates whether worker reloaded successfully or needs a restart
161127message WorkerActionResponse {
162- // indicates whether a restart is needed, or reload succesfully
163128 enum Action {
164129 Restart = 0 ;
165130 Reload = 1 ;
166131 }
167132
168- // action for this response
169133 Action action = 1 ;
170-
171- // text reason for the response
172134 string reason = 2 ;
173135}
174136
175- // NOT USED
176137message WorkerStatusRequest {
177138}
178139
179- // NOT USED
180140message WorkerStatusResponse {
181141}
182142
183- // Host tells the worker to load a Function
184143message FunctionLoadRequest {
185144 // unique function identifier (avoid name collisions, facilitate reload case)
186145 string function_id = 1 ;
187-
188- // Metadata for the request
189146 RpcFunctionMetadata metadata = 2 ;
190147}
191148
192- // Worker tells host result of reload
193149message FunctionLoadResponse {
194- // unique function identifier
195150 string function_id = 1 ;
196-
197- // Result of load operation
198151 StatusResult result = 2 ;
199152 // TODO: return type expected?
200153}
201154
202- // Information on how a Function should be loaded and its bindings
203155message RpcFunctionMetadata {
204156 // TODO: do we want the host's name - the language worker might do a better job of assignment than the host
205157 string name = 4 ;
206158
207- // base directory for the Function
208159 string directory = 1 ;
209-
210- // Script file specified
211160 string script_file = 2 ;
212-
213- // Entry point specified
214161 string entry_point = 3 ;
215162
216- // Bindings info
217163 map <string , BindingInfo > bindings = 6 ;
164+
165+ // not adding disabled or excluded as those (currently) are only relevant to host
218166}
219167
220- // Host requests worker to invoke a Function
221168message InvocationRequest {
222- // Unique id for each invocation
223169 string invocation_id = 1 ;
224-
225- // Unique id for each Function
226170 string function_id = 2 ;
227-
228- // Input bindings (include trigger)
229171 repeated ParameterBinding input_data = 3 ;
230-
231- // binding metadata from trigger
232172 map <string , TypedData > trigger_metadata = 4 ;
233173}
234174
235- // Host requests worker to cancel invocation
236175message InvocationCancel {
237- // Unique id for invocation
238176 string invocation_id = 2 ;
239-
240- // Time period before force shutdown
241177 google.protobuf.Duration grace_period = 1 ; // could also use absolute time
242178}
243179
244- // Worker responds with status of Invocation
245180message InvocationResponse {
246- // Unique id for invocation
247181 string invocation_id = 1 ;
248-
249- // Output binding data
250182 repeated ParameterBinding output_data = 2 ;
251-
252- // data returned from Function (for $return and triggers with return support)
253183 TypedData return_value = 4 ;
254-
255- // Status of the invocation (success/failure/canceled)
256184 StatusResult result = 3 ;
257185}
258186
259- // Used to encapsulate data which could be a variety of types
260187message TypedData {
261188 oneof data {
262189 string string = 1 ;
263190 string json = 2 ;
264191 bytes bytes = 3 ;
265192 bytes stream = 4 ;
266193 RpcHttp http = 5 ;
267- sint64 int = 6 ;
194+ sint64 int = 6 ;
268195 double double = 7 ;
269196 }
270197}
271198
272- // Used to describe a given binding on invocation
273199message ParameterBinding {
274- // Name for the binding
275200 string name = 1 ;
276-
277- // Data for the binding
278201 TypedData data = 2 ;
279202}
280203
281- // Used to describe a given binding on load
282204message 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)
291205 string type = 2 ;
292-
293- // Direction of the given binding
294206 Direction direction = 3 ;
207+
208+ enum Direction {
209+ in = 0 ;
210+ out = 1 ;
211+ inout = 2 ;
212+ }
295213}
296214
297- // Used to send logs back to the Host
298215message RpcLog {
299216 // Matching ILogger semantics
300217 // https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs
301- // Level for the Log
302218 enum Level {
303219 Trace = 0 ;
304220 Debug = 1 ;
@@ -309,42 +225,24 @@ message RpcLog {
309225 None = 6 ;
310226 }
311227
312- // Unique id for invocation (if exists)
313228 string invocation_id = 1 ;
314-
315- // TOD: This should be an enum
316- // Category for the log (startup, load, invocation, etc.)
317229 string category = 2 ;
318-
319- // Level for the given log message
320230 Level level = 3 ;
321-
322- // Message for the given log
323231 string message = 4 ;
324-
325- // Id for the even associated with this log (if exists)
326232 string event_id = 5 ;
327-
328- // Exception (if exists)
329233 RpcException exception = 6 ;
330234
331235 // json serialized property bag, or could use a type scheme like map<string, TypedData>
332236 string properties = 7 ;
333237}
334238
335- // Encapsulates an Exception
336239message RpcException {
337- // Source of the exception
338240 string source = 3 ;
339-
340- // Stack trace for the exception
341241 string stack_trace = 1 ;
342-
343- // Textual message describing hte exception
344242 string message = 2 ;
345243}
346244
347- // TODO - solidify this or remove it
245+ // TODO - solidify this
348246message RpcHttp {
349247 string method = 1 ;
350248 string url = 2 ;
@@ -353,6 +251,6 @@ message RpcHttp {
353251 map <string ,string > params = 10 ;
354252 string status_code = 12 ;
355253 map <string ,string > query = 15 ;
356- bool enable_content_negotiation = 16 ;
254+ bool is_raw = 16 ;
357255 TypedData rawBody = 17 ;
358256}
0 commit comments