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
|
@@ -513,7 +513,37 @@ typedef enum {
|
|
|
513
513
|
X(LCB_NAMESERVER_ERROR, 0x53, LCB_ERRTYPE_NETWORK, \
|
|
514
514
|
"Invalid reply received from nameserver") \
|
|
515
515
|
X(LCB_NOT_AUTHORIZED, 0x54, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN, \
|
|
516
|
-
"Not authorized for operation")
|
|
516
|
+
"Not authorized for operation") \
|
|
517
|
+
X(LCB_SUBDOC_INVALID_COMBO, 0x55, \
|
|
518
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
519
|
+
"An invalid combination of commands was specified") \
|
|
520
|
+
X(LCB_SUBDOC_MULTI_PATH_FAILURE, 0x56, \
|
|
521
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
522
|
+
"Specified key was successfully found, but one or more path operations failed") \
|
|
523
|
+
X(LCB_SUBDOC_SUCCESS_DELETED, 0x57, \
|
|
524
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
525
|
+
"The operation completed successfully, but operated on a deleted document") \
|
|
526
|
+
X(LCB_SUBDOC_XATTR_INVALID_FLAG_COMBO, 0x58, \
|
|
527
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
528
|
+
"The combination of the subdoc flags for the xattrs is not valid") \
|
|
529
|
+
X(LCB_SUBDOC_XATTR_INVALID_KEY_COMBO, 0x59, \
|
|
530
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
531
|
+
"Only a single xattr key may be accessed at the same time") \
|
|
532
|
+
X(LCB_SUBDOC_XATTR_UNKNOWN_MACRO, 0x5a, \
|
|
533
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
534
|
+
"The server has no knowledge of the requested macro") \
|
|
535
|
+
X(LCB_SUBDOC_XATTR_UNKNOWN_VATTR, 0x5b, \
|
|
536
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
537
|
+
"The server has no knowledge of the requested virtual xattr") \
|
|
538
|
+
X(LCB_SUBDOC_XATTR_CANT_MODIFY_VATTR, 0x5c, \
|
|
539
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
540
|
+
"Virtual xattrs cannot be modified") \
|
|
541
|
+
X(LCB_SUBDOC_MULTI_PATH_FAILURE_DELETED, 0x5d, \
|
|
542
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
543
|
+
"Specified key was found as a deleted document, but one or more path operations failed") \
|
|
544
|
+
X(LCB_SUBDOC_INVALID_XATTR_ORDER, 0x5e, \
|
|
545
|
+
LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
|
|
546
|
+
"According to the spec all xattr commands should come first, followed by the commands for the document body")
|
|
517
547
|
|
|
518
548
|
/** Error codes returned by the library. */
|
|
519
549
|
typedef enum {
|
|
@@ -584,10 +614,16 @@ const char *lcb_strerror(lcb_t instance, lcb_error_t error);
|
|
|
584
614
|
LCB_INTERNAL_API
|
|
585
615
|
const char *lcb_strerror_short(lcb_error_t error);
|
|
586
616
|
|
|
617
|
+
/**
|
|
618
|
+
* Get a longer textual description of an error message.
|
|
619
|
+
*/
|
|
620
|
+
LCB_INTERNAL_API
|
|
621
|
+
const char *lcb_strerror_long(lcb_error_t error);
|
|
622
|
+
|
|
587
623
|
/**
|
|
588
624
|
* This may be used in conjunction with the errmap callback if it wishes
|
|
589
625
|
* to fallback for default behavior for the given code.
|
|
590
|
-
* @
|
|
626
|
+
* @uncommitted
|
|
591
627
|
*/
|
|
592
628
|
LIBCOUCHBASE_API
|
|
593
629
|
lcb_error_t lcb_errmap_default(lcb_t instance, lcb_U16 code);
|
|
@@ -43,7 +43,12 @@ typedef enum {
|
|
|
43
43
|
* The buffers are not contiguous (multi-part buffers) but should be
|
|
44
44
|
* copied. This avoids having to make the buffers contiguous before
|
|
45
45
|
* passing it into the library (only to have the library copy it again) */
|
|
46
|
-
LCB_KV_IOVCOPY
|
|
46
|
+
LCB_KV_IOVCOPY,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* For use within the hashkey field, indicates that the _pointer to bytes_
|
|
50
|
+
* of the hashkey is the tracing span, rather than an actual hashkey */
|
|
51
|
+
LCB_KV_TRACESPAN
|
|
47
52
|
} lcb_KVBUFTYPE;
|
|
48
53
|
|
|
49
54
|
#define LCB_KV_HEADER_AND_KEY LCB_KV_CONTIG
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2017 Couchbase, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#ifndef LCB_METRICS_H
|
|
19
|
+
#define LCB_METRICS_H
|
|
20
|
+
|
|
21
|
+
#ifdef __cplusplus
|
|
22
|
+
extern "C" {
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
struct lcb_METRICS_st;
|
|
26
|
+
|
|
27
|
+
typedef struct lcb_IOMETRICS_st {
|
|
28
|
+
const char *hostport;
|
|
29
|
+
lcb_SIZE io_close;
|
|
30
|
+
lcb_SIZE io_error;
|
|
31
|
+
lcb_SIZE bytes_sent;
|
|
32
|
+
lcb_SIZE bytes_received;
|
|
33
|
+
} lcb_IOMETRICS;
|
|
34
|
+
|
|
35
|
+
typedef struct lcb_SERVERMETRICS_st {
|
|
36
|
+
/** IO Metrics for the underlying socket */
|
|
37
|
+
lcb_IOMETRICS iometrics;
|
|
38
|
+
|
|
39
|
+
/** Number of packets sent on this server */
|
|
40
|
+
lcb_SIZE packets_sent;
|
|
41
|
+
|
|
42
|
+
/** Number of packets read on this server */
|
|
43
|
+
lcb_SIZE packets_read;
|
|
44
|
+
|
|
45
|
+
/** Total number of packets placed in send queue */
|
|
46
|
+
lcb_SIZE packets_queued;
|
|
47
|
+
|
|
48
|
+
/** Total number of bytes placed in send queue */
|
|
49
|
+
lcb_SIZE bytes_queued;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Number of packets which failed on this server (i.e. as a result
|
|
53
|
+
* of a timeout/network error or similar)
|
|
54
|
+
*/
|
|
55
|
+
lcb_SIZE packets_errored;
|
|
56
|
+
|
|
57
|
+
/** Number of packets which timed out. Subset of packets_errored */
|
|
58
|
+
lcb_SIZE packets_timeout;
|
|
59
|
+
|
|
60
|
+
/** Number of packets received which were timed out or otherwise cancelled */
|
|
61
|
+
lcb_SIZE packets_ownerless;
|
|
62
|
+
|
|
63
|
+
/** Number of NOT_MY_VBUCKET replies received */
|
|
64
|
+
lcb_SIZE packets_nmv;
|
|
65
|
+
} lcb_SERVERMETRICS;
|
|
66
|
+
|
|
67
|
+
typedef struct lcb_METRICS_st {
|
|
68
|
+
lcb_SIZE nservers;
|
|
69
|
+
const lcb_SERVERMETRICS **servers;
|
|
70
|
+
|
|
71
|
+
/** Number of times a packet entered the retry queue */
|
|
72
|
+
lcb_SIZE packets_retried;
|
|
73
|
+
} lcb_METRICS;
|
|
74
|
+
|
|
75
|
+
#ifdef __cplusplus
|
|
76
|
+
}
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#endif
|
|
@@ -446,6 +446,15 @@ lcb_n1ql_query(lcb_t instance, const void *cookie, const lcb_CMDN1QL *cmd);
|
|
|
446
446
|
LIBCOUCHBASE_API
|
|
447
447
|
void
|
|
448
448
|
lcb_n1ql_cancel(lcb_t instance, lcb_N1QLHANDLE handle);
|
|
449
|
+
|
|
450
|
+
#ifdef LCB_TRACING
|
|
451
|
+
/**
|
|
452
|
+
* @uncommitted
|
|
453
|
+
*/
|
|
454
|
+
LIBCOUCHBASE_API
|
|
455
|
+
void lcb_n1ql_set_parent_span(lcb_t instance, lcb_N1QLHANDLE handle, lcbtrace_SPAN *span);
|
|
456
|
+
#endif
|
|
457
|
+
|
|
449
458
|
/**@}*/
|
|
450
459
|
|
|
451
460
|
/**@}*/
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2018 Couchbase, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !defined(LCB_TRACING_H) && defined(LCB_TRACING)
|
|
19
|
+
#define LCB_TRACING_H
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @file
|
|
23
|
+
* End to end tracing
|
|
24
|
+
*
|
|
25
|
+
* @uncommitted
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
namespace lcb
|
|
30
|
+
{
|
|
31
|
+
namespace trace
|
|
32
|
+
{
|
|
33
|
+
class Span;
|
|
34
|
+
class Tracer;
|
|
35
|
+
} // namespace trace
|
|
36
|
+
} // namespace lcb
|
|
37
|
+
typedef lcb::trace::Span lcbtrace_SPAN;
|
|
38
|
+
extern "C" {
|
|
39
|
+
#else /* C only! */
|
|
40
|
+
typedef struct lcbtrace_SPAN_Cdummy lcbtrace_SPAN;
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#define LCBTRACE_F_THRESHOLD 0x01
|
|
44
|
+
|
|
45
|
+
struct lcbtrace_TRACER;
|
|
46
|
+
typedef struct lcbtrace_TRACER {
|
|
47
|
+
lcb_U16 version;
|
|
48
|
+
lcb_U64 flags;
|
|
49
|
+
void *cookie;
|
|
50
|
+
void (*destructor)(struct lcbtrace_TRACER *tracer);
|
|
51
|
+
union {
|
|
52
|
+
struct {
|
|
53
|
+
void (*report)(struct lcbtrace_TRACER *tracer, lcbtrace_SPAN *span);
|
|
54
|
+
} v0;
|
|
55
|
+
} v;
|
|
56
|
+
} lcbtrace_TRACER;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @uncommitted
|
|
60
|
+
* @return tracer
|
|
61
|
+
*/
|
|
62
|
+
LIBCOUCHBASE_API lcbtrace_TRACER *lcb_get_tracer(lcb_t instance);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @uncommitted
|
|
66
|
+
* @return tracer
|
|
67
|
+
*/
|
|
68
|
+
LIBCOUCHBASE_API void lcb_set_tracer(lcb_t instance, lcbtrace_TRACER *tracer);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @uncommitted
|
|
72
|
+
*/
|
|
73
|
+
LIBCOUCHBASE_API lcbtrace_TRACER *lcbtrace_new(lcb_t instance, lcb_U64 flags);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @uncommitted
|
|
77
|
+
*/
|
|
78
|
+
LIBCOUCHBASE_API void lcbtrace_destroy(lcbtrace_TRACER *tracer);
|
|
79
|
+
|
|
80
|
+
typedef enum {
|
|
81
|
+
LCBTRACE_REF_NONE = 0,
|
|
82
|
+
LCBTRACE_REF_CHILD_OF = 1,
|
|
83
|
+
LCBTRACE_REF_FOLLOWS_FROM,
|
|
84
|
+
LCBTRACE_REF__MAX
|
|
85
|
+
} lcbtrace_REF_TYPE;
|
|
86
|
+
|
|
87
|
+
typedef struct {
|
|
88
|
+
lcbtrace_REF_TYPE type;
|
|
89
|
+
lcbtrace_SPAN *span;
|
|
90
|
+
} lcbtrace_REF;
|
|
91
|
+
|
|
92
|
+
#define LCBTRACE_OP_GET "get"
|
|
93
|
+
|
|
94
|
+
/** zero means the library will trigger timestamp automatically */
|
|
95
|
+
#define LCBTRACE_NOW 0
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @return time in microseconds
|
|
99
|
+
*/
|
|
100
|
+
LIBCOUCHBASE_API
|
|
101
|
+
lcb_U64 lcbtrace_now(void);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @uncommitted
|
|
105
|
+
* @param tracer
|
|
106
|
+
* @param operation
|
|
107
|
+
* @param now
|
|
108
|
+
* @param ctx
|
|
109
|
+
*/
|
|
110
|
+
LIBCOUCHBASE_API
|
|
111
|
+
lcbtrace_SPAN *lcbtrace_span_start(lcbtrace_TRACER *tracer, const char *operation, lcb_U64 now, lcbtrace_REF *ref);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @uncommitted
|
|
115
|
+
* @param span
|
|
116
|
+
* @param now
|
|
117
|
+
*/
|
|
118
|
+
LIBCOUCHBASE_API
|
|
119
|
+
void lcbtrace_span_finish(lcbtrace_SPAN *span, lcb_U64 now);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @uncommitted
|
|
123
|
+
*/
|
|
124
|
+
LIBCOUCHBASE_API
|
|
125
|
+
lcb_U64 lcbtrace_span_get_start_ts(lcbtrace_SPAN *span);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @uncommitted
|
|
129
|
+
*/
|
|
130
|
+
LIBCOUCHBASE_API
|
|
131
|
+
lcb_U64 lcbtrace_span_get_finish_ts(lcbtrace_SPAN *span);
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @uncommitted
|
|
135
|
+
*/
|
|
136
|
+
LIBCOUCHBASE_API
|
|
137
|
+
int lcbtrace_span_is_orphaned(lcbtrace_SPAN *span);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @uncomitted
|
|
141
|
+
*/
|
|
142
|
+
LIBCOUCHBASE_API
|
|
143
|
+
const char *lcbtrace_span_get_operation(lcbtrace_SPAN *span);
|
|
144
|
+
|
|
145
|
+
#define LCBTRACE_OP_REQUEST_ENCODING "request_encoding"
|
|
146
|
+
#define LCBTRACE_OP_DISPATCH_TO_SERVER "dispatch_to_server"
|
|
147
|
+
#define LCBTRACE_OP_RESPONSE_DECODING "response_decoding"
|
|
148
|
+
|
|
149
|
+
#define LCBTRACE_OP_ADD "add"
|
|
150
|
+
#define LCBTRACE_OP_APPEND "append"
|
|
151
|
+
#define LCBTRACE_OP_COUNTER "counter"
|
|
152
|
+
#define LCBTRACE_OP_GET "get"
|
|
153
|
+
#define LCBTRACE_OP_GET_FROM_REPLICA "get_from_replica"
|
|
154
|
+
#define LCBTRACE_OP_INSERT "insert"
|
|
155
|
+
#define LCBTRACE_OP_OBSERVE_CAS "observe_cas"
|
|
156
|
+
#define LCBTRACE_OP_OBSERVE_CAS_ROUND "observe_cas_round"
|
|
157
|
+
#define LCBTRACE_OP_OBSERVE_SEQNO "observe_seqno"
|
|
158
|
+
#define LCBTRACE_OP_PREPEND "prepend"
|
|
159
|
+
#define LCBTRACE_OP_REMOVE "remove"
|
|
160
|
+
#define LCBTRACE_OP_REPLACE "replace"
|
|
161
|
+
#define LCBTRACE_OP_TOUCH "touch"
|
|
162
|
+
#define LCBTRACE_OP_UNLOCK "unlock"
|
|
163
|
+
#define LCBTRACE_OP_UPSERT "upsert"
|
|
164
|
+
#define LCBTRACE_OP_UPSERT "upsert"
|
|
165
|
+
|
|
166
|
+
#define LCBTRACE_OP_STORE2NAME(code) \
|
|
167
|
+
(code == LCB_ADD) ? LCBTRACE_OP_ADD : \
|
|
168
|
+
(code == LCB_PREPEND) ? LCBTRACE_OP_PREPEND : \
|
|
169
|
+
(code == LCB_APPEND) ? LCBTRACE_OP_APPEND : \
|
|
170
|
+
LCBTRACE_OP_UPSERT
|
|
171
|
+
|
|
172
|
+
#define LCBTRACE_TAG_DB_TYPE "db.type"
|
|
173
|
+
#define LCBTRACE_TAG_SPAN_KIND "span.kind"
|
|
174
|
+
/**
|
|
175
|
+
* Bucket name
|
|
176
|
+
*/
|
|
177
|
+
#define LCBTRACE_TAG_DB_INSTANCE "db.instance"
|
|
178
|
+
/**
|
|
179
|
+
* The client's identifier string (the 'u' property in the updated HELLO request),
|
|
180
|
+
* the same one that is shared with the server to identify the SDK.
|
|
181
|
+
*/
|
|
182
|
+
#define LCBTRACE_TAG_COMPONENT "component"
|
|
183
|
+
/**
|
|
184
|
+
* The unique ID of the operation
|
|
185
|
+
*/
|
|
186
|
+
#define LCBTRACE_TAG_OPERATION_ID "couchbase.operation_id"
|
|
187
|
+
/**
|
|
188
|
+
* The service type, one of the following:
|
|
189
|
+
* kv, view, n1ql, search, analytics
|
|
190
|
+
*/
|
|
191
|
+
#define LCBTRACE_TAG_SERVICE "couchbase.service"
|
|
192
|
+
#define LCBTRACE_TAG_SERVICE_KV "kv"
|
|
193
|
+
#define LCBTRACE_TAG_SERVICE_VIEW "view"
|
|
194
|
+
#define LCBTRACE_TAG_SERVICE_N1QL "n1ql"
|
|
195
|
+
#define LCBTRACE_TAG_SERVICE_SEARCH "search"
|
|
196
|
+
#define LCBTRACE_TAG_SERVICE_ANALYTICS "analytics"
|
|
197
|
+
|
|
198
|
+
#define LCBTRACE_TAG_LOCAL_ID "couchbase.local_id"
|
|
199
|
+
/**
|
|
200
|
+
* The local socket hostname / IP and port, in the format: {hostname}:{port}
|
|
201
|
+
* To be added to dispatch spans when the local socket is available.
|
|
202
|
+
*/
|
|
203
|
+
#define LCBTRACE_TAG_LOCAL_ADDRESS "local.address"
|
|
204
|
+
/**
|
|
205
|
+
* The remote socket hostname / IP and port, in the format: {hostname}:{port}
|
|
206
|
+
* To be added to dispatch spans when the local socket is available.
|
|
207
|
+
*/
|
|
208
|
+
#define LCBTRACE_TAG_PEER_ADDRESS "peer.address"
|
|
209
|
+
/**
|
|
210
|
+
* The server duration with precision suffix. The suffix is required to indicate
|
|
211
|
+
* precision because KV is recorded in microseconds and N1QL query metrics
|
|
212
|
+
* use milliseconds.
|
|
213
|
+
* For example: 123us, 32.12ms
|
|
214
|
+
*/
|
|
215
|
+
#define LCBTRACE_TAG_PEER_LATENCY "peer.latency"
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @uncommitted
|
|
219
|
+
*/
|
|
220
|
+
LIBCOUCHBASE_API
|
|
221
|
+
lcb_U64 lcbtrace_span_get_span_id(lcbtrace_SPAN *span);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @uncommitted
|
|
225
|
+
*/
|
|
226
|
+
LIBCOUCHBASE_API
|
|
227
|
+
lcb_U64 lcbtrace_span_get_trace_id(lcbtrace_SPAN *span);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @uncommitted
|
|
231
|
+
*/
|
|
232
|
+
LIBCOUCHBASE_API
|
|
233
|
+
lcbtrace_SPAN *lcbtrace_span_get_parent(lcbtrace_SPAN *span);
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @uncommitted
|
|
237
|
+
*/
|
|
238
|
+
LIBCOUCHBASE_API
|
|
239
|
+
lcb_error_t lcbtrace_span_get_tag_str(lcbtrace_SPAN *span, const char *name, char **value, size_t *nvalue);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @uncommitted
|
|
243
|
+
*/
|
|
244
|
+
LIBCOUCHBASE_API
|
|
245
|
+
lcb_error_t lcbtrace_span_get_tag_uint64(lcbtrace_SPAN *span, const char *name, lcb_U64 *value);
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @uncommitted
|
|
249
|
+
*/
|
|
250
|
+
LIBCOUCHBASE_API
|
|
251
|
+
lcb_error_t lcbtrace_span_get_tag_double(lcbtrace_SPAN *span, const char *name, double *value);
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @uncommitted
|
|
255
|
+
*/
|
|
256
|
+
LIBCOUCHBASE_API
|
|
257
|
+
lcb_error_t lcbtrace_span_get_tag_bool(lcbtrace_SPAN *span, const char *name, int value);
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @uncommitted
|
|
261
|
+
* @param span
|
|
262
|
+
* @param name
|
|
263
|
+
* @param value
|
|
264
|
+
*/
|
|
265
|
+
LIBCOUCHBASE_API
|
|
266
|
+
void lcbtrace_span_add_tag_str(lcbtrace_SPAN *span, const char *name, const char *value);
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @uncommitted
|
|
270
|
+
* @param span
|
|
271
|
+
* @param name
|
|
272
|
+
* @param value
|
|
273
|
+
*/
|
|
274
|
+
LIBCOUCHBASE_API
|
|
275
|
+
void lcbtrace_span_add_tag_uint64(lcbtrace_SPAN *span, const char *name, lcb_U64 value);
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @uncommitted
|
|
279
|
+
* @param span
|
|
280
|
+
* @param name
|
|
281
|
+
* @param value
|
|
282
|
+
*/
|
|
283
|
+
LIBCOUCHBASE_API
|
|
284
|
+
void lcbtrace_span_add_tag_double(lcbtrace_SPAN *span, const char *name, double value);
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @uncommitted
|
|
288
|
+
* @param span
|
|
289
|
+
* @param name
|
|
290
|
+
* @param value
|
|
291
|
+
*/
|
|
292
|
+
LIBCOUCHBASE_API
|
|
293
|
+
void lcbtrace_span_add_tag_bool(lcbtrace_SPAN *span, const char *name, int value);
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Sets the tracing context for the command.
|
|
297
|
+
*
|
|
298
|
+
* @param cmd the command structure
|
|
299
|
+
* @param ctx the lcbtrace_SPAN pointer
|
|
300
|
+
* @uncommitted
|
|
301
|
+
*/
|
|
302
|
+
#define LCB_CMD_SET_TRACESPAN(cmd, span) \
|
|
303
|
+
do { \
|
|
304
|
+
(cmd)->_hashkey.type = LCB_KV_TRACESPAN; \
|
|
305
|
+
(cmd)->_hashkey.contig.bytes = span; \
|
|
306
|
+
} while (0);
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @uncommitted
|
|
310
|
+
*/
|
|
311
|
+
typedef struct {
|
|
312
|
+
void *state;
|
|
313
|
+
void (*report)(void *state, lcbtrace_SPAN *span);
|
|
314
|
+
} ldcptrace_REPORTER;
|
|
315
|
+
|
|
316
|
+
#ifdef __cplusplus
|
|
317
|
+
}
|
|
318
|
+
#endif
|
|
319
|
+
#endif /* LCB_TRACING_H */
|