[Twisted-Python] Deserializing AMP callRemoteString without knowing the Command's signature

Glyph glyph at twistedmatrix.com
Sat Jul 7 23:47:08 EDT 2012


On Jul 7, 2012, at 6:32 PM, "Eric P. Mangold" <eric at teratorn.org> wrote:

> I'm a little bit unclear on what an AMP route is, but as I understand
> it, it is basically a set of AMP Commands that are available at some
> known location - useful for segregating functionality (pre-login,
> post-login, user, admin, etc). Glyph, is that right?

It's not really the set of commands, so much as it is an identified endpoint for AMP boxes, so that you can multiplex them over a single connection.  The general idea is that you stick an extra key ("_route") into the box, and that tells it where to go on the other end of the connection, so you can easily have as many parallel AMP streams as you want with only one TCP connection.  No protocol switching if you want to do this, of course.

Of course, your peer on a particular route will have a specific set of commands available, but so will the "root" route, i.e. the thing that you are talking to when you establish a TCP connection.  (Plus, maybe you get some extra or different stuff after you authenticate.)

But your peer on a particular route might be a completely dumb IBoxReceiver without even command-dispatch logic.

You can see an implementation of this here: <http://bazaar.launchpad.net/~divmod-dev/divmod.org/trunk/view/head:/Epsilon/epsilon/amprouter.py>.  (And I could swear there's a twisted ticket to integrate this but I can't find it in a quick search.)

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120707/202600c2/attachment.htm 


More information about the Twisted-Python mailing list