Liam | 2 May 2012 22:14

Re: GSoC xapian node binding

List Admin: this list really needs a reply-to header, to prevent accidental off-list replies!

On Wed, May 2, 2012 at 12:32 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
On Wed, May 2, 2012 at 9:36 PM, Liam <xapian <at> networkimprov.net> wrote:


On Wed, May 2, 2012 at 6:32 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
Finished the design of the sync methods:  https://github.com/mtibeica/node-xapian/blob/master/docs.md
I will probably continue with the creation of a test framework and porting the tests from the Perl binding.

Can you look for other places where we can combine multiple methods into a single one with an object argument, as with Query::Query? For instance Enquire::set_sort_*

Is is possible to set multiple sort types with Enquire? The method names seem to suggest otherwise to me.
We could do a set_sort with an array of objects like {  by: 'relevance' }, { by: 'value', sort_key: uint32, reverse: 'bool'}, and if a succession of these objects is not supported (more than 2 elements, etc), to throw a not yet supported exception. 

I think an Enquire parameters object could include collapse-key, docid-order, cutoff, value, and a relevance field which can be:
  0 or undefined - value ? set_sort_by_value : noop
  1 - value ? set_sort_by_relevance_then_value : set_sort_by_relevance
  2 - value ? set_sort_by_value_then_relevance : set_sort_by_relevance

Also for testing, we'd benefit from a simple HTTP-fronted Node app to which a user can post documents and submit queries. We could pull an interesting corpus into that, e.g. Wikipedia...
 
Sure, that sounds great, but for the code writing I think that specific unit tests with predictable answers are more useful to me. The HTTP-fronted Node app looks more like a great "getting started" app, which I'll add to my todo list.

Yes, you need unit tests ported from Perl, for sure. The Node app is to test the whole system, evaluate performance, etc

Liam
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 3 May 2012 11:16
Picon
Gravatar

Re: GSoC xapian node binding

Updated Enquire to have a single set method:
set_parameters_sync( object_parameters) Set the parameters to be used for queries. The object parameter can have one or more of the following: { collapse_key: { key: uint32, max: uint32=1}, docid_order: uint32, cutoff: { percent: int32, weight: number=0 }, sort: [ sort_by_info_1, ... ] } The sort_by_info object can be: RELEVANCE - sorting by relevance { key: string, reverse: bool } - sorting by value (with reverse) string_value_key - sorting by value The valid sort arrays currently are: [ RELEVANCE ] - sort_by_relevance [ { key: string_value_key, reverse: bool } ] - sort_by_value [ string_value_key ] - sort_by_value [ { key: string_value_key, reverse: bool }, RELEVANCE ] - sort_by_value_then_relevance [ string_value_key, RELEVANCE ] - sort_by_value_then_relevance [ RELEVANCE, { key: string_value_key, reverse: bool } ] - sort_by_relevance_then_value [ RELEVANCE, string_value_key ] - sort_by_relevance_then_value
On Wed, May 2, 2012 at 11:14 PM, Liam <xapian <at> networkimprov.net> wrote:
List Admin: this list really needs a reply-to header, to prevent accidental off-list replies!

On Wed, May 2, 2012 at 12:32 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
On Wed, May 2, 2012 at 9:36 PM, Liam <xapian <at> networkimprov.net> wrote:


On Wed, May 2, 2012 at 6:32 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
Finished the design of the sync methods:  https://github.com/mtibeica/node-xapian/blob/master/docs.md
I will probably continue with the creation of a test framework and porting the tests from the Perl binding.

Can you look for other places where we can combine multiple methods into a single one with an object argument, as with Query::Query? For instance Enquire::set_sort_*

Is is possible to set multiple sort types with Enquire? The method names seem to suggest otherwise to me.
We could do a set_sort with an array of objects like {  by: 'relevance' }, { by: 'value', sort_key: uint32, reverse: 'bool'}, and if a succession of these objects is not supported (more than 2 elements, etc), to throw a not yet supported exception. 

I think an Enquire parameters object could include collapse-key, docid-order, cutoff, value, and a relevance field which can be:
  0 or undefined - value ? set_sort_by_value : noop
  1 - value ? set_sort_by_relevance_then_value : set_sort_by_relevance
  2 - value ? set_sort_by_value_then_relevance : set_sort_by_relevance

Also for testing, we'd benefit from a simple HTTP-fronted Node app to which a user can post documents and submit queries. We could pull an interesting corpus into that, e.g. Wikipedia...
 
Sure, that sounds great, but for the code writing I think that specific unit tests with predictable answers are more useful to me. The HTTP-fronted Node app looks more like a great "getting started" app, which I'll add to my todo list.

Yes, you need unit tests ported from Perl, for sure. The Node app is to test the whole system, evaluate performance, etc

Liam

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 3 May 2012 14:42
Picon
Gravatar

Re: GSoC xapian node binding

I was searching for a good testing framework and vows looks really good ( http://vowsjs.org ).

If there are no other suggestions I will use it.
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 3 May 2012 19:18

Re: GSoC xapian node binding

There has been discussion of testing frameworks on the nodejs list from time to time; see what Node folks have to say about vows and others before deciding...


On Thu, May 3, 2012 at 5:42 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
I was searching for a good testing framework and vows looks really good ( http://vowsjs.org ).
If there are no other suggestions I will use it.

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 4 May 2012 13:36
Picon
Gravatar

Re: GSoC xapian node binding

Well the favorite are vows, nodeunit and mocha.

Vows seems to work the best for async method testing, even though it is a bit more complicated. 
I also found a pretty good blog post about it ( http://dev.estisia.com/2012/02/unit-testing-node-js-applications/ ).

On Thu, May 3, 2012 at 8:18 PM, Liam <xapian <at> networkimprov.net> wrote:
There has been discussion of testing frameworks on the nodejs list from time to time; see what Node folks have to say about vows and others before deciding...


On Thu, May 3, 2012 at 5:42 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
I was searching for a good testing framework and vows looks really good ( http://vowsjs.org ).
If there are no other suggestions I will use it.

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel



_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 12 May 2012 10:00
Picon
Gravatar

Re: GSoC xapian node binding

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:
https://github.com/mtibeica/node-xapian/blob/master/xapian-enquire.cc 

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
DECLARE_POOLS(GetMset,Enquire)
- 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?
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 16 May 2012 07:55

Re: GSoC xapian node binding



On Sat, May 12, 2012 at 1:00 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
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:
https://github.com/mtibeica/node-xapian/blob/master/xapian-enquire.cc 

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
DECLARE_POOLS(GetMset,Enquire)
- 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?

Calling the files xapian-* makes me wonder if they're from the xapian codebase, so I think we can omit that filename prefix.

In the DECLARE_POOLS macro and Enquire class, you'll merge the sync & async variants as we discussed?

Those methods both have a try block, but I think only the AsyncOp ctor can throw? If so, the try block should contain just that call.

In my code GetMset_data is derived from an AsyncOp<Enquire>. Your code packages those two via the new OpInfo class. Why the change?

Did you consider how those macro functions could be templatized?

Liam
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 16 May 2012 12:30
Picon
Gravatar

Re: GSoC xapian node binding



On Wed, May 16, 2012 at 8:55 AM, Liam <xapian <at> networkimprov.net> wrote:


On Sat, May 12, 2012 at 1:00 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
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:
https://github.com/mtibeica/node-xapian/blob/master/xapian-enquire.cc 

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
DECLARE_POOLS(GetMset,Enquire)
- 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?

Calling the files xapian-* makes me wonder if they're from the xapian codebase, so I think we can omit that filename prefix.
Sure. And maybe move them to a src folder 

In the DECLARE_POOLS macro and Enquire class, you'll merge the sync & async variants as we discussed?
Yes. And later we will create a js wrapper to avoid confusion. 

Those methods both have a try block, but I think only the AsyncOp ctor can throw? If so, the try block should contain just that call.
Ok

In my code GetMset_data is derived from an AsyncOp<Enquire>. Your code packages those two via the new OpInfo class. Why the change?
Because the sync version only requires the GetMset_data (and id does not need the AsyncOp initialization). This way i can have the same GetMset_data structure for both methods.

Did you consider how those macro functions could be templatized?
Will do.
 


Liam

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 16 May 2012 19:10

Re: GSoC xapian node binding



On Wed, May 16, 2012 at 3:30 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:


On Wed, May 16, 2012 at 8:55 AM, Liam <xapian <at> networkimprov.net> wrote:


Did you consider how those macro functions could be templatized?
Will do.

Alternatively, the DECLARE_POOL methods could possibly live in a base class...
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 17 May 2012 11:38
Picon
Gravatar

Re: GSoC xapian node binding

I have tried multiple approaches. 

The difficulty comes from the fact that each class can have multiple sync/async functions. For example, Enquire has atleast get_mset, get_matching_terms and get_eset.
Another problem is that from the pool methods (which should be templatized) I have to call methods from the class (GetMset_process, GetMset_convert, GetMatchingTerm_process, ...). This means that I also probably have to pass a function as a template parameter.
The thirt problem is that func##_pool and func##_done need to be (int (eio_req *req)), so I can not pass a function pointer.

At the moment I am trying a hybrid approach (bot templates and macroes).  

On Wed, May 16, 2012 at 8:10 PM, Liam <xapian <at> networkimprov.net> wrote:


On Wed, May 16, 2012 at 3:30 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:


On Wed, May 16, 2012 at 8:55 AM, Liam <xapian <at> networkimprov.net> wrote:


Did you consider how those macro functions could be templatized?
Will do.

Alternatively, the DECLARE_POOL methods could possibly live in a base class...

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 17 May 2012 17:02

Re: GSoC xapian node binding



On Thu, May 17, 2012 at 2:38 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
I have tried multiple approaches. 
The difficulty comes from the fact that each class can have multiple sync/async functions. For example, Enquire has atleast get_mset, get_matching_terms and get_eset.
Another problem is that from the pool methods (which should be templatized) I have to call methods from the class (GetMset_process, GetMset_convert, GetMatchingTerm_process, ...). This means that I also probably have to pass a function as a template parameter.
The thirt problem is that func##_pool and func##_done need to be (int (eio_req *req)), so I can not pass a function pointer.

At the moment I am trying a hybrid approach (bot templates and macroes). 

OK, no need to bend over backwards. Simplicity is preferable after all.

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 18 May 2012 10:36
Picon
Gravatar

Re: GSoC xapian node binding

On Thu, May 17, 2012 at 6:02 PM, Liam <xapian <at> networkimprov.net> wrote:


On Thu, May 17, 2012 at 2:38 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
I have tried multiple approaches. 
The difficulty comes from the fact that each class can have multiple sync/async functions. For example, Enquire has atleast get_mset, get_matching_terms and get_eset.
Another problem is that from the pool methods (which should be templatized) I have to call methods from the class (GetMset_process, GetMset_convert, GetMatchingTerm_process, ...). This means that I also probably have to pass a function as a template parameter.
The thirt problem is that func##_pool and func##_done need to be (int (eio_req *req)), so I can not pass a function pointer.

At the moment I am trying a hybrid approach (bot templates and macroes). 

OK, no need to bend over backwards. Simplicity is preferable after all.

I tend to agree. The hybrid approach is even more complicated.

template <class dataType, class className>
class PoolHelper
{
public:
  ...
  template <Handle<Value> (*convertFunction)(className *data)>;
  static void execute_done(eio_req *data)
  {
    HandleScope scope;
    OpInfo* aInfo = (OpInfo*) req->data;
    dataType *aData = (dataType*)aInfo->data;
    AsyncOp<className> *aAsOp = (AsyncOp<className>*)aInfo->op;
    Handle<Value> argv[2];
    if (aAsOp->error) {
      argv[0] = Exception::Error(String::New(aAsOp->error->get_msg().c_str()));
    } else {
      argv[0] = Null();
      argv[1] = convertFunction(aData);
    }
    tryCallCatch(aAsOp->callback, aAsOp->object->handle_, aAsOp->error ? 1 : 2, argv);
    delete aData;
    delete aAsOp;
    delete aInfo;
  }
};


#define DECLARE_POOLS(func,classn) \
...
static int func##_done(eio_req *req) {\
  HandleScope scope;\
  PoolHelper<func##_data,classn>::execute_pool<func##_convert>(req);\
  return 0;\
}\


I will leave the macro as it is.


The question now is, what's next?
Should I start implementing other methods?




_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 23 May 2012 05:12

Re: GSoC xapian node binding



On Fri, May 18, 2012 at 1:36 AM, Marius Tibeica <mtibeica <at> gmail.com> wrote:

The question now is, what's next?
Should I start implementing other methods?

Re latest code...


Commit message format:
  [add|fix|clean]: filename method (, ...) (, filename ...) - what was added/fixed/cleaned

  add - create new functionality
  fix - repair existing functionality
  clean - no change in functionality
  If a LOT of methods are affected, the method list can be truncated to a few key ones

  No need to change the messages you've already committed.


Should we create a single node-xapian.h header file? (Which I guess could include the contents of op.h)


Code style:
   if/else and function opening brace on same line! (see op.h macro)
   local vars begin with letter a, to differentiate from function arguments


DECLARE_POOLS

  In the _do functions, perhaps the try/catch should move to the caller, which would ThrowException() and delete aData on catch? (The only throw is in AsyncOp::AsyncOp.) I'm not sure of the implications of returning ThrowException to scope.Close() -- may be harmless; something to look into. Even so, it's probably clearer to ThrowException from the caller. Also there's no need to delete x when x=new X() throws, I believe. And if _process() returns an error, you'd need to convert it to an Exception::Error and throw that  for the caller.

  Does _process() need to return a new Xapian::Error, or can it return the Error that was caught? I was doing new there previously to attach the error to the GetMset_data object. Of course then you'd need to do the new in _pool()

  The _do functions don't need a HandleScope, since the caller has one.

  Did you look at merging the two _do functions? If not mergeable, then we prob don't need _do in the names, just _sync & _async


Enquire::GetMset:

  Remove try/catch around "new GetMset_data...", which no longer throws since it's not derived from AsyncOp!
  ...
  bool aAsync = args.Length() == 3 && args[2]->IsFunction();
  if (args.Length() < 2 || args.Length() > +aAsync+2 || !args[0]->IsTypename() || ...  )
    return ThrowException(...);
  ...
  Local<Value> aResult;
  try { /// if we pull the try/catch from the _do functions
    aResult = aAsync ? GetMset_async(...) : GetMset_sync(...); /// or GetMset_do(aAsync, ...)
  } catch (Local<Value> ex) {
    return ThrowException(ex)
  }
  return scope.Close(aResult); /// it's not necessary to Close() for Undefined() but prob not harmful

Cheers,

Liam
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 23 May 2012 22:35

Re: GSoC xapian node binding



On Tue, May 22, 2012 at 8:12 PM, Liam <xapian <at> networkimprov.net> wrote:

Re latest code...

Few more notes...

In op.h, tryCallCatch, GetInstance, sendToThreadPool, kBusyMsg should be declared without static (since now used by multiple .cc files) and be defined in util.cc or similar.

In the_do functions, since they no longer ThrowException()
  if (mBusy) throw Exception::Error(...)
similar to when _process returns error

Correcting previous code snippet to use Handle<Value>:
  Handle<Value> aResult;
  try { /// if we pull the try/catch from the _do functions
    aResult = aAsync ? GetMset_async(...) : GetMset_sync(...); /// or GetMset_do(aAsync, ...)
  } catch (Handle<Value> ex) {
    ...
Local<Value> is for declaring a value in the current HandleScope. (Yes, my orig code used Local in catch.)

GetMset_convert doesn't need a HandleScope, since callers have it.

Could we put the _data ptr into AsyncOp? That should eliminate the need for OpInfo?

In your testing, make sure to trigger all the possible catch blocks. (You might have to insert throws, e.g. to simulate a Xapian error.)

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 25 May 2012 02:08

Re: GSoC xapian node binding

On Wed, May 23, 2012 at 1:35 PM, Liam <xapian <at> networkimprov.net> wrote:


On Tue, May 22, 2012 at 8:12 PM, Liam <xapian <at> networkimprov.net> wrote:

Re latest code...

Few more notes...

And a few more!

Use "that" instead of "pThis" as the name for the unwrapped args.This()

There are currently tests for mBusy in both _do_async and AsyncOp::AsyncOp. We can remove the latter, and also make AsyncOp::AsyncOp take the unwrapped object, rather than do the unwrap itself.

Use "Type aVar = value;" where possible, since we're removing try blocks that required separate "Type aVar;".

The data argument for the _do functions should be named "data" vs "aData".

Could the DECLARE_POOL methods be defined once per class if the _process & _convert functions are passed as args to the _do functions and then stored in the AsyncOp object?

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 26 May 2012 03:23

Re: GSoC xapian node binding



On Wed, May 23, 2012 at 1:35 PM, Liam <xapian <at> networkimprov.net> wrote:


On Tue, May 22, 2012 at 8:12 PM, Liam <xapian <at> networkimprov.net> wrote:

Re latest code...

Few more notes...

In op.h, tryCallCatch, GetInstance, sendToThreadPool, kBusyMsg should be declared without static (since now used by multiple .cc files) and be defined in util.cc or similar.

Actually, we can leave these function definitions in the header file; just de-static them.

If we use a single DECLARE_POOL(Class) per class, the _convert function will have to
  delete (GetMset_data*) data
since _done won't know the type to cast to.

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 26 May 2012 22:46
Picon
Gravatar

Re: GSoC xapian node binding

Thanks for all the suggestion. 

I will try to implement them as soon as I can and come back with an email about what I did.

On Sat, May 26, 2012 at 4:23 AM, Liam <xapian <at> networkimprov.net> wrote:


On Wed, May 23, 2012 at 1:35 PM, Liam <xapian <at> networkimprov.net> wrote:


On Tue, May 22, 2012 at 8:12 PM, Liam <xapian <at> networkimprov.net> wrote:

Re latest code...

Few more notes...

In op.h, tryCallCatch, GetInstance, sendToThreadPool, kBusyMsg should be declared without static (since now used by multiple .cc files) and be defined in util.cc or similar.

Actually, we can leave these function definitions in the header file; just de-static them.

If we use a single DECLARE_POOL(Class) per class, the _convert function will have to
  delete (GetMset_data*) data
since _done won't know the type to cast to.


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 28 May 2012 20:33

Re: GSoC xapian node binding



On Sat, May 26, 2012 at 1:46 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
Thanks for all the suggestion. 
I will try to implement them as soon as I can and come back with an email about what I did.

Re latest commits...

AsyncOp::AsyncOp still checks mBusy and throws; can be removed

DECLARE_POOLS
  maybe we should call it DECLARE_UTILS or similar?
  at least two function calls are missing spaces after commas!
  write var = value, not var=value
  if (error) is preferred vs if (error != NULL)
  maybe do_all should be called start or invoke?
  do_all: if (aError) Local<String> aErrorStr = String::New(aError->get_msg().c_str()); delete ...; throw ...;
  maybe we should move mBusy = true/false from AsyncOp to _all & _pool
  did you test the conditions that throw? (busy and xapian error)

binding.cc
  I think kBusyMsg = ... probably belongs in init() (you do need the definition at top of file tho)
  can remove the commented out tryCallCatch & GetInstance

enquire.cc
  GetMset() spaces around !=
  arguments error msg: "arguments are (number, number, [function])"
  _convert doesn't need if(data) before delete data

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 30 May 2012 00:24

Re: GSoC xapian node binding



On Mon, May 28, 2012 at 11:33 AM, Liam <xapian <at> networkimprov.net> wrote:


On Sat, May 26, 2012 at 1:46 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
Thanks for all the suggestion. 
I will try to implement them as soon as I can and come back with an email about what I did.

Re latest commits...

kBusyMsg = (missing spc)

AsyncOp::AsyncOp still sets mBusy
lets fire
AsyncOp::process/convert with (*asop->fn)(...) since asop->fn(...) looks like a method invocation
also lets rename function_pool/done to async_pool/done

and did you test the conditions that throw? busy & xapian::err

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Marius Tibeica | 30 May 2012 21:17
Picon
Gravatar

Re: GSoC xapian node binding

done

On Wed, May 30, 2012 at 1:24 AM, Liam <xapian <at> networkimprov.net> wrote:


On Mon, May 28, 2012 at 11:33 AM, Liam <xapian <at> networkimprov.net> wrote:


On Sat, May 26, 2012 at 1:46 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
Thanks for all the suggestion. 
I will try to implement them as soon as I can and come back with an email about what I did.

Re latest commits...

kBusyMsg = (missing spc)

AsyncOp::AsyncOp still sets mBusy
lets fire
AsyncOp::process/convert with (*asop->fn)(...) since asop->fn(...) looks like a method invocation
also lets rename function_pool/done to async_pool/done

and did you test the conditions that throw? busy & xapian::err


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 31 May 2012 08:54

Re: GSoC xapian node binding



On Wed, May 30, 2012 at 12:17 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
done

Sorry I keep finding nits!

Enquire::GetMset
  spaces: args.Length() == 3
  arguments to invoke() don't need Enquire:: prefix since we're calling from that context

Enquire::GetMset_process
  can probably move the try {} catch(Xapian::Error&) {...} to async_pool and invoke, since all the _pool methods do this
  return type becomes void

_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
Liam | 31 May 2012 21:29

Re: GSoC xapian node binding



On Wed, May 30, 2012 at 11:54 PM, Liam <xapian <at> networkimprov.net> wrote:


On Wed, May 30, 2012 at 12:17 PM, Marius Tibeica <mtibeica <at> gmail.com> wrote:
done

Sorry I keep finding nits!

invoke() should do 'that->mBusy = true', and move that line to before the 'new AsyncOp(...)'

DECLARE_UTILS can now be global templates, I think:
  template<class T>
  handle<value> invoke(...) {
    // replace classn with T
  use invoke<Enquire>(...);

We didn't consider allowing sync use of the AssembleDocument function (creates a document from a JS object spec). I'm fine leaving that async; it really shouldn't be called synchronously. But something to ponder...


_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel
James Aylett | 5 May 2012 15:47

List configuration (was re GSoC xapian node binding)

On 2 May 2012, at 21:14, Liam <xapian <at> networkimprov.net> wrote:

> List Admin: this list really needs a reply-to header, to prevent accidental off-list replies!

There are sufficient email clients that will use reply-to without prompting, causing accidental on-list
replies (potentially far more damaging and embarrassing!) that I'm opposed to doing this. That's
ignoring the 'traditional' arguments against reply-to for lists (which aren't terribly strong these days).

(Some email clients have dedicated commands and functionality for mailing lists. Sadly most don't,
leaving us in a least of multiple evils situation.)

J

Gmane