home contents changes options help

http://www.python-in-business.org/ep2005/talk.chtml?talk=2116&track=692

Enabling bare Python as universal connector for ad-hoc networks

Theo F. de Ridder 30 minutes

Typical ad-hoc networks like P2P connected laptops or clouds of sensors will benefit from middleware with minimal impact on existing platforms and applications. GlassDict is a small (~400 LOC) module that only needs the basic Python interpretor and a few builtin modules to establish advanced publish/subscribe connections between arbitrary collections of nodes and applications. Its basic approach is reversing the classical client/server metaphor: clients are rich, powerful and selfprotecting; servers are poor, obedient and transparant.

GlassDict offers an amazingly simple and powerful architecture for playing with ad-hoc networks. It models clients and servers as networknodes with just four classes: Partner, Code, Context, and Path. Partner handles asynchronous streams of Code instances for each connection. Code pickles data-objects for arbitrary data-exchange, and marshalls code-objects for execution in server mode. A server Context hosts the global impacts of calling Code instances, a client Context hosts callback functionality for received results of calls or published impacts. Path indicates a changed value as impact in Context and is used for publish/subscribe specifications. There are some unusual characteristics of GlassDict as a server. Its Context is empty when started and dynamically and transparently updated and controlled through code compiled and sent by its clients. Its single autonomous activity is publishing impacts to subscribers. This rather restricted usage of Python facilities in the server role enables challenging opportunities for stripped-down interpretors within very small networknodes.