[Twisted-web] streaming request (was: status of Twisted Web and Web 2)

Christopher Armstrong radix at twistedmatrix.com
Thu Mar 6 11:29:56 EST 2008


On Thu, Mar 6, 2008 at 11:16 AM, Andrew McNabb <amcnabb at mcnabbs.org> wrote:
> On Thu, Mar 06, 2008 at 10:55:00AM -0500, Christopher Armstrong wrote:
>  >
>  > This is really overcomplicating things. Calling a method repeatedly
>  > with some data is a very simple and very effective and very
>  > conventional way (not a "new system!") of streaming some data to an
>  > object. This is how our protocol system works: IProtocol.dataReceived
>  > gets called every time some data comes in over the network.
>  > LineReceiver.lineReceived gets called every time a line is received.
>  > In this case, IStreamingRequestHandler.streamingDataReceived could be
>  > called. I think you should take exarkun's advice. Adding deferreds
>  > will just make it pointlessly complicated and slower than it needs to
>  > be.
>
>  I appreciate your point, and I can probably be convinced that this way
>  is better.  However, it's not obvious that calling back multiple times
>  is pointlessly complicated.  I could easily argue that having dozens of
>  interfaces like IProtocol and LineReceiver and IStreamingRequestHandler
>  and IHaveToKeepTrackOfTooManyInterfaces is also pointlessly complicated.
>
>  Just in my limited experience with Twisted, figuring out how it deals
>  with deferreds and callbacks was easy.  Figuring out how all of the
>  classes and interfaces interact was/is much more difficult.  The problem
>  is that every time you learn about a new class or interface, you have to
>  learn all of the nuances of that class.

Ok then, let's consider your approach. Let's say we have a multi-shot
deferred object. How does our application code get a reference to it?
How does the framework code get hooked up to the ultimate resource
object that wants to handle this streaming data?

The point of these questions is to indicate to you that you need to
figure out how to do this "hooking up" anyway, regardless of whether
you have a MultiDeferred, and thus a new interface (whether formalized
in terms of an Interface) must be created.


-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/



More information about the Twisted-web mailing list