[Twisted-Python] Completely new to twisted - where to get some background?
exarkun at meson.dyndns.org
Sun Oct 20 19:34:35 EDT 2002
On Sat, Oct 19, 2002 at 11:36:15PM +0100, Paul Moore wrote:
> I'm totally new to twisted - I downloaded it because I'd heard that it
> could support being an NNTP server. But I can't get my head round the
> documentation. I'm not even sure where to begin - am I a user, an
> administrator, or what?
> Basically, what I want to do is to set up an NNTP server which serves
> out the contents of a series of mbox files as newsgroups. I'm guessing
> that I need to code up some sort of "backend" code, which will fit
> into the twisted structure somewhere. But I can't find enough from the
> documentation to know where to start.
From this, I'd say that you're probably going to be a developer, an
administrator, and a user. ;)
The current NNTP code lets you use one of two different backends - a
pickle file or an RDBM (postgres is what was used to develop it). To serve
news out of mbox files, you'll need to write another backend that implements
the NewsStorage interface (twisted.news.database.NewsStorage), then hand
this to either an NNTPServerFactory or a UsenetServerFactory (probably the
former). It would be nice if 'mktap news' could handle this, but it can't
(yet), so you'll have to write a little more python to glue it all together.
twisted.tap.news.updateApplication() is definitely something you'll want to
look at. The Application Howto and the Server Howto are probably worth
You shouldn't need to write a Factory or a Protocol to do what you want,
but knowing how the pieces fit together will probably be beneficial.
Depending if you try to make "queries" to the mbox synchronous or not, the
Deferred howto might be relevant as well:
Twisted usually considers disk operations (and certainly memory
operations) fast enough to not worry about this, though, so doing what the
PickleStorage class does (defer.fail(), defer.succeed()) will probably work
> Can someone point me at some sort of "gentle introduction" to this
> sort of task? (Or alternatively, let me know if twisted is *not* the
> appropriate application for this!)
Twisted is definitely suited for this :) I'm not aware of a document that
is directly relevant to what you want to do, because it's not too deeply
related to Twisted. Hopefully what needs to be done will be clear after you
check out the code I mentioned above.
"One World, one Web, one Program." - Microsoft(R) promotional ad
"Ein Volk, ein Reich, ein Fuhrer." - Adolf Hitler
7:00pm up 152 days, 19:58, 2 users, load average: 0.14, 0.09, 0.07
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20021020/75b4afa5/attachment.pgp
More information about the Twisted-Python