[Xapian-devel] GSoC xapian node binding

Marius Tibeica mtibeica at gmail.com
Sat May 12 09:00:00 BST 2012

I have designed a way to provide both sync and async variants from the same
code for a nodejs binding.

The code can be found at:

Every method which has both sync and async has to have the following C++
methods (GetMset as an example):
struct GetMset_data { ... }
-  the data which will be passed
static Handle<Value> GetMset(const Arguments& args);
-  parse the sync method parameters and create the GetMset_data object.
static Handle<Value> GetMsetSync(const Arguments& args);
- parse the async method parameters and create the GetMset_data object.
static Xapian::Error* GetMset_process(GetMset_data *data, Enquire *pThis);
- the actual data processing (which will happen either on the thread pool
or on the main thread depending on the called method).
static Handle<Value> GetMset_convert(GetMset_data *data);
- converts the GetMset_data into a JS object which will be either returned
or sent as a parameter in a callback
- macro which creates other helping methods

Another advantage is that the libeio code is isolated in xapian-op.h, so
porting to node 0.6+ will be easier.
Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20120512/6acb590e/attachment-0001.htm>

More information about the Xapian-devel mailing list