[midgard-dev] Should we have a ZeroMQ API for Midgard?
henri.bergius at iki.fi
Tue Mar 1 10:39:13 CET 2011
As part of the IKS work last week we ended up writing some simple
triple synchronization stuff with NodeJS. When that needed
persistence, I obviously wanted to use Midgard, but unfortunately we
don't have that available for NodeJS yet. So I just made a crude Redis
triplestore implementation instead.
But on longer term, Midgard2 (or MidgardCR!) would provide a lot more
power and flexibility. How could we, then, make it available to
environments without GObject Introspection? This includes not only
NodeJS, but also potentially QML.
One option is of course direct bindings. NodeJS has a C++ extension
But as we have learned, maintaining bindings is quite a lot of work.
And I'm not sure if a binding can be made particularly easy to install
("Native extensions are more tricky to do this way because you need to
automate their build system." says
So, as an alternative idea: what if we had a "Midgard Server" process
that provided a ZeroMQ API? This would be accessible either locally or
even via network from quite a bunch of languages:
ZeroMQ is reasonably similar to D-Bus in concept, but is network
transparent and doesn't impose a particular transport payload. So we
could use something simple, like JSON. Here is a pretty good
introduction to the subject: http://nichol.as/zeromq-an-introduction
The "Midgard Server" could easily be sketched out in either Python or
PHP and AiP, and if performance or ease of installation later
requires, could be ported to Vala. For applications nothing would
change, as they would still be talking to a ZeroMQ endpoint.
Here is a quick sketch of how the API could look like.
Connecting to a signal:
'guid': null, // Any article object
Motorcycle Adventures and Free Software
Jabber: henri.bergius at gmail.com
More information about the dev