class _PullToPush: (source)
Implements interfaces: twisted.internet.interfaces.IPushProducer
An adapter that converts a non-streaming to a streaming producer.
Because of limitations of the producer API, this adapter requires the cooperation of the consumer. When the consumer's registerProducer is called with a non-streaming producer, it must wrap it with _PullToPush
and then call startStreaming on the resulting object. When the consumer's unregisterProducer is called, it must call stopStreaming on the _PullToPush
instance.
If the underlying producer throws an exception from resumeProducing, the producer will be unregistered from the consumer.
Method | __init__ |
Undocumented |
Method | pauseProducing |
|
Method | resumeProducing |
|
Method | startStreaming |
This should be called by the consumer when the producer is registered. |
Method | stopProducing |
|
Method | stopStreaming |
This should be called by the consumer when the producer is unregistered. |
Method | _pull |
A generator that calls resumeProducing on the underlying producer forever. |
Instance Variable | _consumer |
the consumer with which the underlying producer was registered. |
Instance Variable | _coopTask |
the result of calling cooperate , the task driving the streaming producer. |
Instance Variable | _finished |
bool indicating whether the producer has finished. |
Instance Variable | _producer |
the underling non-streaming producer. |
This should be called by the consumer when the producer is registered.
Start streaming data to the consumer.
This should be called by the consumer when the producer is unregistered.
Stop streaming data to the consumer.