|
85 | 85 |
|
86 | 86 | - Optionally forward additional I/O channels.
|
87 | 87 |
|
| 88 | +- Provide flow control on channels. |
| 89 | + |
88 | 90 | - Provide signal delivery capability.
|
89 | 91 |
|
90 | 92 | - Protect against unauthorized use.
|
@@ -121,6 +123,10 @@ are defined as follows:
|
121 | 123 | channel (4)
|
122 | 124 | Forward auxiliary channel output to the client.
|
123 | 125 |
|
| 126 | + write-credit (8) |
| 127 | + Send ``add-credit`` exec responses when buffer space is available |
| 128 | + for standard input or writable auxiliary channels. |
| 129 | + |
124 | 130 | Several response types are distinguished by the type key:
|
125 | 131 |
|
126 | 132 | .. object:: exec started response
|
@@ -179,6 +185,25 @@ Several response types are distinguished by the type key:
|
179 | 185 |
|
180 | 186 | See `I/O Object`_ below.
|
181 | 187 |
|
| 188 | +.. object:: exec add-credit response |
| 189 | + |
| 190 | + The subprocess server has more buffer space available to receive data |
| 191 | + on the specified channel. The response SHALL consist of a JSON object |
| 192 | + with the following keys: |
| 193 | + |
| 194 | + .. object:: type |
| 195 | + |
| 196 | + (*string*, REQUIRED) The response type with a value of ``add-credit``. |
| 197 | + |
| 198 | + .. object:: channels |
| 199 | + |
| 200 | + (*object*, REQUIRED) An object with channel names as keys and |
| 201 | + integer credit counts as values. |
| 202 | + |
| 203 | + The server's initial response contains the full buffer size(s). |
| 204 | + |
| 205 | + These messages are suppressed if the write-credit flag was not specified. |
| 206 | + |
182 | 207 | .. object:: exec error response
|
183 | 208 |
|
184 | 209 | The :program:`exec` response stream SHALL be terminated by an error
|
@@ -219,6 +244,31 @@ This request receives no response, thus the request message SHOULD set
|
219 | 244 | FLUX_MSGFLAG_NORESPONSE. Write Requests to invalid channel names MAY be
|
220 | 245 | ignored by the subprocess server.
|
221 | 246 |
|
| 247 | +Input Flow Control |
| 248 | +------------------ |
| 249 | + |
| 250 | +A client MAY track a channel's free remote buffer space :math:`L`: |
| 251 | + |
| 252 | +- :math:`L` is initialized to zero |
| 253 | + |
| 254 | +- Each :program:`exec add-credit` response adds credits to :math:`L` |
| 255 | + |
| 256 | +- Each :program:`write` request subtracts the unencoded data length |
| 257 | + from :math:`L`. |
| 258 | + |
| 259 | +A client MAY avoid the risk of overrunning the remote buffer by ensuring |
| 260 | +a :program:`write` request never sends more than :math:`L` bytes of data. |
| 261 | + |
| 262 | +To avoid unnecessary start-up delays, a client MAY "borrow credit" up to |
| 263 | +the remote buffer size before the first :program:`exec add-credit` response. |
| 264 | +In that case :math:`L` would have a negative value until the first |
| 265 | +:program:`exec add-credit` response is received. |
| 266 | + |
| 267 | +Servers SHALL implement a default input buffer size of at least 4096 bytes. |
| 268 | +Unless the client explicitly requests a different input buffer size for the |
| 269 | +channel, it MAY assume that 4096 bytes can be borrowed before the first |
| 270 | +:program:`exec add-credit` response. |
| 271 | + |
222 | 272 | kill
|
223 | 273 | ====
|
224 | 274 |
|
@@ -338,12 +388,21 @@ exec request
|
338 | 388 | "opts": {},
|
339 | 389 | "channels": []
|
340 | 390 | },
|
341 |
| - "flags": 3 |
| 391 | + "flags": 11 |
342 | 392 | }
|
343 | 393 |
|
344 | 394 | exec responses
|
345 | 395 | --------------
|
346 | 396 |
|
| 397 | +.. code:: json |
| 398 | +
|
| 399 | + { |
| 400 | + "type": "add-credit", |
| 401 | + "channels": { |
| 402 | + "stdin": 4096 |
| 403 | + } |
| 404 | + } |
| 405 | +
|
347 | 406 | .. code:: json
|
348 | 407 |
|
349 | 408 | {
|
|
0 commit comments