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