[Twisted-web] streaming request (was: status of Twisted Web and
Web 2)
Christopher Armstrong
radix at twistedmatrix.com
Thu Mar 6 10:55:00 EST 2008
On Thu, Mar 6, 2008 at 10:46 AM, Andrew McNabb <amcnabb at mcnabbs.org> wrote:
> On Thu, Mar 06, 2008 at 10:28:26AM -0500, Jean-Paul Calderone wrote:
>
> > This... I don't understand. A callback is just an object which is callable,
> > often with some arguments. I would generally use the word "callback" to
> > describe what `someMoreRequestDataReceived´ is. Why do you think it doesn't
> > qualify, and what do you mean when you say "callback"?
>
> Sorry about the confusion (callback as noun vs. callback as verb). When
> I said callback, I meant the verb:
>
> some_deferred.callback(some_value)
>
> I want to go through the normal callback/errback mechanism rather than
> creating a brand new system to do the same thing. Ideally we'd be able
> to callback a single deferred multiple times (maybe it would be a
> "MultiDeferred" rather than "Deferred"). This way you wouldn't have to
> call addCallback over and over.
>
> Does that make my point more clear?
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.
--
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
More information about the Twisted-web
mailing list