async.base_engine module

class pyrlang.async_support.base_engine.BaseEngine

Bases: object

This is base class for Pluggable Async Engines. This class abstracts away aspects handled by asyncio, gevent and similar event engines allowing different library to be selected.

call_later(t: float, fn)

Schedules fn to be called after sleep(t).

connect_with(protocol_class: Type[pyrlang.async_support.base_protocol.BaseProtocol], host_port: tuple, protocol_args: list, protocol_kwargs: dict)

Connects to host_port with a given BaseProtocol handler.

destroy()
listen_with(protocol_class: Type[pyrlang.async_support.base_protocol.BaseProtocol], protocol_args: list, protocol_kwargs: dict)

Spawns a task which would listen on a random port with a given BaseProtocol handler

queue_new() → pyrlang.async_support.base_engine.BaseQueue

Creates a new Queue object compatible with the current async engine.

run_forever()

Continues running event loop forever.

sleep(seconds: float)

Sleeps given amount of seconds in a nice compatible way.

socket_module()

Returns current socket module (modified to be compatible with the current async library). Used functions are: * socket.create_connection * socket.error (Exception class) * socket.gethostbyname

spawn(a_callable)

Spawns a task which will call loop_fn repeatedly while it returns False, else will stop.

class pyrlang.async_support.base_engine.BaseQueue

Bases: object

get()
is_empty()
put(v)