[Python-ideas] The async API of the future: Reactors

Antoine Pitrou solipsis at pitrou.net
Mon Oct 15 17:54:11 CEST 2012


On Mon, 15 Oct 2012 14:11:07 +0100
Richard Oudkerk <shibturn at gmail.com>
wrote:
> 
> One could use IOCP or select/poll/... to implement an API which looks like
> 
> class AsyncHub:
>      def read(self, fd, nbytes):
>          """Return future which is ready when read is complete"""
> 
>      def write(self, fd, buf):
>          """Return future which is ready when write is complete"""
> 
>      def accept(self, fd):
>          """Return future which is ready when connection is accepted"""
> 
>      def connect(self, fd, address):
>          """Return future which is ready when connection has succeeded"""
> 
>      def wait(self, timeout=None):
>          """Wait till a future is ready; return list of ready futures"""
> 
> A reactor could then be built on top of such a hub.

I suppose the reactor would handle higher-level stuff such as TLS?

Regards

Antoine.





More information about the Python-ideas mailing list