couchbase 3.2.0 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -18
- package/binding.gyp +88 -85
- package/deps/lcb/CMakeLists.txt +1 -1
- package/deps/lcb/CONTRIBUTING.md +1 -1
- package/deps/lcb/README.markdown +2 -2
- package/deps/lcb/RELEASE_NOTES.markdown +99 -14
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
- package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -7
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/example/CMakeLists.txt +4 -4
- package/deps/lcb/example/libuvdirect/main.c +39 -12
- package/deps/lcb/example/minimal/durability.cc +149 -0
- package/deps/lcb/example/minimal/query.c +11 -9
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
- package/deps/lcb/include/libcouchbase/couchbase.h +80 -5
- package/deps/lcb/include/libcouchbase/error.h +2 -0
- package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
- package/deps/lcb/include/libcouchbase/tracing.h +2 -2
- package/deps/lcb/include/memcached/protocol_binary.h +21 -0
- package/deps/lcb/libcouchbase.gyp +347 -349
- package/deps/lcb/packaging/deb/control +1 -1
- package/deps/lcb/src/analytics/analytics_handle.cc +13 -5
- package/deps/lcb/src/analytics/analytics_handle.hh +29 -0
- package/deps/lcb/src/bootstrap.cc +6 -3
- package/deps/lcb/src/capi/cmd_analytics.cc +12 -1
- package/deps/lcb/src/capi/cmd_analytics.hh +30 -0
- package/deps/lcb/src/capi/cmd_counter.hh +23 -0
- package/deps/lcb/src/capi/cmd_exists.hh +24 -1
- package/deps/lcb/src/capi/cmd_get.hh +22 -0
- package/deps/lcb/src/capi/cmd_get_replica.hh +23 -0
- package/deps/lcb/src/capi/cmd_http.hh +7 -0
- package/deps/lcb/src/capi/cmd_query.cc +11 -1
- package/deps/lcb/src/capi/cmd_query.hh +31 -0
- package/deps/lcb/src/capi/cmd_remove.hh +23 -0
- package/deps/lcb/src/capi/cmd_search.cc +6 -0
- package/deps/lcb/src/capi/cmd_search.hh +23 -0
- package/deps/lcb/src/capi/cmd_store.hh +33 -21
- package/deps/lcb/src/capi/cmd_subdoc.hh +35 -0
- package/deps/lcb/src/capi/cmd_touch.hh +23 -0
- package/deps/lcb/src/capi/cmd_unlock.hh +23 -0
- package/deps/lcb/src/capi/cmd_view.hh +6 -0
- package/deps/lcb/src/capi/collection_qualifier.hh +2 -2
- package/deps/lcb/src/cntl.cc +45 -11
- package/deps/lcb/src/crypto.cc +2 -2
- package/deps/lcb/src/dns-srv.cc +5 -3
- package/deps/lcb/src/errmap.cc +5 -9
- package/deps/lcb/src/errmap.h +7 -3
- package/deps/lcb/src/handler.cc +24 -18
- package/deps/lcb/src/hostlist.h +2 -2
- package/deps/lcb/src/http/http-priv.h +2 -2
- package/deps/lcb/src/http/http.cc +5 -2
- package/deps/lcb/src/instance.cc +20 -11
- package/deps/lcb/src/internal.h +9 -0
- package/deps/lcb/src/lcbio/connect.cc +14 -2
- package/deps/lcb/src/lcbio/connect.h +2 -2
- package/deps/lcb/src/lcbio/ctx.cc +4 -2
- package/deps/lcb/src/lcbio/ioutils.cc +9 -10
- package/deps/lcb/src/lcbio/manager.cc +1 -1
- package/deps/lcb/src/mcserver/mcserver.cc +9 -6
- package/deps/lcb/src/mcserver/negotiate.cc +39 -17
- package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
- package/deps/lcb/src/n1ql/query_handle.cc +41 -19
- package/deps/lcb/src/n1ql/query_handle.hh +28 -1
- package/deps/lcb/src/operations/counter.cc +18 -5
- package/deps/lcb/src/operations/exists.cc +25 -4
- package/deps/lcb/src/operations/get.cc +39 -19
- package/deps/lcb/src/operations/get_replica.cc +28 -8
- package/deps/lcb/src/operations/observe.cc +1 -1
- package/deps/lcb/src/operations/ping.cc +8 -8
- package/deps/lcb/src/operations/pktfwd.cc +2 -1
- package/deps/lcb/src/operations/remove.cc +39 -22
- package/deps/lcb/src/operations/store.cc +18 -5
- package/deps/lcb/src/operations/subdoc.cc +18 -6
- package/deps/lcb/src/operations/touch.cc +34 -16
- package/deps/lcb/src/operations/unlock.cc +24 -5
- package/deps/lcb/src/packetutils.h +3 -2
- package/deps/lcb/src/retryq.cc +24 -5
- package/deps/lcb/src/search/search.cc +1 -0
- package/deps/lcb/src/search/search_handle.cc +30 -8
- package/deps/lcb/src/search/search_handle.hh +29 -0
- package/deps/lcb/src/settings.cc +1 -1
- package/deps/lcb/src/ssl/ssl_common.c +6 -7
- package/deps/lcb/src/tracing/span.cc +47 -14
- package/deps/lcb/src/tracing/tracer.cc +11 -2
- package/deps/lcb/src/tracing/tracing-internal.h +105 -93
- package/deps/lcb/src/utilities.cc +43 -0
- package/deps/lcb/src/utilities.h +53 -0
- package/deps/lcb/src/vbucket/vbucket.c +34 -33
- package/deps/lcb/src/views/view_handle.cc +13 -5
- package/deps/lcb/src/views/view_handle.hh +29 -0
- package/deps/lcb/tests/CMakeLists.txt +21 -0
- package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
- package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
- package/deps/lcb/tests/basic/t_n1qlstrings.cc +73 -0
- package/deps/lcb/tests/iotests/mock-environment.cc +30 -1
- package/deps/lcb/tests/iotests/mock-environment.h +49 -0
- package/deps/lcb/tests/iotests/mock-unit-test.cc +104 -6
- package/deps/lcb/tests/iotests/mock-unit-test.h +34 -0
- package/deps/lcb/tests/iotests/t_collections.cc +1 -1
- package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
- package/deps/lcb/tests/iotests/t_get.cc +109 -7
- package/deps/lcb/tests/iotests/t_http.cc +9 -4
- package/deps/lcb/tests/iotests/t_lock.cc +18 -0
- package/deps/lcb/tests/iotests/t_mutate.cc +157 -63
- package/deps/lcb/tests/iotests/t_n1ql.cc +330 -33
- package/deps/lcb/tests/iotests/t_views.cc +1 -0
- package/deps/lcb/tests/iotests/testutil.cc +168 -0
- package/deps/lcb/tests/iotests/testutil.h +116 -0
- package/deps/lcb/tests/mocksupport/procutil.c +32 -28
- package/deps/lcb/tests/mocksupport/server.c +0 -1
- package/deps/lcb/tests/mocksupport/timeout.c +2 -2
- package/deps/lcb/tools/cbc.cc +7 -0
- package/dist/analyticsindexmanager.js +512 -524
- package/dist/binding.d.ts +3 -0
- package/dist/bindingutilities.js +4 -0
- package/dist/bucket.js +1 -1
- package/dist/bucketmanager.d.ts +31 -1
- package/dist/bucketmanager.js +194 -186
- package/dist/cluster.d.ts +7 -0
- package/dist/cluster.js +48 -38
- package/dist/collection.js +11 -17
- package/dist/collectionmanager.js +181 -197
- package/dist/connection.d.ts +3 -1
- package/dist/connection.js +27 -16
- package/dist/couchbase.d.ts +1 -0
- package/dist/couchbase.js +3 -13
- package/dist/datastructures.js +239 -310
- package/dist/diagnosticsexecutor.js +70 -85
- package/dist/errors.d.ts +70 -0
- package/dist/errors.js +96 -2
- package/dist/eventingfunctionmanager.d.ts +804 -0
- package/dist/eventingfunctionmanager.js +993 -0
- package/dist/httpexecutor.d.ts +2 -1
- package/dist/httpexecutor.js +30 -37
- package/dist/queryindexmanager.js +240 -266
- package/dist/scope.js +10 -4
- package/dist/sdspecs.d.ts +1 -1
- package/dist/searchexecutor.js +3 -0
- package/dist/searchindexmanager.js +240 -271
- package/dist/searchquery.d.ts +17 -0
- package/dist/searchquery.js +22 -1
- package/dist/searchtypes.d.ts +7 -2
- package/dist/searchtypes.js +2 -2
- package/dist/usermanager.js +251 -264
- package/dist/utilities.d.ts +2 -0
- package/dist/utilities.js +7 -2
- package/dist/viewexecutor.js +1 -1
- package/dist/viewindexmanager.js +131 -150
- package/package.json +1 -1
- package/src/addondata.cpp +58 -0
- package/src/addondata.h +40 -0
- package/src/binding.cpp +3 -1
- package/src/cas.h +2 -2
- package/src/connection.cpp +25 -178
- package/src/connection.h +8 -65
- package/src/connection_ops.cpp +57 -34
- package/src/constants.cpp +3 -0
- package/src/instance.cpp +235 -0
- package/src/instance.h +102 -0
- package/src/{connection_callbacks.cpp → instance_callbacks.cpp} +34 -34
- package/src/logger.cpp +11 -1
- package/src/logger.h +3 -0
- package/src/metrics.cpp +10 -0
- package/src/metrics.h +3 -0
- package/src/mutationtoken.h +2 -2
- package/src/opbuilder.h +13 -15
- package/src/respreader.cpp +1 -0
- package/src/respreader.h +6 -4
- package/src/tracespan.h +11 -11
- package/src/tracing.cpp +11 -0
- package/src/tracing.h +3 -0
- package/src/valueparser.h +5 -0
- package/deps/lcb/example/observe/durability.c +0 -110
package/src/connection.cpp
CHANGED
@@ -2,88 +2,21 @@
|
|
2
2
|
|
3
3
|
#include "error.h"
|
4
4
|
#include "logger.h"
|
5
|
-
#include "metrics.h"
|
6
|
-
#include "tracing.h"
|
7
5
|
|
8
6
|
namespace couchnode
|
9
7
|
{
|
10
8
|
|
11
|
-
Connection::Connection(
|
9
|
+
Connection::Connection(Instance *instance)
|
12
10
|
: _instance(instance)
|
13
|
-
, _logger(logger)
|
14
|
-
, _clientStringCache(nullptr)
|
15
|
-
, _bootstrapCookie(nullptr)
|
16
|
-
, _openCookie(nullptr)
|
17
11
|
{
|
18
|
-
_flushWatch = new uv_prepare_t();
|
19
|
-
uv_prepare_init(uv_default_loop(), _flushWatch);
|
20
|
-
_flushWatch->data = this;
|
21
12
|
}
|
22
13
|
|
23
14
|
Connection::~Connection()
|
24
15
|
{
|
25
|
-
if (_flushWatch) {
|
26
|
-
uv_prepare_stop(_flushWatch);
|
27
|
-
uv_close(reinterpret_cast<uv_handle_t *>(_flushWatch),
|
28
|
-
[](uv_handle_t *handle) { delete handle; });
|
29
|
-
_flushWatch = nullptr;
|
30
|
-
}
|
31
16
|
if (_instance) {
|
32
|
-
|
17
|
+
_instance->shutdown();
|
33
18
|
_instance = nullptr;
|
34
19
|
}
|
35
|
-
if (_logger) {
|
36
|
-
delete _logger;
|
37
|
-
_logger = nullptr;
|
38
|
-
}
|
39
|
-
if (_clientStringCache) {
|
40
|
-
delete[] _clientStringCache;
|
41
|
-
_clientStringCache = nullptr;
|
42
|
-
}
|
43
|
-
if (_bootstrapCookie) {
|
44
|
-
delete _bootstrapCookie;
|
45
|
-
_bootstrapCookie = nullptr;
|
46
|
-
}
|
47
|
-
if (_openCookie) {
|
48
|
-
delete _openCookie;
|
49
|
-
_openCookie = nullptr;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
const char *Connection::bucketName()
|
54
|
-
{
|
55
|
-
const char *value = nullptr;
|
56
|
-
lcb_cntl(_instance, LCB_CNTL_GET, LCB_CNTL_BUCKETNAME, &value);
|
57
|
-
return value;
|
58
|
-
}
|
59
|
-
|
60
|
-
const char *Connection::clientString()
|
61
|
-
{
|
62
|
-
// Check to see if our cache is already populated
|
63
|
-
if (_clientStringCache) {
|
64
|
-
return _clientStringCache;
|
65
|
-
}
|
66
|
-
|
67
|
-
// Fetch from libcouchbase if we have not done that yet.
|
68
|
-
const char *lcbClientString;
|
69
|
-
lcb_cntl(_instance, LCB_CNTL_GET, LCB_CNTL_CLIENT_STRING, &lcbClientString);
|
70
|
-
if (!lcbClientString) {
|
71
|
-
// Backup string in case something goes wrong
|
72
|
-
lcbClientString = "couchbase-nodejs-sdk";
|
73
|
-
}
|
74
|
-
|
75
|
-
// Copy it to memory we own.
|
76
|
-
int lcbClientStringLen = strlen(lcbClientString);
|
77
|
-
char *allocString = new char[lcbClientStringLen + 1];
|
78
|
-
memcpy(allocString, lcbClientString, lcbClientStringLen + 1);
|
79
|
-
|
80
|
-
if (_clientStringCache) {
|
81
|
-
delete[] _clientStringCache;
|
82
|
-
_clientStringCache = nullptr;
|
83
|
-
}
|
84
|
-
_clientStringCache = allocString;
|
85
|
-
|
86
|
-
return _clientStringCache;
|
87
20
|
}
|
88
21
|
|
89
22
|
NAN_MODULE_INIT(Connection::Init)
|
@@ -134,7 +67,7 @@ NAN_METHOD(Connection::fnNew)
|
|
134
67
|
lcbuv_options_t iopsOptions;
|
135
68
|
|
136
69
|
iopsOptions.version = 0;
|
137
|
-
iopsOptions.v.v0.loop =
|
70
|
+
iopsOptions.v.v0.loop = Nan::GetCurrentEventLoop();
|
138
71
|
iopsOptions.v.v0.startsop_noop = 1;
|
139
72
|
|
140
73
|
err = lcb_create_libuv_io_opts(0, &iops, &iopsOptions);
|
@@ -269,119 +202,33 @@ NAN_METHOD(Connection::fnNew)
|
|
269
202
|
return Nan::ThrowError(Error::create(err));
|
270
203
|
}
|
271
204
|
|
272
|
-
|
205
|
+
Instance *inst = new Instance(instance, logger, tracer, meter);
|
206
|
+
|
207
|
+
Connection *obj = new Connection(inst);
|
273
208
|
obj->Wrap(info.This());
|
274
209
|
|
275
|
-
|
276
|
-
lcb_set_bootstrap_callback(instance, &lcbBootstapHandler);
|
277
|
-
lcb_set_open_callback(instance, &lcbOpenHandler);
|
278
|
-
lcb_install_callback(
|
279
|
-
instance, LCB_CALLBACK_GET,
|
280
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbGetRespHandler));
|
281
|
-
lcb_install_callback(
|
282
|
-
instance, LCB_CALLBACK_EXISTS,
|
283
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbExistsRespHandler));
|
284
|
-
lcb_install_callback(
|
285
|
-
instance, LCB_CALLBACK_GETREPLICA,
|
286
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbGetReplicaRespHandler));
|
287
|
-
lcb_install_callback(
|
288
|
-
instance, LCB_CALLBACK_STORE,
|
289
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbStoreRespHandler));
|
290
|
-
lcb_install_callback(
|
291
|
-
instance, LCB_CALLBACK_COUNTER,
|
292
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbCounterRespHandler));
|
293
|
-
lcb_install_callback(
|
294
|
-
instance, LCB_CALLBACK_REMOVE,
|
295
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbRemoveRespHandler));
|
296
|
-
lcb_install_callback(
|
297
|
-
instance, LCB_CALLBACK_TOUCH,
|
298
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbTouchRespHandler));
|
299
|
-
lcb_install_callback(
|
300
|
-
instance, LCB_CALLBACK_UNLOCK,
|
301
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbUnlockRespHandler));
|
302
|
-
lcb_install_callback(
|
303
|
-
instance, LCB_CALLBACK_SDLOOKUP,
|
304
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbLookupRespHandler));
|
305
|
-
lcb_install_callback(
|
306
|
-
instance, LCB_CALLBACK_SDMUTATE,
|
307
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbMutateRespHandler));
|
308
|
-
lcb_install_callback(
|
309
|
-
instance, LCB_CALLBACK_PING,
|
310
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbPingRespHandler));
|
311
|
-
lcb_install_callback(
|
312
|
-
instance, LCB_CALLBACK_DIAG,
|
313
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbDiagRespHandler));
|
314
|
-
lcb_install_callback(
|
315
|
-
instance, LCB_CALLBACK_HTTP,
|
316
|
-
reinterpret_cast<lcb_RESPCALLBACK>(&lcbHttpDataHandler));
|
210
|
+
inst->_connection = obj;
|
317
211
|
|
318
212
|
info.GetReturnValue().Set(info.This());
|
319
213
|
}
|
320
214
|
|
321
|
-
void Connection::uvFlushHandler(uv_prepare_t *handle)
|
322
|
-
{
|
323
|
-
Connection *me = reinterpret_cast<Connection *>(handle->data);
|
324
|
-
lcb_sched_flush(me->_instance);
|
325
|
-
}
|
326
|
-
|
327
|
-
void Connection::lcbBootstapHandler(lcb_INSTANCE *instance, lcb_STATUS err)
|
328
|
-
{
|
329
|
-
Connection *me = Connection::fromInstance(instance);
|
330
|
-
|
331
|
-
if (err != 0) {
|
332
|
-
lcb_set_bootstrap_callback(instance, [](lcb_INSTANCE *, lcb_STATUS) {});
|
333
|
-
lcb_destroy_async(instance, NULL);
|
334
|
-
me->_instance = nullptr;
|
335
|
-
} else {
|
336
|
-
uv_prepare_start(me->_flushWatch, &uvFlushHandler);
|
337
|
-
|
338
|
-
int flushMode = 0;
|
339
|
-
lcb_cntl(instance, LCB_CNTL_SET, LCB_CNTL_SCHED_IMPLICIT_FLUSH,
|
340
|
-
&flushMode);
|
341
|
-
}
|
342
|
-
|
343
|
-
if (me->_bootstrapCookie) {
|
344
|
-
Nan::HandleScope scope;
|
345
|
-
|
346
|
-
Local<Value> args[] = {Error::create(err)};
|
347
|
-
me->_bootstrapCookie->Call(1, args);
|
348
|
-
|
349
|
-
delete me->_bootstrapCookie;
|
350
|
-
me->_bootstrapCookie = nullptr;
|
351
|
-
}
|
352
|
-
}
|
353
|
-
|
354
|
-
void Connection::lcbOpenHandler(lcb_INSTANCE *instance, lcb_STATUS err)
|
355
|
-
{
|
356
|
-
Connection *me = Connection::fromInstance(instance);
|
357
|
-
|
358
|
-
if (me->_openCookie) {
|
359
|
-
Nan::HandleScope scope;
|
360
|
-
|
361
|
-
Local<Value> args[] = {Error::create(err)};
|
362
|
-
me->_openCookie->Call(1, args);
|
363
|
-
|
364
|
-
delete me->_openCookie;
|
365
|
-
me->_openCookie = nullptr;
|
366
|
-
}
|
367
|
-
}
|
368
|
-
|
369
215
|
NAN_METHOD(Connection::fnConnect)
|
370
216
|
{
|
371
|
-
Connection *me =
|
217
|
+
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
218
|
+
Instance *inst = me->_instance;
|
372
219
|
Nan::HandleScope scope;
|
373
220
|
|
374
221
|
if (info.Length() != 1) {
|
375
222
|
return Nan::ThrowError(Error::create("expected 1 parameter"));
|
376
223
|
}
|
377
224
|
|
378
|
-
if (
|
379
|
-
delete
|
380
|
-
|
225
|
+
if (inst->_bootstrapCookie) {
|
226
|
+
delete inst->_bootstrapCookie;
|
227
|
+
inst->_bootstrapCookie = nullptr;
|
381
228
|
}
|
382
|
-
|
229
|
+
inst->_bootstrapCookie = new Cookie("connect", info[0].As<Function>());
|
383
230
|
|
384
|
-
lcb_STATUS ec = lcb_connect(
|
231
|
+
lcb_STATUS ec = lcb_connect(inst->_instance);
|
385
232
|
if (ec != LCB_SUCCESS) {
|
386
233
|
return Nan::ThrowError(Error::create(ec));
|
387
234
|
}
|
@@ -391,7 +238,8 @@ NAN_METHOD(Connection::fnConnect)
|
|
391
238
|
|
392
239
|
NAN_METHOD(Connection::fnSelectBucket)
|
393
240
|
{
|
394
|
-
Connection *me =
|
241
|
+
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
242
|
+
Instance *inst = me->_instance;
|
395
243
|
Nan::HandleScope scope;
|
396
244
|
|
397
245
|
if (info.Length() != 2) {
|
@@ -405,13 +253,13 @@ NAN_METHOD(Connection::fnSelectBucket)
|
|
405
253
|
|
406
254
|
Nan::Utf8String bucketName(info[0]);
|
407
255
|
|
408
|
-
if (
|
409
|
-
delete
|
410
|
-
|
256
|
+
if (inst->_openCookie) {
|
257
|
+
delete inst->_openCookie;
|
258
|
+
inst->_openCookie = nullptr;
|
411
259
|
}
|
412
|
-
|
260
|
+
inst->_openCookie = new Cookie("open", info[1].As<Function>());
|
413
261
|
|
414
|
-
lcb_STATUS ec = lcb_open(
|
262
|
+
lcb_STATUS ec = lcb_open(inst->_instance, *bucketName, bucketName.length());
|
415
263
|
if (ec != LCB_SUCCESS) {
|
416
264
|
return Nan::ThrowError(Error::create(ec));
|
417
265
|
}
|
@@ -424,10 +272,8 @@ NAN_METHOD(Connection::fnShutdown)
|
|
424
272
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
425
273
|
Nan::HandleScope scope;
|
426
274
|
|
427
|
-
uv_prepare_stop(me->_flushWatch);
|
428
|
-
|
429
275
|
if (me->_instance) {
|
430
|
-
|
276
|
+
me->_instance->shutdown();
|
431
277
|
me->_instance = nullptr;
|
432
278
|
}
|
433
279
|
|
@@ -459,6 +305,7 @@ CntlFormat getCntlFormat(int option)
|
|
459
305
|
NAN_METHOD(Connection::fnCntl)
|
460
306
|
{
|
461
307
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
308
|
+
Instance *inst = me->_instance;
|
462
309
|
Nan::HandleScope scope;
|
463
310
|
|
464
311
|
int mode = Nan::To<int>(info[0]).FromJust();
|
@@ -468,7 +315,7 @@ NAN_METHOD(Connection::fnCntl)
|
|
468
315
|
if (fmt == CntlTimeValue) {
|
469
316
|
if (mode == LCB_CNTL_GET) {
|
470
317
|
int val;
|
471
|
-
lcb_STATUS err = lcb_cntl(
|
318
|
+
lcb_STATUS err = lcb_cntl(inst->_instance, mode, option, &val);
|
472
319
|
if (err != LCB_SUCCESS) {
|
473
320
|
Nan::ThrowError(Error::create(err));
|
474
321
|
return;
|
@@ -478,7 +325,7 @@ NAN_METHOD(Connection::fnCntl)
|
|
478
325
|
return;
|
479
326
|
} else {
|
480
327
|
int val = Nan::To<int>(info[2]).FromJust();
|
481
|
-
lcb_STATUS err = lcb_cntl(
|
328
|
+
lcb_STATUS err = lcb_cntl(inst->_instance, mode, option, &val);
|
482
329
|
if (err != LCB_SUCCESS) {
|
483
330
|
Nan::ThrowError(Error::create(err));
|
484
331
|
return;
|
package/src/connection.h
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
#ifndef CONNECTION_H
|
3
3
|
#define CONNECTION_H
|
4
4
|
|
5
|
+
#include "addondata.h"
|
5
6
|
#include "cookie.h"
|
7
|
+
#include "instance.h"
|
6
8
|
#include "logger.h"
|
9
|
+
#include "metrics.h"
|
10
|
+
#include "tracing.h"
|
7
11
|
#include "valueparser.h"
|
8
12
|
|
9
13
|
#include <libcouchbase/couchbase.h>
|
@@ -23,29 +27,15 @@ public:
|
|
23
27
|
|
24
28
|
static inline Nan::Persistent<Function> &constructor()
|
25
29
|
{
|
26
|
-
|
27
|
-
return class_constructor;
|
30
|
+
return addondata::Get()->_connectionConstructor;
|
28
31
|
}
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
return _instance;
|
33
|
-
}
|
34
|
-
|
35
|
-
const char *bucketName();
|
36
|
-
const char *clientString();
|
33
|
+
Connection(Instance *instance);
|
34
|
+
~Connection();
|
37
35
|
|
38
|
-
|
39
|
-
{
|
40
|
-
void *cookie = const_cast<void *>(lcb_get_cookie(instance));
|
41
|
-
Connection *conn = reinterpret_cast<Connection *>(cookie);
|
42
|
-
return conn;
|
43
|
-
}
|
36
|
+
Instance *_instance;
|
44
37
|
|
45
38
|
private:
|
46
|
-
Connection(lcb_INSTANCE *instance, Logger *logger);
|
47
|
-
~Connection();
|
48
|
-
|
49
39
|
static NAN_METHOD(fnNew);
|
50
40
|
|
51
41
|
static NAN_METHOD(fnConnect);
|
@@ -70,53 +60,6 @@ private:
|
|
70
60
|
static NAN_METHOD(fnHttpRequest);
|
71
61
|
static NAN_METHOD(fnPing);
|
72
62
|
static NAN_METHOD(fnDiag);
|
73
|
-
|
74
|
-
static void uvFlushHandler(uv_prepare_t *handle);
|
75
|
-
static void lcbRegisterCallbacks(lcb_INSTANCE *instance);
|
76
|
-
static void lcbBootstapHandler(lcb_INSTANCE *instance, lcb_STATUS err);
|
77
|
-
static void lcbOpenHandler(lcb_INSTANCE *instance, lcb_STATUS err);
|
78
|
-
static void lcbGetRespHandler(lcb_INSTANCE *instance, int cbtype,
|
79
|
-
const lcb_RESPGET *resp);
|
80
|
-
static void lcbExistsRespHandler(lcb_INSTANCE *instance, int cbtype,
|
81
|
-
const lcb_RESPEXISTS *resp);
|
82
|
-
static void lcbGetReplicaRespHandler(lcb_INSTANCE *instance, int cbtype,
|
83
|
-
const lcb_RESPGETREPLICA *resp);
|
84
|
-
static void lcbUnlockRespHandler(lcb_INSTANCE *instance, int cbtype,
|
85
|
-
const lcb_RESPUNLOCK *resp);
|
86
|
-
static void lcbRemoveRespHandler(lcb_INSTANCE *instance, int cbtype,
|
87
|
-
const lcb_RESPREMOVE *resp);
|
88
|
-
static void lcbTouchRespHandler(lcb_INSTANCE *instance, int cbtype,
|
89
|
-
const lcb_RESPTOUCH *resp);
|
90
|
-
static void lcbStoreRespHandler(lcb_INSTANCE *instance, int cbtype,
|
91
|
-
const lcb_RESPSTORE *resp);
|
92
|
-
static void lcbCounterRespHandler(lcb_INSTANCE *instance, int cbtype,
|
93
|
-
const lcb_RESPCOUNTER *resp);
|
94
|
-
static void lcbLookupRespHandler(lcb_INSTANCE *instance, int cbtype,
|
95
|
-
const lcb_RESPSUBDOC *resp);
|
96
|
-
static void lcbMutateRespHandler(lcb_INSTANCE *instance, int cbtype,
|
97
|
-
const lcb_RESPSUBDOC *resp);
|
98
|
-
static void lcbViewDataHandler(lcb_INSTANCE *instance, int cbtype,
|
99
|
-
const lcb_RESPVIEW *resp);
|
100
|
-
static void lcbQueryDataHandler(lcb_INSTANCE *instance, int cbtype,
|
101
|
-
const lcb_RESPQUERY *resp);
|
102
|
-
static void lcbAnalyticsDataHandler(lcb_INSTANCE *instance, int cbtype,
|
103
|
-
const lcb_RESPANALYTICS *resp);
|
104
|
-
static void lcbSearchDataHandler(lcb_INSTANCE *instance, int cbtype,
|
105
|
-
const lcb_RESPSEARCH *resp);
|
106
|
-
static void lcbPingRespHandler(lcb_INSTANCE *instance, int cbtype,
|
107
|
-
const lcb_RESPPING *resp);
|
108
|
-
static void lcbDiagRespHandler(lcb_INSTANCE *instance, int cbtype,
|
109
|
-
const lcb_RESPDIAG *resp);
|
110
|
-
static void lcbHttpDataHandler(lcb_INSTANCE *instance, int cbtype,
|
111
|
-
const lcb_RESPHTTP *resp);
|
112
|
-
|
113
|
-
lcb_INSTANCE *_instance;
|
114
|
-
Logger *_logger;
|
115
|
-
uv_prepare_t *_flushWatch;
|
116
|
-
const char *_clientStringCache;
|
117
|
-
|
118
|
-
Cookie *_bootstrapCookie;
|
119
|
-
Cookie *_openCookie;
|
120
63
|
};
|
121
64
|
|
122
65
|
} // namespace couchnode
|
package/src/connection_ops.cpp
CHANGED
@@ -8,8 +8,9 @@ namespace couchnode
|
|
8
8
|
NAN_METHOD(Connection::fnGet)
|
9
9
|
{
|
10
10
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
11
|
+
Instance *inst = me->_instance;
|
11
12
|
Nan::HandleScope scope;
|
12
|
-
OpBuilder<lcb_CMDGET> enc(
|
13
|
+
OpBuilder<lcb_CMDGET> enc(inst);
|
13
14
|
|
14
15
|
if (!enc.parseParentSpan(info[6])) {
|
15
16
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -25,10 +26,12 @@ NAN_METHOD(Connection::fnGet)
|
|
25
26
|
if (!enc.parseTranscoder(info[3])) {
|
26
27
|
return Nan::ThrowError(Error::create("bad transcoder passed"));
|
27
28
|
}
|
28
|
-
if (
|
29
|
-
|
29
|
+
if (ValueParser::isSet(info[4])) {
|
30
|
+
if (!enc.parseOption<&lcb_cmdget_expiry>(info[4])) {
|
31
|
+
return Nan::ThrowError(Error::create("bad expiry passed"));
|
32
|
+
}
|
30
33
|
}
|
31
|
-
if (ValueParser::
|
34
|
+
if (ValueParser::isSet(info[5])) {
|
32
35
|
if (!enc.parseOption<&lcb_cmdget_locktime>(info[5])) {
|
33
36
|
return Nan::ThrowError(Error::create("bad locked passed"));
|
34
37
|
}
|
@@ -51,8 +54,9 @@ NAN_METHOD(Connection::fnGet)
|
|
51
54
|
NAN_METHOD(Connection::fnExists)
|
52
55
|
{
|
53
56
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
57
|
+
Instance *inst = me->_instance;
|
54
58
|
Nan::HandleScope scope;
|
55
|
-
OpBuilder<lcb_CMDEXISTS> enc(
|
59
|
+
OpBuilder<lcb_CMDEXISTS> enc(inst);
|
56
60
|
|
57
61
|
if (!enc.parseParentSpan(info[3])) {
|
58
62
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -83,12 +87,13 @@ NAN_METHOD(Connection::fnExists)
|
|
83
87
|
NAN_METHOD(Connection::fnGetReplica)
|
84
88
|
{
|
85
89
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
90
|
+
Instance *inst = me->_instance;
|
86
91
|
Nan::HandleScope scope;
|
87
92
|
|
88
93
|
lcb_REPLICA_MODE mode =
|
89
94
|
static_cast<lcb_REPLICA_MODE>(ValueParser::asUint(info[4]));
|
90
95
|
|
91
|
-
OpBuilder<lcb_CMDGETREPLICA> enc(
|
96
|
+
OpBuilder<lcb_CMDGETREPLICA> enc(inst, mode);
|
92
97
|
|
93
98
|
if (!enc.parseParentSpan(info[5])) {
|
94
99
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -122,6 +127,7 @@ NAN_METHOD(Connection::fnGetReplica)
|
|
122
127
|
NAN_METHOD(Connection::fnStore)
|
123
128
|
{
|
124
129
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
130
|
+
Instance *inst = me->_instance;
|
125
131
|
Nan::HandleScope scope;
|
126
132
|
|
127
133
|
const char *opName = "store";
|
@@ -147,7 +153,7 @@ NAN_METHOD(Connection::fnStore)
|
|
147
153
|
return Nan::ThrowError(Error::create("bad op type passed"));
|
148
154
|
}
|
149
155
|
|
150
|
-
OpBuilder<lcb_CMDSTORE> enc(
|
156
|
+
OpBuilder<lcb_CMDSTORE> enc(inst, opType);
|
151
157
|
|
152
158
|
if (!enc.parseParentSpan(info[10])) {
|
153
159
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -187,11 +193,13 @@ NAN_METHOD(Connection::fnStore)
|
|
187
193
|
return Nan::ThrowError(Error::create("bad adjoin value passed"));
|
188
194
|
}
|
189
195
|
}
|
190
|
-
if (ValueParser::
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
196
|
+
if (ValueParser::isSet(info[5])) {
|
197
|
+
if (ValueParser::asInt64(info[5]) < 0) {
|
198
|
+
lcb_cmdstore_preserve_expiry(enc.cmd(), 1);
|
199
|
+
} else {
|
200
|
+
if (!enc.parseOption<&lcb_cmdstore_expiry>(info[5])) {
|
201
|
+
return Nan::ThrowError(Error::create("bad expiry passed"));
|
202
|
+
}
|
195
203
|
}
|
196
204
|
}
|
197
205
|
if (!enc.parseCasOption<&lcb_cmdstore_cas>(info[6])) {
|
@@ -236,8 +244,9 @@ NAN_METHOD(Connection::fnStore)
|
|
236
244
|
NAN_METHOD(Connection::fnRemove)
|
237
245
|
{
|
238
246
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
247
|
+
Instance *inst = me->_instance;
|
239
248
|
Nan::HandleScope scope;
|
240
|
-
OpBuilder<lcb_CMDREMOVE> enc(
|
249
|
+
OpBuilder<lcb_CMDREMOVE> enc(inst);
|
241
250
|
|
242
251
|
if (!enc.parseParentSpan(info[7])) {
|
243
252
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -282,8 +291,9 @@ NAN_METHOD(Connection::fnRemove)
|
|
282
291
|
NAN_METHOD(Connection::fnTouch)
|
283
292
|
{
|
284
293
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
294
|
+
Instance *inst = me->_instance;
|
285
295
|
Nan::HandleScope scope;
|
286
|
-
OpBuilder<lcb_CMDTOUCH> enc(
|
296
|
+
OpBuilder<lcb_CMDTOUCH> enc(inst);
|
287
297
|
|
288
298
|
if (!enc.parseParentSpan(info[7])) {
|
289
299
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -328,8 +338,9 @@ NAN_METHOD(Connection::fnTouch)
|
|
328
338
|
NAN_METHOD(Connection::fnUnlock)
|
329
339
|
{
|
330
340
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
341
|
+
Instance *inst = me->_instance;
|
331
342
|
Nan::HandleScope scope;
|
332
|
-
OpBuilder<lcb_CMDUNLOCK> enc(
|
343
|
+
OpBuilder<lcb_CMDUNLOCK> enc(inst);
|
333
344
|
|
334
345
|
if (!enc.parseParentSpan(info[4])) {
|
335
346
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -363,8 +374,9 @@ NAN_METHOD(Connection::fnUnlock)
|
|
363
374
|
NAN_METHOD(Connection::fnCounter)
|
364
375
|
{
|
365
376
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
377
|
+
Instance *inst = me->_instance;
|
366
378
|
Nan::HandleScope scope;
|
367
|
-
OpBuilder<lcb_CMDCOUNTER> enc(
|
379
|
+
OpBuilder<lcb_CMDCOUNTER> enc(inst);
|
368
380
|
|
369
381
|
if (!enc.parseParentSpan(info[9])) {
|
370
382
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -415,8 +427,9 @@ NAN_METHOD(Connection::fnCounter)
|
|
415
427
|
NAN_METHOD(Connection::fnLookupIn)
|
416
428
|
{
|
417
429
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
430
|
+
Instance *inst = me->_instance;
|
418
431
|
Nan::HandleScope scope;
|
419
|
-
OpBuilder<lcb_CMDSUBDOC> enc(
|
432
|
+
OpBuilder<lcb_CMDSUBDOC> enc(inst);
|
420
433
|
|
421
434
|
if (!enc.parseParentSpan(info[5])) {
|
422
435
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -481,8 +494,9 @@ NAN_METHOD(Connection::fnLookupIn)
|
|
481
494
|
NAN_METHOD(Connection::fnMutateIn)
|
482
495
|
{
|
483
496
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
497
|
+
Instance *inst = me->_instance;
|
484
498
|
Nan::HandleScope scope;
|
485
|
-
OpBuilder<lcb_CMDSUBDOC> enc(
|
499
|
+
OpBuilder<lcb_CMDSUBDOC> enc(inst);
|
486
500
|
|
487
501
|
if (!enc.parseParentSpan(info[10])) {
|
488
502
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -495,11 +509,13 @@ NAN_METHOD(Connection::fnMutateIn)
|
|
495
509
|
if (!enc.parseOption<&lcb_cmdsubdoc_key>(info[2])) {
|
496
510
|
return Nan::ThrowError(Error::create("bad key passed"));
|
497
511
|
}
|
498
|
-
if (ValueParser::
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
512
|
+
if (ValueParser::isSet(info[3])) {
|
513
|
+
if (ValueParser::asInt64(info[3]) < 0) {
|
514
|
+
lcb_cmdsubdoc_preserve_expiry(enc.cmd(), 1);
|
515
|
+
} else {
|
516
|
+
if (!enc.parseOption<&lcb_cmdsubdoc_expiry>(info[3])) {
|
517
|
+
return Nan::ThrowError(Error::create("bad expiry passed"));
|
518
|
+
}
|
503
519
|
}
|
504
520
|
}
|
505
521
|
if (!enc.parseCasOption<&lcb_cmdsubdoc_cas>(info[4])) {
|
@@ -598,15 +614,16 @@ NAN_METHOD(Connection::fnMutateIn)
|
|
598
614
|
NAN_METHOD(Connection::fnViewQuery)
|
599
615
|
{
|
600
616
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
617
|
+
Instance *inst = me->_instance;
|
601
618
|
Nan::HandleScope scope;
|
602
|
-
OpBuilder<lcb_CMDVIEW> enc(
|
619
|
+
OpBuilder<lcb_CMDVIEW> enc(inst);
|
603
620
|
|
604
621
|
if (!enc.parseParentSpan(info[5])) {
|
605
622
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
606
623
|
}
|
607
624
|
enc.beginTrace(LCBTRACE_SERVICE_VIEW, "viewQuery");
|
608
625
|
|
609
|
-
lcb_cmdview_callback(enc.cmd(), &lcbViewDataHandler);
|
626
|
+
lcb_cmdview_callback(enc.cmd(), &Instance::lcbViewDataHandler);
|
610
627
|
|
611
628
|
if (!enc.parseOption<&lcb_cmdview_design_document>(info[0])) {
|
612
629
|
return Nan::ThrowError(Error::create("bad ddoc name passed"));
|
@@ -639,15 +656,16 @@ NAN_METHOD(Connection::fnViewQuery)
|
|
639
656
|
NAN_METHOD(Connection::fnQuery)
|
640
657
|
{
|
641
658
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
659
|
+
Instance *inst = me->_instance;
|
642
660
|
Nan::HandleScope scope;
|
643
|
-
OpBuilder<lcb_CMDQUERY> enc(
|
661
|
+
OpBuilder<lcb_CMDQUERY> enc(inst);
|
644
662
|
|
645
663
|
if (!enc.parseParentSpan(info[2])) {
|
646
664
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
647
665
|
}
|
648
666
|
enc.beginTrace(LCBTRACE_SERVICE_QUERY, "query");
|
649
667
|
|
650
|
-
lcb_cmdquery_callback(enc.cmd(), &lcbQueryDataHandler);
|
668
|
+
lcb_cmdquery_callback(enc.cmd(), &Instance::lcbQueryDataHandler);
|
651
669
|
|
652
670
|
if (!enc.parseOption<&lcb_cmdquery_payload>(info[0])) {
|
653
671
|
return Nan::ThrowError(Error::create("bad query passed"));
|
@@ -676,15 +694,16 @@ NAN_METHOD(Connection::fnQuery)
|
|
676
694
|
NAN_METHOD(Connection::fnAnalyticsQuery)
|
677
695
|
{
|
678
696
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
697
|
+
Instance *inst = me->_instance;
|
679
698
|
Nan::HandleScope scope;
|
680
|
-
OpBuilder<lcb_CMDANALYTICS> enc(
|
699
|
+
OpBuilder<lcb_CMDANALYTICS> enc(inst);
|
681
700
|
|
682
701
|
if (!enc.parseParentSpan(info[2])) {
|
683
702
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
684
703
|
}
|
685
704
|
enc.beginTrace(LCBTRACE_SERVICE_ANALYTICS, "analyticsQuery");
|
686
705
|
|
687
|
-
lcb_cmdanalytics_callback(enc.cmd(), &lcbAnalyticsDataHandler);
|
706
|
+
lcb_cmdanalytics_callback(enc.cmd(), &Instance::lcbAnalyticsDataHandler);
|
688
707
|
|
689
708
|
if (!enc.parseOption<&lcb_cmdanalytics_payload>(info[0])) {
|
690
709
|
return Nan::ThrowError(Error::create("bad query passed"));
|
@@ -713,15 +732,16 @@ NAN_METHOD(Connection::fnAnalyticsQuery)
|
|
713
732
|
NAN_METHOD(Connection::fnSearchQuery)
|
714
733
|
{
|
715
734
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
735
|
+
Instance *inst = me->_instance;
|
716
736
|
Nan::HandleScope scope;
|
717
|
-
OpBuilder<lcb_CMDSEARCH> enc(
|
737
|
+
OpBuilder<lcb_CMDSEARCH> enc(inst);
|
718
738
|
|
719
739
|
if (!enc.parseParentSpan(info[2])) {
|
720
740
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
721
741
|
}
|
722
742
|
enc.beginTrace(LCBTRACE_SERVICE_SEARCH, "searchQuery");
|
723
743
|
|
724
|
-
lcb_cmdsearch_callback(enc.cmd(), &lcbSearchDataHandler);
|
744
|
+
lcb_cmdsearch_callback(enc.cmd(), &Instance::lcbSearchDataHandler);
|
725
745
|
|
726
746
|
if (!enc.parseOption<&lcb_cmdsearch_payload>(info[0])) {
|
727
747
|
return Nan::ThrowError(Error::create("bad query passed"));
|
@@ -745,12 +765,13 @@ NAN_METHOD(Connection::fnSearchQuery)
|
|
745
765
|
NAN_METHOD(Connection::fnHttpRequest)
|
746
766
|
{
|
747
767
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
768
|
+
Instance *inst = me->_instance;
|
748
769
|
Nan::HandleScope scope;
|
749
770
|
|
750
771
|
lcb_HTTP_TYPE mode =
|
751
772
|
static_cast<lcb_HTTP_TYPE>(ValueParser::asUint(info[0]));
|
752
773
|
|
753
|
-
OpBuilder<lcb_CMDHTTP> enc(
|
774
|
+
OpBuilder<lcb_CMDHTTP> enc(inst, mode);
|
754
775
|
|
755
776
|
if (!enc.parseParentSpan(info[5])) {
|
756
777
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -794,9 +815,10 @@ NAN_METHOD(Connection::fnHttpRequest)
|
|
794
815
|
NAN_METHOD(Connection::fnPing)
|
795
816
|
{
|
796
817
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
818
|
+
Instance *inst = me->_instance;
|
797
819
|
Nan::HandleScope scope;
|
798
820
|
|
799
|
-
OpBuilder<lcb_CMDPING> enc(
|
821
|
+
OpBuilder<lcb_CMDPING> enc(inst);
|
800
822
|
|
801
823
|
if (!enc.parseParentSpan(info[2])) {
|
802
824
|
return Nan::ThrowError(Error::create("bad parent span passed"));
|
@@ -846,9 +868,10 @@ NAN_METHOD(Connection::fnPing)
|
|
846
868
|
NAN_METHOD(Connection::fnDiag)
|
847
869
|
{
|
848
870
|
Connection *me = ObjectWrap::Unwrap<Connection>(info.This());
|
871
|
+
Instance *inst = me->_instance;
|
849
872
|
Nan::HandleScope scope;
|
850
873
|
|
851
|
-
OpBuilder<lcb_CMDDIAG> enc(
|
874
|
+
OpBuilder<lcb_CMDDIAG> enc(inst);
|
852
875
|
|
853
876
|
if (!enc.parseOption<&lcb_cmddiag_report_id>(info[0])) {
|
854
877
|
return Nan::ThrowError(Error::create("bad report id passed"));
|