asynqueue.threads.Filerator(IterationGetter)
class documentation
Part of asynqueue.threads
(View In Hierarchy)
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__ | Filerator (maxThreads=None) |
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 | Sets up stuff class-wide, with all the potential pitfalls that entails. |
Class Method | shutdown | Shuts down all threads, returning a Deferred that fires
when everything's done, class-wide. |
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 | Sets up stuff class-wide, with all the potential pitfalls that entails. |
Class Method | shutdown | Shuts down all threads, returning a Deferred that fires
when everything's done, class-wide. |
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. |
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.
This is called with a chunk of data. It goes through two stages
to emerge from my blocking end as an iteration, via next
.