[Twisted-Python] twisted.net refactoring

Moshe Zadka moshez at zadka.site.co.il
Tue Apr 17 04:30:56 EDT 2001


On Tue, 17 Apr 2001, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:

> This is definitely the direction I want twisted.net to be going in.  Thank 
> you for implmenting it (as well as the additional protocols!).
> 
> Have you started making the requisite changes in net.py as well?

Not yet. 
I'm not *exactly* sure of the design of net.py itself -- it's a bit
too big for me to digest it right now.
Twisted.net is not the only one that needs to be changed though --
.web, .irc and .telnet should also be modified to take advantage
of it. 

I'm starting to think I want to change my original direction a bit --
just have protocols as twisted.protocols package, think of it as
a library that bridges a level mismatch in event-based protocol
handling -- that is, transforms low-level events (got chunk of
data) into semantic events (got an e-mail message). Then we can
port .net and friends over one by one when we have the chance.

IOW .net should specialize in things that call .handleData and and supply
.write, and .protocols should specialize in providing mixins that supply
.handleData and .write -- and never the twain shall meet, except in high-level
things like twisted.web or twisted.irc which use .net *and* .protocols
to provide useful services. Well, actually, the interface should be
enhanced to .goodBye() -- this is a method .net's should provide and
.protocol's use to signal the remote end requested a shutdown. Oh, 
and .welcome() which the .net's should call 

.net and .protcols should be considered seperate packages that are not
allowed to have any dependancy on any part of twisted.

So here is a summary
- .protocol -- has .welcome() and .handleData method, will call .write()
  and .goodBye() methods.
- .net -- has .write() and .goodBye() methods, will call .welcome() on
  connecting and .handleData() when the transport layer has data.

-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez at debian.org  |http://www.{python,debian,gnu}.org





More information about the Twisted-Python mailing list