libcouchbase 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/README.md +16 -8
- data/ext/libcouchbase/CMakeLists.txt +34 -32
- data/ext/libcouchbase/RELEASE_NOTES.markdown +277 -6
- data/ext/libcouchbase/cmake/Modules/ConfigureDtrace.cmake +14 -0
- data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibevent.cmake +2 -0
- data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibuv.cmake +2 -1
- data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +2 -0
- data/ext/libcouchbase/cmake/Modules/GetLibcouchbaseFlags.cmake +8 -1
- data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +3 -3
- data/ext/libcouchbase/cmake/config-cmake.h.in +14 -0
- data/ext/libcouchbase/cmake/configure +8 -26
- data/ext/libcouchbase/cmake/defs.mk.in +2 -2
- data/ext/libcouchbase/cmake/libcouchbase.stp.in +829 -0
- data/ext/libcouchbase/cmake/source_files.cmake +11 -2
- data/ext/libcouchbase/contrib/cbsasl/CMakeLists.txt +18 -2
- data/ext/libcouchbase/contrib/cbsasl/include/cbsasl/cbsasl.h +44 -2
- data/ext/libcouchbase/contrib/cbsasl/src/client.c +285 -73
- data/ext/libcouchbase/contrib/cbsasl/src/common.c +4 -0
- data/ext/libcouchbase/contrib/cbsasl/src/scram-sha/scram_utils.c +500 -0
- data/ext/libcouchbase/contrib/cbsasl/src/scram-sha/scram_utils.h +99 -0
- data/ext/libcouchbase/contrib/cliopts/CMakeLists.txt +1 -1
- data/ext/libcouchbase/contrib/cliopts/cliopts.h +14 -1
- data/ext/libcouchbase/contrib/snappy/CMakeLists.txt +2 -3
- data/ext/libcouchbase/contrib/snappy/snappy-sinksource.cc +4 -0
- data/ext/libcouchbase/contrib/snappy/snappy-stubs-public.h +7 -5
- data/ext/libcouchbase/contrib/snappy/snappy.cc +7 -2
- data/ext/libcouchbase/example/crypto/.gitignore +2 -0
- data/ext/libcouchbase/example/crypto/Makefile +13 -0
- data/ext/libcouchbase/example/crypto/common_provider.c +24 -0
- data/ext/libcouchbase/example/crypto/common_provider.h +31 -0
- data/ext/libcouchbase/example/crypto/openssl_symmetric_decrypt.c +139 -0
- data/ext/libcouchbase/example/crypto/openssl_symmetric_encrypt.c +147 -0
- data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.c +281 -0
- data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.h +29 -0
- data/ext/libcouchbase/example/tracing/.gitignore +2 -0
- data/ext/libcouchbase/example/tracing/Makefile +8 -0
- data/ext/libcouchbase/example/tracing/cJSON.c +1 -0
- data/ext/libcouchbase/example/tracing/cJSON.h +1 -0
- data/ext/libcouchbase/example/tracing/tracing.c +439 -0
- data/ext/libcouchbase/example/tracing/views.c +444 -0
- data/ext/libcouchbase/include/libcouchbase/auth.h +56 -4
- data/ext/libcouchbase/include/libcouchbase/cbft.h +8 -0
- data/ext/libcouchbase/include/libcouchbase/cntl-private.h +55 -1
- data/ext/libcouchbase/include/libcouchbase/cntl.h +101 -1
- data/ext/libcouchbase/include/libcouchbase/configuration.h.in +6 -0
- data/ext/libcouchbase/include/libcouchbase/couchbase.h +109 -6
- data/ext/libcouchbase/include/libcouchbase/crypto.h +140 -0
- data/ext/libcouchbase/include/libcouchbase/error.h +38 -2
- data/ext/libcouchbase/include/libcouchbase/kvbuf.h +6 -1
- data/ext/libcouchbase/include/libcouchbase/metrics.h +79 -0
- data/ext/libcouchbase/include/libcouchbase/n1ql.h +9 -0
- data/ext/libcouchbase/include/libcouchbase/tracing.h +319 -0
- data/ext/libcouchbase/include/libcouchbase/vbucket.h +1 -1
- data/ext/libcouchbase/include/libcouchbase/views.h +8 -0
- data/ext/libcouchbase/include/memcached/protocol_binary.h +40 -10
- data/ext/libcouchbase/packaging/rpm/libcouchbase.spec.in +6 -14
- data/ext/libcouchbase/plugins/io/libuv/plugin-internal.h +3 -0
- data/ext/libcouchbase/plugins/io/libuv/plugin-libuv.c +1 -0
- data/ext/libcouchbase/plugins/io/select/plugin-select.c +4 -1
- data/ext/libcouchbase/src/auth-priv.h +36 -4
- data/ext/libcouchbase/src/auth.cc +66 -27
- data/ext/libcouchbase/src/bootstrap.cc +1 -1
- data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +12 -7
- data/ext/libcouchbase/src/bucketconfig/bc_http.cc +26 -17
- data/ext/libcouchbase/src/bucketconfig/bc_http.h +1 -1
- data/ext/libcouchbase/src/bucketconfig/clconfig.h +4 -2
- data/ext/libcouchbase/src/bucketconfig/confmon.cc +6 -3
- data/ext/libcouchbase/src/cbft.cc +48 -0
- data/ext/libcouchbase/src/cntl.cc +138 -2
- data/ext/libcouchbase/src/config_static.h +17 -0
- data/ext/libcouchbase/src/connspec.cc +54 -6
- data/ext/libcouchbase/src/connspec.h +9 -1
- data/ext/libcouchbase/src/crypto.cc +386 -0
- data/ext/libcouchbase/src/ctx-log-inl.h +23 -6
- data/ext/libcouchbase/src/dump.cc +4 -0
- data/ext/libcouchbase/src/getconfig.cc +1 -2
- data/ext/libcouchbase/src/handler.cc +65 -27
- data/ext/libcouchbase/src/hostlist.cc +35 -7
- data/ext/libcouchbase/src/hostlist.h +7 -0
- data/ext/libcouchbase/src/http/http-priv.h +2 -0
- data/ext/libcouchbase/src/http/http.cc +77 -37
- data/ext/libcouchbase/src/http/http_io.cc +19 -2
- data/ext/libcouchbase/src/instance.cc +90 -17
- data/ext/libcouchbase/src/internal.h +5 -0
- data/ext/libcouchbase/src/lcbio/connect.cc +39 -4
- data/ext/libcouchbase/src/lcbio/connect.h +27 -0
- data/ext/libcouchbase/src/lcbio/ctx.c +49 -23
- data/ext/libcouchbase/src/lcbio/ioutils.cc +30 -3
- data/ext/libcouchbase/src/lcbio/ioutils.h +2 -0
- data/ext/libcouchbase/src/lcbio/manager.cc +44 -8
- data/ext/libcouchbase/src/lcbio/manager.h +2 -0
- data/ext/libcouchbase/src/lcbio/rw-inl.h +1 -0
- data/ext/libcouchbase/src/lcbio/ssl.h +3 -5
- data/ext/libcouchbase/src/logging.c +1 -1
- data/ext/libcouchbase/src/logging.h +2 -0
- data/ext/libcouchbase/src/mc/compress.cc +164 -0
- data/ext/libcouchbase/src/mc/compress.h +7 -12
- data/ext/libcouchbase/src/mc/mcreq-flush-inl.h +5 -1
- data/ext/libcouchbase/src/mc/mcreq.c +11 -1
- data/ext/libcouchbase/src/mc/mcreq.h +35 -4
- data/ext/libcouchbase/src/mcserver/mcserver.cc +30 -7
- data/ext/libcouchbase/src/mcserver/mcserver.h +7 -0
- data/ext/libcouchbase/src/mcserver/negotiate.cc +103 -57
- data/ext/libcouchbase/src/mcserver/negotiate.h +2 -2
- data/ext/libcouchbase/src/mctx-helper.h +11 -0
- data/ext/libcouchbase/src/metrics.cc +132 -0
- data/ext/libcouchbase/src/n1ql/ixmgmt.cc +2 -1
- data/ext/libcouchbase/src/n1ql/n1ql.cc +66 -0
- data/ext/libcouchbase/src/newconfig.cc +9 -2
- data/ext/libcouchbase/src/operations/counter.cc +2 -1
- data/ext/libcouchbase/src/operations/durability-cas.cc +11 -0
- data/ext/libcouchbase/src/operations/durability-seqno.cc +3 -0
- data/ext/libcouchbase/src/operations/durability.cc +24 -2
- data/ext/libcouchbase/src/operations/durability_internal.h +19 -0
- data/ext/libcouchbase/src/operations/get.cc +4 -2
- data/ext/libcouchbase/src/operations/observe-seqno.cc +1 -0
- data/ext/libcouchbase/src/operations/observe.cc +113 -62
- data/ext/libcouchbase/src/operations/ping.cc +246 -67
- data/ext/libcouchbase/src/operations/remove.cc +2 -1
- data/ext/libcouchbase/src/operations/store.cc +17 -14
- data/ext/libcouchbase/src/operations/touch.cc +3 -0
- data/ext/libcouchbase/src/packetutils.h +68 -4
- data/ext/libcouchbase/src/probes.d +132 -161
- data/ext/libcouchbase/src/rdb/bigalloc.c +1 -1
- data/ext/libcouchbase/src/retryq.cc +6 -2
- data/ext/libcouchbase/src/rnd.cc +68 -0
- data/ext/libcouchbase/src/rnd.h +39 -0
- data/ext/libcouchbase/src/settings.c +27 -0
- data/ext/libcouchbase/src/settings.h +67 -3
- data/ext/libcouchbase/src/ssl/CMakeLists.txt +0 -12
- data/ext/libcouchbase/src/ssl/ssl_common.c +23 -4
- data/ext/libcouchbase/src/strcodecs/base64.c +141 -16
- data/ext/libcouchbase/src/strcodecs/strcodecs.h +16 -1
- data/ext/libcouchbase/src/trace.h +68 -61
- data/ext/libcouchbase/src/tracing/span.cc +289 -0
- data/ext/libcouchbase/src/tracing/threshold_logging_tracer.cc +171 -0
- data/ext/libcouchbase/src/tracing/tracer.cc +53 -0
- data/ext/libcouchbase/src/tracing/tracing-internal.h +213 -0
- data/ext/libcouchbase/src/utilities.c +5 -0
- data/ext/libcouchbase/src/vbucket/CMakeLists.txt +2 -2
- data/ext/libcouchbase/src/vbucket/vbucket.c +50 -18
- data/ext/libcouchbase/src/views/docreq.cc +26 -1
- data/ext/libcouchbase/src/views/docreq.h +17 -0
- data/ext/libcouchbase/src/views/viewreq.cc +64 -1
- data/ext/libcouchbase/src/views/viewreq.h +21 -0
- data/ext/libcouchbase/tests/CMakeLists.txt +6 -6
- data/ext/libcouchbase/tests/basic/t_base64.cc +34 -6
- data/ext/libcouchbase/tests/basic/t_connstr.cc +14 -0
- data/ext/libcouchbase/tests/basic/t_creds.cc +10 -10
- data/ext/libcouchbase/tests/basic/t_host.cc +22 -2
- data/ext/libcouchbase/tests/basic/t_scram.cc +514 -0
- data/ext/libcouchbase/tests/check-all.cc +6 -2
- data/ext/libcouchbase/tests/iotests/mock-environment.cc +64 -0
- data/ext/libcouchbase/tests/iotests/mock-environment.h +27 -1
- data/ext/libcouchbase/tests/iotests/t_confmon.cc +2 -2
- data/ext/libcouchbase/tests/iotests/t_forward.cc +8 -0
- data/ext/libcouchbase/tests/iotests/t_netfail.cc +124 -0
- data/ext/libcouchbase/tests/iotests/t_smoke.cc +1 -1
- data/ext/libcouchbase/tests/iotests/t_snappy.cc +316 -0
- data/ext/libcouchbase/tests/socktests/socktest.cc +2 -2
- data/ext/libcouchbase/tests/socktests/t_basic.cc +6 -6
- data/ext/libcouchbase/tests/socktests/t_manager.cc +1 -1
- data/ext/libcouchbase/tests/socktests/t_ssl.cc +1 -1
- data/ext/libcouchbase/tools/CMakeLists.txt +1 -1
- data/ext/libcouchbase/tools/cbc-handlers.h +17 -0
- data/ext/libcouchbase/tools/cbc-n1qlback.cc +7 -4
- data/ext/libcouchbase/tools/cbc-pillowfight.cc +408 -100
- data/ext/libcouchbase/tools/cbc-proxy.cc +134 -3
- data/ext/libcouchbase/tools/cbc-subdoc.cc +1 -2
- data/ext/libcouchbase/tools/cbc.cc +113 -8
- data/ext/libcouchbase/tools/common/histogram.cc +1 -0
- data/ext/libcouchbase/tools/common/options.cc +28 -1
- data/ext/libcouchbase/tools/common/options.h +5 -0
- data/ext/libcouchbase/tools/docgen/docgen.h +36 -10
- data/ext/libcouchbase/tools/docgen/loc.h +5 -4
- data/ext/libcouchbase/tools/docgen/seqgen.h +28 -0
- data/lib/libcouchbase/ext/libcouchbase/enums.rb +10 -0
- data/lib/libcouchbase/n1ql.rb +6 -1
- data/lib/libcouchbase/version.rb +1 -1
- data/spec/connection_spec.rb +6 -6
- metadata +38 -5
- data/ext/libcouchbase/cmake/Modules/FindCouchbaseSnappy.cmake +0 -11
- data/ext/libcouchbase/src/mc/compress.c +0 -90
- data/ext/libcouchbase/tools/common/my_inttypes.h +0 -22
|
@@ -49,7 +49,8 @@ lcb_remove3(lcb_t instance, const void *cookie, const lcb_CMDREMOVE * cmd)
|
|
|
49
49
|
pkt->u_rdata.reqdata.cookie = cookie;
|
|
50
50
|
pkt->u_rdata.reqdata.start = gethrtime();
|
|
51
51
|
memcpy(SPAN_BUFFER(&pkt->kh_span), hdr.bytes, sizeof(hdr.bytes));
|
|
52
|
-
|
|
52
|
+
LCBTRACE_KV_START(instance->settings, cmd, LCBTRACE_OP_REMOVE, pkt->opaque, pkt->u_rdata.reqdata.span);
|
|
53
|
+
TRACE_REMOVE_BEGIN(instance, &hdr, cmd);
|
|
53
54
|
LCB_SCHED_ADD(instance, pl, pkt);
|
|
54
55
|
return LCB_SUCCESS;
|
|
55
56
|
}
|
|
@@ -73,6 +73,15 @@ handle_dur_storecb(mc_PIPELINE *, mc_PACKET *pkt,
|
|
|
73
73
|
goto GT_BAIL;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
#ifdef LCB_TRACING
|
|
77
|
+
{
|
|
78
|
+
lcbtrace_SPAN *span = MCREQ_PKT_RDATA(pkt)->span;
|
|
79
|
+
if (span) {
|
|
80
|
+
mctx->setspan(mctx, span);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
#endif
|
|
84
|
+
|
|
76
85
|
lcbdurctx_set_durstore(mctx, 1);
|
|
77
86
|
err = mctx->addcmd(mctx, (lcb_CMDBASE*)&dcmd);
|
|
78
87
|
if (err != LCB_SUCCESS) {
|
|
@@ -149,19 +158,11 @@ get_esize_and_opcode(
|
|
|
149
158
|
|
|
150
159
|
|
|
151
160
|
static int
|
|
152
|
-
can_compress(lcb_t instance, const mc_PIPELINE *pipeline,
|
|
153
|
-
const lcb_VALBUF *vbuf, lcb_datatype_t datatype)
|
|
161
|
+
can_compress(lcb_t instance, const mc_PIPELINE *pipeline, lcb_datatype_t datatype)
|
|
154
162
|
{
|
|
155
163
|
const lcb::Server *server = static_cast<const lcb::Server*>(pipeline);
|
|
156
164
|
int compressopts = LCBT_SETTING(instance, compressopts);
|
|
157
165
|
|
|
158
|
-
if (mcreq_compression_supported() == 0) {
|
|
159
|
-
return 0;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (vbuf->vtype != LCB_KV_COPY) {
|
|
163
|
-
return 0;
|
|
164
|
-
}
|
|
165
166
|
if ((compressopts & LCB_COMPRESS_OUT) == 0) {
|
|
166
167
|
return 0;
|
|
167
168
|
}
|
|
@@ -243,9 +244,9 @@ do_store3(lcb_t instance, const void *cookie,
|
|
|
243
244
|
return err;
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
should_compress = can_compress(instance, pipeline,
|
|
247
|
+
should_compress = can_compress(instance, pipeline, datatype);
|
|
247
248
|
if (should_compress) {
|
|
248
|
-
int rv = mcreq_compress_value(pipeline, packet,
|
|
249
|
+
int rv = mcreq_compress_value(pipeline, packet, vbuf, instance->settings, &should_compress);
|
|
249
250
|
if (rv != 0) {
|
|
250
251
|
mcreq_release_packet(pipeline, packet);
|
|
251
252
|
return LCB_CLIENT_ENOMEM;
|
|
@@ -260,7 +261,7 @@ do_store3(lcb_t instance, const void *cookie,
|
|
|
260
261
|
const lcb_CMDSTOREDUR *dcmd = (const lcb_CMDSTOREDUR *)cmd;
|
|
261
262
|
persist_u = dcmd->persist_to;
|
|
262
263
|
replicate_u = dcmd->replicate_to;
|
|
263
|
-
if (dcmd->replicate_to == -1 || dcmd->persist_to == -1) {
|
|
264
|
+
if (dcmd->replicate_to == (char)-1 || dcmd->persist_to == (char)-1) {
|
|
264
265
|
duropts = LCB_DURABILITY_VALIDATE_CAPMAX;
|
|
265
266
|
}
|
|
266
267
|
|
|
@@ -290,7 +291,8 @@ do_store3(lcb_t instance, const void *cookie,
|
|
|
290
291
|
if (should_compress || (datatype & LCB_VALUE_F_SNAPPYCOMP)) {
|
|
291
292
|
hdr->request.datatype |= PROTOCOL_BINARY_DATATYPE_COMPRESSED;
|
|
292
293
|
}
|
|
293
|
-
|
|
294
|
+
|
|
295
|
+
if ((datatype & LCB_VALUE_F_JSON) && static_cast<const lcb::Server*>(pipeline)->supports_json()) {
|
|
294
296
|
hdr->request.datatype |= PROTOCOL_BINARY_DATATYPE_JSON;
|
|
295
297
|
}
|
|
296
298
|
|
|
@@ -301,7 +303,8 @@ do_store3(lcb_t instance, const void *cookie,
|
|
|
301
303
|
|
|
302
304
|
memcpy(SPAN_BUFFER(&packet->kh_span), scmd.bytes, hsize);
|
|
303
305
|
LCB_SCHED_ADD(instance, pipeline, packet);
|
|
304
|
-
|
|
306
|
+
LCBTRACE_KV_START(instance->settings, cmd, LCBTRACE_OP_STORE2NAME(operation), packet->opaque, MCREQ_PKT_RDATA(packet)->span);
|
|
307
|
+
TRACE_STORE_BEGIN(instance, hdr, (lcb_CMDSTORE *)cmd);
|
|
305
308
|
return LCB_SUCCESS;
|
|
306
309
|
}
|
|
307
310
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
#include "internal.h"
|
|
19
|
+
#include "trace.h"
|
|
19
20
|
|
|
20
21
|
LIBCOUCHBASE_API
|
|
21
22
|
lcb_error_t
|
|
@@ -48,6 +49,8 @@ lcb_touch3(lcb_t instance, const void *cookie, const lcb_CMDTOUCH *cmd)
|
|
|
48
49
|
pkt->u_rdata.reqdata.cookie = cookie;
|
|
49
50
|
pkt->u_rdata.reqdata.start = gethrtime();
|
|
50
51
|
LCB_SCHED_ADD(instance, pl, pkt);
|
|
52
|
+
LCBTRACE_KV_START(instance->settings, cmd, LCBTRACE_OP_TOUCH, pkt->opaque, pkt->u_rdata.reqdata.span);
|
|
53
|
+
TRACE_TOUCH_BEGIN(instance, hdr, cmd);
|
|
51
54
|
return LCB_SUCCESS;
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
typedef struct packet_info_st packet_info;
|
|
29
29
|
#else
|
|
30
30
|
#include "contrib/lcb-jsoncpp/lcb-jsoncpp.h"
|
|
31
|
+
#include <math.h>
|
|
31
32
|
namespace lcb {
|
|
32
33
|
class Server;
|
|
33
34
|
|
|
@@ -124,18 +125,66 @@ public:
|
|
|
124
125
|
return res.response.datatype;
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
#define FRAMING_EXTRAS_TRACING 0x00
|
|
129
|
+
#if defined(_MSC_VER)
|
|
130
|
+
#define __lcb_round(d) ((d) > 0.0) ? ((d) + 0.5) : ((d) - 0.5)
|
|
131
|
+
#else
|
|
132
|
+
#define __lcb_round(d) round(d)
|
|
133
|
+
#endif
|
|
134
|
+
|
|
135
|
+
uint64_t duration() const {
|
|
136
|
+
if (ffextlen() == 0) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const char *end, *ptr;
|
|
141
|
+
ptr = ffext();
|
|
142
|
+
end = ptr + ffextlen();
|
|
143
|
+
|
|
144
|
+
for (; ptr < end;) {
|
|
145
|
+
uint8_t control = *ptr;
|
|
146
|
+
uint8_t id = control & 0xF0;
|
|
147
|
+
uint8_t len = control & 0x0F;
|
|
148
|
+
ptr++;
|
|
149
|
+
if (id == FRAMING_EXTRAS_TRACING && len == sizeof(uint16_t)) {
|
|
150
|
+
uint16_t encoded;
|
|
151
|
+
memcpy(&encoded, ptr, sizeof(uint16_t));
|
|
152
|
+
encoded = ntohs(encoded);
|
|
153
|
+
return (uint64_t)__lcb_round(pow(encoded, 1.74) / 2);
|
|
154
|
+
}
|
|
155
|
+
ptr += len;
|
|
156
|
+
}
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#undef __lcb_round
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Gets a pointer starting at the packet's flexible framing ext field
|
|
164
|
+
*/
|
|
165
|
+
const char *ffext() const {
|
|
166
|
+
return body<const char*>();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Gets a pointer starting at the packet's ext field.
|
|
171
|
+
*/
|
|
172
|
+
const char *ext() const {
|
|
173
|
+
return body<const char*>() + ffextlen();
|
|
174
|
+
}
|
|
175
|
+
|
|
127
176
|
/**
|
|
128
177
|
* Gets a pointer starting at the packet's key field. Only use if NKEY is 0
|
|
129
178
|
*/
|
|
130
179
|
const char *key() const {
|
|
131
|
-
return body<const char*>() + extlen();
|
|
180
|
+
return body<const char*>() + extlen() + ffextlen();
|
|
132
181
|
}
|
|
133
182
|
|
|
134
183
|
/**
|
|
135
184
|
* Gets a pointer starting at the packet's value field. Only use if NVALUE is 0
|
|
136
185
|
*/
|
|
137
186
|
const char *value() const {
|
|
138
|
-
return body<const char*>() + keylen() + extlen();
|
|
187
|
+
return body<const char*>() + keylen() + extlen() + ffextlen();
|
|
139
188
|
}
|
|
140
189
|
|
|
141
190
|
/**
|
|
@@ -143,7 +192,7 @@ public:
|
|
|
143
192
|
* which is after the key (if applicable) and extras (if applicable).
|
|
144
193
|
*/
|
|
145
194
|
uint32_t vallen() const {
|
|
146
|
-
return bodylen() - (keylen() + extlen());
|
|
195
|
+
return bodylen() - (keylen() + extlen() + ffextlen());
|
|
147
196
|
}
|
|
148
197
|
|
|
149
198
|
|
|
@@ -183,7 +232,11 @@ public:
|
|
|
183
232
|
* Gets the key size, if included in the packet.
|
|
184
233
|
*/
|
|
185
234
|
uint16_t keylen() const {
|
|
186
|
-
|
|
235
|
+
if (res.response.magic == PROTOCOL_BINARY_ARES) {
|
|
236
|
+
return (res.response.keylen >> 8) & 0xff;
|
|
237
|
+
} else {
|
|
238
|
+
return ntohs(res.response.keylen);
|
|
239
|
+
}
|
|
187
240
|
}
|
|
188
241
|
|
|
189
242
|
/**
|
|
@@ -193,6 +246,17 @@ public:
|
|
|
193
246
|
return (res.response.extlen);
|
|
194
247
|
}
|
|
195
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Gets flexible framing extras length
|
|
251
|
+
*/
|
|
252
|
+
uint8_t ffextlen() const {
|
|
253
|
+
if (res.response.magic == PROTOCOL_BINARY_ARES) {
|
|
254
|
+
return res.response.keylen & 0xff;
|
|
255
|
+
} else {
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
196
260
|
/**
|
|
197
261
|
* Gets the raw unconverted 'opaque' 32 bit field
|
|
198
262
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2012 Couchbase, Inc.
|
|
3
|
+
* Copyright 2012-2017 Couchbase, Inc.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,158 +15,112 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
provider libcouchbase
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
provider libcouchbase
|
|
19
|
+
{
|
|
20
|
+
probe get_begin(void *, /* lcb_t */
|
|
21
|
+
uint32_t, /* opaque */
|
|
22
|
+
uint16_t, /* vbucket */
|
|
23
|
+
uint8_t, /* opcode (get, gat, getl) */
|
|
24
|
+
const char *, /* key */
|
|
25
|
+
size_t, /* nkey */
|
|
26
|
+
uint32_t); /* expiration */
|
|
27
|
+
probe get_end(void *, /* lcb_t */
|
|
28
|
+
uint32_t, /* opaque */
|
|
29
|
+
uint8_t, /* opcode (get, gat, getl) */
|
|
30
|
+
uint64_t, /* latency, ns */
|
|
31
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
32
|
+
const char *, /* key */
|
|
33
|
+
size_t, /* nkey */
|
|
34
|
+
const char *, /* bytes */
|
|
35
|
+
size_t, /* nbytes */
|
|
36
|
+
uint32_t, /* flags */
|
|
37
|
+
uint64_t, /* cas */
|
|
38
|
+
uint8_t); /* datatype */
|
|
36
39
|
|
|
37
|
-
probe unlock_begin(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
probe unlock_begin(void *, /* lcb_t */
|
|
41
|
+
uint32_t, /* opaque */
|
|
42
|
+
uint16_t, /* vbucket */
|
|
43
|
+
uint8_t, /* opcode */
|
|
44
|
+
const char *, /* key */
|
|
45
|
+
size_t); /* nkey */
|
|
46
|
+
probe unlock_end(void *, /* lcb_t */
|
|
47
|
+
uint32_t, /* opaque */
|
|
48
|
+
uint8_t, /* opcode */
|
|
49
|
+
uint64_t, /* latency, ns */
|
|
50
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
51
|
+
const char *, /* key */
|
|
52
|
+
size_t); /* nkey */
|
|
48
53
|
|
|
49
|
-
probe store_begin(
|
|
54
|
+
probe store_begin(void *, /* lcb_t */
|
|
55
|
+
uint32_t, /* opaque */
|
|
50
56
|
uint16_t, /* vbucket */
|
|
51
57
|
uint8_t, /* opcode (set, add, replace, append, prepend) */
|
|
52
|
-
const char*,
|
|
58
|
+
const char *, /* key */
|
|
53
59
|
size_t, /* nkey */
|
|
54
|
-
const char*,
|
|
60
|
+
const char *, /* bytes */
|
|
55
61
|
size_t, /* nbytes */
|
|
56
62
|
uint32_t, /* flags */
|
|
57
63
|
uint64_t, /* cas */
|
|
58
64
|
uint8_t, /* datatype */
|
|
59
65
|
uint32_t); /* expiration */
|
|
60
|
-
probe store_end(
|
|
61
|
-
|
|
66
|
+
probe store_end(void *, /* lcb_t */
|
|
67
|
+
uint32_t, /* opaque */
|
|
62
68
|
uint8_t, /* opcode (set, add, replace, append, prepend) */
|
|
69
|
+
uint64_t, /* latency, ns */
|
|
63
70
|
uint16_t, /* return code (from libcouchbase) */
|
|
64
|
-
const char*,
|
|
71
|
+
const char *, /* key */
|
|
65
72
|
size_t, /* nkey */
|
|
66
73
|
uint64_t); /* cas */
|
|
67
74
|
|
|
68
|
-
probe arithmetic_begin(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
uint64_t,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
uint16_t, /* vbucket */
|
|
87
|
-
uint8_t, /* opcode */
|
|
88
|
-
const char*, /* key */
|
|
89
|
-
size_t, /* nkey */
|
|
90
|
-
uint32_t); /* expiration */
|
|
91
|
-
probe touch_end(uint32_t, /* opaque */
|
|
92
|
-
uint16_t, /* vbucket */
|
|
93
|
-
uint8_t, /* opcode */
|
|
94
|
-
uint16_t, /* return code (from libcouchbase) */
|
|
95
|
-
const char*, /* key */
|
|
96
|
-
size_t, /* nkey */
|
|
97
|
-
uint64_t); /* cas */
|
|
98
|
-
|
|
99
|
-
probe remove_begin(uint32_t, /* opaque */
|
|
100
|
-
uint16_t, /* vbucket */
|
|
101
|
-
uint8_t, /* opcode */
|
|
102
|
-
const char*, /* key */
|
|
103
|
-
size_t); /* nkey */
|
|
104
|
-
probe remove_end(uint32_t, /* opaque */
|
|
105
|
-
uint16_t, /* vbucket */
|
|
106
|
-
uint8_t, /* opcode */
|
|
107
|
-
uint16_t, /* return code (from libcouchbase) */
|
|
108
|
-
const char*, /* key */
|
|
109
|
-
size_t, /* nkey */
|
|
110
|
-
uint64_t); /* cas */
|
|
75
|
+
probe arithmetic_begin(void *, /* lcb_t */
|
|
76
|
+
uint32_t, /* opaque */
|
|
77
|
+
uint16_t, /* vbucket */
|
|
78
|
+
uint8_t, /* opcode (increment, decrement) */
|
|
79
|
+
const char *, /* key */
|
|
80
|
+
size_t, /* nkey */
|
|
81
|
+
uint64_t, /* delta */
|
|
82
|
+
uint64_t, /* initial */
|
|
83
|
+
uint32_t); /* expiration */
|
|
84
|
+
probe arithmetic_end(void *, /* lcb_t */
|
|
85
|
+
uint32_t, /* opaque */
|
|
86
|
+
uint8_t, /* opcode (increment, decrement) */
|
|
87
|
+
uint64_t, /* latency, ns */
|
|
88
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
89
|
+
const char *, /* key */
|
|
90
|
+
size_t, /* nkey */
|
|
91
|
+
uint64_t, /* value */
|
|
92
|
+
uint64_t); /* cas */
|
|
111
93
|
|
|
112
|
-
probe
|
|
113
|
-
|
|
114
|
-
uint8_t, /* opcode */
|
|
115
|
-
const char*); /* server_endpoint */
|
|
116
|
-
probe flush_progress(uint32_t, /* opaque */
|
|
117
|
-
uint16_t, /* vbucket */
|
|
118
|
-
uint8_t, /* opcode */
|
|
119
|
-
uint16_t, /* return code (from libcouchbase) */
|
|
120
|
-
const char*); /* server_endpoint */
|
|
121
|
-
probe flush_end(uint32_t, /* opaque */
|
|
122
|
-
uint16_t, /* vbucket */
|
|
123
|
-
uint8_t, /* opcode */
|
|
124
|
-
uint16_t); /* return code (from libcouchbase) */
|
|
125
|
-
|
|
126
|
-
probe versions_begin(uint32_t, /* opaque */
|
|
127
|
-
uint16_t, /* vbucket */
|
|
128
|
-
uint8_t, /* opcode */
|
|
129
|
-
const char*); /* server_endpoint */
|
|
130
|
-
probe versions_progress(uint32_t, /* opaque */
|
|
131
|
-
uint16_t, /* vbucket */
|
|
132
|
-
uint8_t, /* opcode */
|
|
133
|
-
uint16_t, /* return code (from libcouchbase) */
|
|
134
|
-
const char*); /* server_endpoint */
|
|
135
|
-
probe versions_end(uint32_t, /* opaque */
|
|
136
|
-
uint16_t, /* vbucket */
|
|
137
|
-
uint8_t, /* opcode */
|
|
138
|
-
uint16_t); /* return code (from libcouchbase) */
|
|
139
|
-
|
|
140
|
-
probe stats_begin(uint32_t, /* opaque */
|
|
94
|
+
probe touch_begin(void *, /* lcb_t */
|
|
95
|
+
uint32_t, /* opaque */
|
|
141
96
|
uint16_t, /* vbucket */
|
|
142
97
|
uint8_t, /* opcode */
|
|
143
|
-
const char*,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
probe
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
size_t); /* nbytes */
|
|
155
|
-
probe stats_end(uint32_t, /* opaque */
|
|
156
|
-
uint16_t, /* vbucket */
|
|
157
|
-
uint8_t, /* opcode */
|
|
158
|
-
uint16_t); /* return code (from libcouchbase) */
|
|
98
|
+
const char *, /* key */
|
|
99
|
+
size_t, /* nkey */
|
|
100
|
+
uint32_t); /* expiration */
|
|
101
|
+
probe touch_end(void *, /* lcb_t */
|
|
102
|
+
uint32_t, /* opaque */
|
|
103
|
+
uint8_t, /* opcode */
|
|
104
|
+
uint64_t, /* latency, ns */
|
|
105
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
106
|
+
const char *, /* key */
|
|
107
|
+
size_t, /* nkey */
|
|
108
|
+
uint64_t); /* cas */
|
|
159
109
|
|
|
160
|
-
probe
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
110
|
+
probe remove_begin(void *, /* lcb_t */
|
|
111
|
+
uint32_t, /* opaque */
|
|
112
|
+
uint16_t, /* vbucket */
|
|
113
|
+
uint8_t, /* opcode */
|
|
114
|
+
const char *, /* key */
|
|
115
|
+
size_t); /* nkey */
|
|
116
|
+
probe remove_end(void *, /* lcb_t */
|
|
117
|
+
uint32_t, /* opaque */
|
|
118
|
+
uint8_t, /* opcode */
|
|
119
|
+
uint64_t, /* latency, ns */
|
|
120
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
121
|
+
const char *, /* key */
|
|
122
|
+
size_t, /* nkey */
|
|
123
|
+
uint64_t); /* cas */
|
|
170
124
|
|
|
171
125
|
/*
|
|
172
126
|
* OBSERVE_BEGIN probe intended to be parsed in the handler.
|
|
@@ -178,34 +132,51 @@ provider libcouchbase {
|
|
|
178
132
|
* | vbucket | nkey | key | ...
|
|
179
133
|
* +---------+---------+------------+----
|
|
180
134
|
*/
|
|
181
|
-
probe observe_begin(
|
|
182
|
-
|
|
183
|
-
uint8_t,
|
|
184
|
-
const char*, /* bytes */
|
|
185
|
-
size_t);
|
|
186
|
-
probe observe_progress(
|
|
187
|
-
|
|
188
|
-
uint8_t,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
uint8_t,
|
|
195
|
-
|
|
196
|
-
uint32_t
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
135
|
+
probe observe_begin(void *, /* lcb_t */
|
|
136
|
+
uint32_t, /* opaque */
|
|
137
|
+
uint8_t, /* opcode */
|
|
138
|
+
const char *, /* bytes */
|
|
139
|
+
size_t); /* nbytes */
|
|
140
|
+
probe observe_progress(void *, /* lcb_t */
|
|
141
|
+
uint32_t, /* opaque */
|
|
142
|
+
uint8_t, /* opcode */
|
|
143
|
+
uint64_t, /* latency, ns */
|
|
144
|
+
uint16_t, /* return code (from libcouchbase) */
|
|
145
|
+
const char *, /* key */
|
|
146
|
+
size_t, /* nkey */
|
|
147
|
+
uint64_t, /* cas */
|
|
148
|
+
uint8_t, /* observe status: FOUND = 0x00, PERSISTED = 0x01, NOT_FOUND = 0x80 */
|
|
149
|
+
uint8_t, /* master (zero if from replica) */
|
|
150
|
+
uint32_t, /* ttp, time to persist */
|
|
151
|
+
uint32_t); /* ttr, time to replicate */
|
|
152
|
+
probe observe_end(void *, /* lcb_t */
|
|
153
|
+
uint32_t, /* opaque */
|
|
154
|
+
uint8_t, /* opcode */
|
|
155
|
+
uint64_t, /* latency, ns */
|
|
156
|
+
uint16_t); /* return code (from libcouchbase) */
|
|
201
157
|
|
|
202
|
-
probe http_begin(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
158
|
+
probe http_begin(void *, /* lcb_t */
|
|
159
|
+
void *, /* pointer to request */
|
|
160
|
+
uint16_t, /* type */
|
|
161
|
+
uint16_t, /* method */
|
|
162
|
+
const char *, /* url */
|
|
163
|
+
const char *, /* host */
|
|
164
|
+
const char *); /* port */
|
|
165
|
+
probe http_end(void *, /* lcb */
|
|
166
|
+
void *, /* pointer to request */
|
|
167
|
+
uint16_t, /* type */
|
|
168
|
+
uint16_t, /* method */
|
|
169
|
+
const char *, /* url */
|
|
170
|
+
const char *, /* host */
|
|
171
|
+
const char *, /* port */
|
|
208
172
|
uint16_t, /* return code (from libcouchbase) */
|
|
209
|
-
uint16_t
|
|
173
|
+
uint16_t, /* HTTP status code or zero */
|
|
174
|
+
uint64_t); /* latency, ns */
|
|
210
175
|
|
|
176
|
+
probe new_config(void *, /* lcb_t */
|
|
177
|
+
int32_t, /* revid */
|
|
178
|
+
const char*, /* bucket name */
|
|
179
|
+
const char*, /* bucket UUID */
|
|
180
|
+
const void* /* pointer to config */
|
|
181
|
+
);
|
|
211
182
|
};
|