Serialization made simple.
Project powered by:

ps11n: s11n support for P::Classes

Achtung: this stuff is 100% experimental

P::Classes (aka, "P") is a pretty amazing generic, cross-platform application framework implemented in C++. Think "Qt without the UI stuff." On 18 Dec 2004 we began experimenting with its i/o support, the goal being to allow for serializing over a wide range of P's supported transports. After one night's work we could de/serialize simple data over arbitrary HTTP servers, using a proxy PHP script which used a MySQL backend.

P::s11n is implemented as a "lite" s11n interface, just like s11nlite is. That is, it provides a standalone client-side interface suitable for most serialization needs. It provides a binding between the s11n core and an i/o framework. P::s11n is essentially a wrapper around s11nlite, and is thus completely compatible with it. Of course, it also works with other s11nlite-based tools like s11nconvert and s11nbrowser.

There's still lots of experimentation to do, but the implications of P's i/o support vis-a-vis s11n are pretty amazing. Consider:
std::string s11nurl = "http://s11nserver/ps11n.php?node_name=mynode";
// ^^^ the app at this URL may do whatever it likes with our data.
// e.g., it may use a Db or write to files.
P::s11n::save( myobject, s11nurl );
MyType * myobject =
P::s11n::load_serializable<MyType>( myobject, s11nurl );

P will eventually allow us to support a wide range of i/o channels, like FTP and arbitrary pipes. Pipes support will allow de/serializing from/to arbitrary stream-based applications, like ssh (which will enable remote, encrypted serialization).

This page will be developed as the ps11n add-on is fleshed out... stay tuned!
The Code:

The (highly experimental) code is in the s11n.net CVS tree, in the 'ps11n' repository. It requires checking out the 'toc' repostory (the build tools) plus s11n 0.9.17 or higher. Of course, it requires P as well (CVS version of P1.x, not 2.x).

27 Dec 2004:

We have gone ahead and forked a copy of the core s11n code into the P tree (because the core is so small). This means P2 will have s11n support built right in. :) The Serializers are bit more difficult: they require Unix tools to build and P is platform-neutral. If we can port or reimplement these P will support all formats s11nlite supports, and vice verse, even though the two will not be 100% API-compatible.

25 Dec 2004:

i am currently working with the P team to refactor P1.x to 2.x, and ps11n will go on hold until P2 is in a usable state. The P2 API is different enough from P1 that it doesn't make much sense for me to develop for P1 and P2 at the moment.
Feel free to come help us out!

21 Dec 2004:

Loading and saving over ftp are working! :)
// Serialize local objects over ftp:
~/> s11nconvert -f in.paren -o ftp://stephan:password@localhost/x.s11n \
-s pio --pio-serializer=funxml
~/> cat ~/x.s11n
<!DOCTYPE SerialTree>
<somenode class="NoClass">
// Load objects over ftp:
~/> s11nconvert -f ftp://stephan:password@localhost/x.s11n -s funtxt -S pio
#SerialTree 1
somenode class=NoClass

In theory this support works for any protocol supported by P::IOManager!!! :)

Late 19 Dec 2004:

i've gotten the psql serializer working, so we can theoretically now save to and load from any db supported by P::Classes. This requires a local hack to P, which will hopefully be integrated into upcoming P releases. It doesn't support huge data files, and might well fail completely with some data sets. It has been shown to work on node trees of up to a few hundred kilobytes (6k nodes in one case), but fail on large sets (e.g., 27k nodes). i don't yet know if the failures are purely size-related or if they are caused by formatting text within serialized data.