txeffect package¶
Module contents¶
Twisted integration for the Effect library.
This is largely concerned with bridging the gap between Effects and Deferreds, and also implementing Twisted-specific performers for standard Intents.
The most important functions here are perform()
,
make_twisted_dispatcher()
, and deferred_performer()
.
Note that the core effect library does not depend on Twisted, but this module does.
-
txeffect.
deferred_performer
(f)¶ A decorator for performers that return Deferreds.
The function being decorated is expected to take a dispatcher and an intent (and not a box), and may return a Deferred. The wrapper function that this decorator returns will accept a dispatcher, an intent, and a box (conforming to the performer interface). The wrapper deals with putting the Deferred’s result into the box.
Example:
@deferred_performer def perform_foo(dispatcher, foo): return do_side_effecting_deferred_operation(foo)
-
txeffect.
deferred_to_box
(d, box)¶ Make a Deferred pass its success or fail events on to the given box.
-
txeffect.
exc_info_to_failure
(exc_info)¶ Convert an exc_info tuple to a
Failure
.
-
txeffect.
make_twisted_dispatcher
(reactor)¶ Create a dispatcher that knows how to perform certain built-in Intents with Twisted-specific implementations.
-
txeffect.
perform
(dispatcher, effect)¶ Perform an effect, returning a Deferred that will fire with the effect’s ultimate result.
-
txeffect.
perform_delay
(reactor, dispatcher, delay)¶ - Perform a
effect.Delay
with Twisted’s twisted.internet.task.deferLater()
.
- Perform a