| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 1 | |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 2 | class AsyncRunner: |
| 3 | async def __call__(self, facade_method, *args, **kwargs): |
| 4 | await self.connection.rpc(facade_method(*args, **kwargs)) |
| 5 | |
| 6 | |
| 7 | class ThreadedRunner: |
| 8 | pass |
| 9 | |
| 10 | # Methods are descriptors?? |
| 11 | # get is called with params |
| 12 | # set gets called with the result? |
| 13 | # This could let us fake the protocol we want |
| 14 | # while decoupling the protocol from the RPC and the IO/Process context |
| 15 | |
| Adam Israel | 1a15d1c | 2017-10-23 12:00:49 -0400 | [diff] [blame] | 16 | # The problem is leaking the runtime impl details to the top levels of the API |
| 17 | # with async def By handling the Marshal/Unmarshal side of RPC as a protocol we |
| 18 | # can leave the RPC running to a specific delegate without altering the method |
| 19 | # signatures. This still isn't quite right though as async is co-op |
| 20 | # multitasking and the methods still need to know not to block or they will |
| 21 | # pause other execution |