tubes.itube.ITube(Interface)
interface documentationtubes.itube
(View In Hierarchy)
Known subclasses: tubes.itube.IDivertable
Known implementations: tubes.tube._Tubule
A tube transforms input into output.
Look at this awesome ASCII art:
a fount +----+--------+ +----- a / +---+------+ | | data flow / +---- fount a tube --->/ / | | v / / / / | | / / / / | | a drain / / a ---+ / | +----+-----+ /<--- a tube drain ----+ +------+------+ =========> direction of flow =========>
(Image credit Nam Nguyen)
Note | ITube providers
participate in data processing not in flow control. That is
to say, an ITube provider
can translate its input to output, but cannot impact the rate at which that
output is delivered. If you want to implement flow-control modifications,
implement IDrain
directly. IDrain
providers may be easily connected up to ITube providers with series , so you may implement
flow-control in an IDrain that passes on its
input unmodified and data-processing in an ITube and hook them
together. |
Attribute | inputType | The type expected to be received as input to received. |
Attribute | outputType | The type expected to be sent as output to tube.deliver . |
Method | started | The flow of items has started. received may be called at
any point after this. |
Method | received | An item was received from 'upstream', i.e. the framework, or the
lower-level data source that this ITube is interacting
with. |
Method | stopped | The flow of data from this ITube 's input has ceased;
this corresponds to IDrain.flowStopped . |
An item was received from 'upstream', i.e. the framework, or the
lower-level data source that this ITube
is interacting
with.
Returns | An iterable of values to propagate to the downstream drain attached to this
ITube . (type: iterable of ITube.outputType ) |
The flow of data from this ITube
's input has ceased;
this corresponds to IDrain.flowStopped
.
Returns | The same as ITube.received ;
values returned (or yielded) by this method will be propagated before the
IDrain.flowStopped
notification to the downstream drain. (type: same as ITube.received ) | |
Note | ITube has no
notification corresponding to IFount.stopFlow ,
since it has no control over whether additional data will be synthesized /
processed by its fount, there's no useful work it can do. |