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 startStreaming This should be called by the consumer when the producer is registered.
Method stopStreaming This should be called by the consumer when the producer is unregistered.
Method pauseProducing Pause producing data.
Method resumeProducing Resume producing data.
Method stopProducing Stop producing data.
Instance Variable _producer the underling non-streaming producer.
Instance Variable _consumer the consumer with which the underlying producer was registered.
Instance Variable _finished bool indicating whether the producer has finished.
Instance Variable _coopTask the result of calling cooperate, the task driving the streaming producer.
Method _pull A generator that calls resumeProducing on the underlying producer forever.
_producer =
the underling non-streaming producer.
_consumer =
the consumer with which the underlying producer was registered.
_finished =
bool indicating whether the producer has finished.
_coopTask =
the result of calling cooperate, the task driving the streaming producer.
def __init__(self, pullProducer, consumer): (source)
Undocumented
def _pull(self): (source)

A generator that calls resumeProducing on the underlying producer forever.

If resumeProducing throws an exception, the producer is unregistered, which should result in streaming stopping.

def startStreaming(self): (source)

This should be called by the consumer when the producer is registered.

Start streaming data to the consumer.

def stopStreaming(self): (source)

This should be called by the consumer when the producer is unregistered.

Stop streaming data to the consumer.

def pauseProducing(self): (source)

Pause producing data.

Tells a producer that it has produced too much data to process for the time being, and to stop until resumeProducing() is called.

def resumeProducing(self): (source)

Resume producing data.

This tells a producer to re-add itself to the main loop and produce more data for its consumer.

def stopProducing(self): (source)

Stop producing data.

This tells a producer that its consumer has died, so it must stop producing data for good.

API Documentation for Twisted, generated by pydoctor at 2016-04-04 15:02:49.