| 214 | // undefined is returned, indicating the caller should await the promise to serialize writes |
| 215 | // (no overlapping). |
| 216 | stream(path: PropertyPath, args: RpcPayload): {promise: Promise<void>, size?: number} { |
| 217 | // Default implementation: delegate to call() + pull(). No size is returned, so the caller |
| 218 | // knows this is a local call and should await the promise directly. |
| 219 | let hook = this.call(path, args); |
| 220 | let pulled = hook.pull(); |
| 221 | let promise: Promise<void>; |
| 222 | if (pulled instanceof Promise) { |
| 223 | promise = pulled.then(p => { p.dispose(); }); |
| 224 | } else { |
| 225 | pulled.dispose(); |
| 226 | promise = Promise.resolve(); |
| 227 | } |
| 228 | return { promise }; |
| 229 | } |
| 230 | |
| 231 | // Apply a map operation. |
| 232 | // |