Previous topic

cogen.core.proactors

Next topic

cogen.core.proactors.select_impl

This Page

Quick search

Enter search terms or a module, class or function name.

cogen.core.proactors.base

class cogen.core.proactors.base.ProactorBase(scheduler, resolution, **options)

Bases: object

Base class for a proactor implemented with posix-style polling.

add_token(act, coro, performer)
Adds a completion token act in the proactor with associated coro corutine and perform callable.
close()
handle_error_event(act, detail, exc=<class 'cogen.core.events.ConnectionError'>)
Handle an errored event. Calls the scheduler to schedule the associated coroutine.
handle_event(act)

Handle completion for a request.

Calls the scheduler to run or schedule the associated coroutine.

register_fd(act, performer)

Perform additional handling (like register the socket file descriptor in the poll, epoll, kqueue, iocp etc) when a token is added in the proactor.

Overriden in a subclass.

remove_token(act)
Remove a token from the proactor. If removal succeeds (the token is in the proactor) return True.
request_accept(act, coro)
Requests a accept for coro corutine with parameters and completion passed via act
request_connect(act, coro)
Requests a connect for coro corutine with parameters and completion passed via act
request_generic(act, coro, perform)

Requests an socket operation (in the form of a callable perform that does the actual socket system call) for coro corutine with parameters and completion passed via act.

The socket operation request parameters are passed in act. When request is completed the results will be set in act.

Note: act is usualy a SocketOperation instance and the request_foo calls are usually made from a Foo subclass.

request_recv(act, coro)
Requests a recv for coro corutine with parameters and completion passed via act
request_send(act, coro)
Requests a send for coro corutine with parameters and completion passed via act
request_sendall(act, coro)
Requests a sendall for coro corutine with parameters and completion passed via act
request_sendfile(act, coro)
Requests a sendfile for coro corutine with parameters and completion passed via act
run_act(act, func)
set_options(multiplex_first=True, **bogus_options)
Takes implementation specific options. To be overriden in a subclass.
try_run_act(act, func)
unregister_fd(act)

Perform additional handling (like cleanup) when a token is removed from the proactor.

Overriden in a subclass.

yield_event(act)
Hande completion for a request and return an (op, coro) to be passed to the scheduler on the last completion loop of a proactor.
cogen.core.proactors.base.perform_accept(act)
cogen.core.proactors.base.perform_connect(act)
cogen.core.proactors.base.perform_recv(act)
cogen.core.proactors.base.perform_send(act)
cogen.core.proactors.base.perform_sendall(act)
cogen.core.proactors.base.perform_sendfile(act)
cogen.core.proactors.base.wrapped_sendfile(act, offset, length)
Calls the sendfile system call or simulate with file read and socket send if unavailable.