| Trees | Indices | Help |
|
|---|
|
|
This module provides a means for service models and client programs to co-operate with the main dispatch loop. A default dispatch loop is provided by iterate. The api is defined by IDispatchTarget, IDispatchContext and the the semantics of the before_dispatch and after_dispatch callbacks as ilustrated in the referece iterate function.
iterate may be used directly or as a reference for integrating with foreign main loops.
The dispatch api and the facilities of asycamore.tcpsocket can be used to implement useful client and server programs independently of the servicemodel api (asycamore.servicemodel)
Examples include:
asycamore.bench.http_processing - client programs for stress testing serversasycamore.sclients advanced multiprocess utility to simulate extremely high
server load.See asycamore.tcpsocket for the basic primitives necessary for implementing the dispatch targets that form the bridge between the dispatch api and the service model api.
iterate and any compatible implementation is required to support these
callbacks. They provide the necessary hooks for service models and clients to
implement there runtime behaviour. Either callback may be None. The loop
control values, along with any others provided by the caller of iterate are
passed to the each callback as the dispatchvars parameter. The values include
the callbacks them selves and, additionally, count, timeout, and
error_in_handler. iterate will honour any changes made to these values.
For example, changing or disabling the callbacks. Other than meeting its
obligations to keep them updated iterate ignores the values timeout and
error_in_handler and simply forwards them as the corresponding arguments to
IDispatchContext.dispatch_once
Note that either callback may cause loop termination after N further dispatches
by doing dispatchvars['count'] = N. And, immediate termination by simply
raising StopIteration.
| Classes | |
|
IDispatchContext The bridge between a service model and the IO dispatch loop. |
|
|
IDispatchTarget The minimal state for any asycamore.dispatch.IDispatchContext target |
|
| Functions | |||
|
|||
| Function Details |
A suitable main loop for service models and clients Iteratively calls the IDispatchContext.dispatch_once method provided by
the dispatcher parameter, interleaving each call between calls to
If
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Tue May 8 00:56:10 2007 | http://epydoc.sourceforge.net |