MB-7656 Allow passing arbitrary data to reducers

While not needed for the database reducer/rereducer functions,
this will be used for view reducer/rereducer functions as a means
to pass data between calls and extra error reporting that is too
view specific.

Change-Id: Ib2b802dc8ec4085b22d72f1d0b5f580f1dfec58f
Reviewed-on: http://review.couchbase.org/26669
Reviewed-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Rename error constant for consistency

For consistency with the other error values in the enum, add
_ERROR_ to its name so that COUCHSTORE_REDUCTION_TOO_LARGE
becomes COUCHSTORE_ERROR_REDUCTION_TOO_LARGE.

Change-Id: I6e07e903256e09749c034c66e0d3e768ce17f498
Reviewed-on: http://review.couchbase.org/26670
Reviewed-by: Fulu Li <fulu@couchbase.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Add view reducer context object declaration

This is the object used to pass extra data to view reduce
(and rereduce) functions and to allow these functions to
return extra information too to the caller, such as view
reduce specific errors and later errors from the JavaScript
engine.

Change-Id: I9da5da8cc392282353004e6a8b2f0aedc9d0186a
Reviewed-on: http://review.couchbase.org/26671
Reviewed-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-7656 Add error for generic reducer errors

While this is not used/necessary for database reduce and
rereduce functions, it will be used by view reducers to
signal very view specific domain errors. Detailed information
regarding these errors will be set in the view_reducer_ctx_t
parameter passed to the reducers via the generic ctx field
of the reduce/rereduce function prototype.

Change-Id: I6375033a4c1a661c7eecc5515523bdac817c8823
Reviewed-on: http://review.couchbase.org/26672
Reviewed-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>