tubes.protocol
module documentationtubes
Objects to connect real
data
to tubes
.
See Also | flowFountFromEndpoint |
Function | flowFountFromEndpoint | Listen on the given endpoint, and thereby create a fount which outputs a new
Flow for each
connection. |
Function | flowFromEndpoint | Convert a client endpoint into a Deferred
that fires with a Flow . |
Class | _FountProducer | A _FountProducer
is an adapter to IPushProducer
for an IFount . |
Class | _TransportDrain | A _TransportDrain
is an IDrain that wraps
around an object that provides ITransport
and IConsumer ,
and delivers data to that transport, and flow-control notifications from
the consumer. |
Class | _TransportFount | An IFount that wraps
around an ITransport ,
and, with the help of a _ProtocolPlumbing ,
delivers any data received by that ITransport
to an IDrain . |
Class | _ProtocolPlumbing | An adapter between an ITransport
and IFount / IDrain interfaces. |
Function | _factoryFromFlow | Convert a flow function into an IProtocolFactory . |
Class | _FountImpl | Implementation of fount for listening port. |
Convert a flow function into an IProtocolFactory
.
A "flow function" is a function which takes a fount
and an drain
.
_factoryFromFlow
takes such a function and creates an IProtocolFactory
which, upon each new connection, provides the flow function with an IFount
and an IDrain
representing the
read end and the write end of the incoming connection, respectively.
Parameters | flow | a 2-argument callable, taking (fount, drain). (type: callable ) |
Returns | a protocol factory. (type: IProtocolFactory ) |
Listen on the given endpoint, and thereby create a fount
which outputs a new
Flow
for each
connection.
Parameters | endpoint | a server endpoint. (type: IStreamServerEndpoint ) |
Returns | a twisted.internet.defer.Deferred
that fires with a IFount
whose outputType is Flow . | |
Note | IStreamServerEndpoint
formally specifies that its connect method returns a Deferred
that fires with an IListeningPort .
However, IListeningPort
is insufficient to express the requisite flow-control to implement a fount;
so the endpoint parameter must be an extended endpoint whose
listen Deferred
fires with a provider of both IListeningPort
and IPushProducer .
Luckily, the real-world implementations of IListeningPort
within Twisted are all IPushProducer s
as well, so practically speaking you will not notice this, but for testing
it is important to know this is necessary. |