a.t.Filerator(IterationGetter) : class documentation

Part of asynqueue.threads View In Hierarchy Source for threads.py Main doc for AsynQueue

Stream data to me in one end and I will iterate it out the other.

Acts like a file handle for writing in one thread (even the main one under the Twisted event loop) and an iterator in another thread. Hook me up to an iteration.Deferator to stream data over a worker interface.

You must call my close method to stop me from iterating.

Method __init__ Undocumented
Method closed Undocumented
Method loop Runs a loop in a dedicated thread that waits for new iterations to be written. When I get an instance of IterationGetter.IterationStopper, the loop exits.
Method write This is called with a chunk of data. It goes through two stages to emerge from my blocking end as an iteration, via next.
Method writelines Adds a list full of data chunks to my buffer.
Method flush Doesn't do anything, because I am always trying to flush my buffer by iterating its contents.
Method close Closing me as a "file" tells me that I can stop iterating once the buffer is flushed.

Inherited from PoolUser (via IterationGetter):

Class Method setup No summary
Class Method shutdown Undocumented
Class Method deferToThreadInPool Runs the f-args-kw call combo in one of my threads, returning a Deferred that fires with the eventual result. Can be run from the class or any instance of me with the exact same result.
Method pool Returns a reference to the class-wide threadpool, starting it if this is the first time it's been used.

Inherited from PoolUser (via IterationGetter):

Class Method setup No summary
Class Method shutdown Undocumented
Class Method deferToThreadInPool Runs the f-args-kw call combo in one of my threads, returning a Deferred that fires with the eventual result. Can be run from the class or any instance of me with the exact same result.
Method pool Returns a reference to the class-wide threadpool, starting it if this is the first time it's been used.
def __init__(self, maxThreads=None):
@property
def closed(self):
Undocumented
def loop(self):

Runs a loop in a dedicated thread that waits for new iterations to be written. When I get an instance of IterationGetter.IterationStopper, the loop exits.

def write(self, data):

This is called with a chunk of data. It goes through two stages to emerge from my blocking end as an iteration, via next.

def writelines(self, lines):

Adds a list full of data chunks to my buffer.

def flush(self):

Doesn't do anything, because I am always trying to flush my buffer by iterating its contents.

def close(self):

Closing me as a "file" tells me that I can stop iterating once the buffer is flushed.

API Documentation for AsynQueue, generated by pydoctor at 2016-11-16 14:52:11.