couchbase 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/deps/lcb/CMakeLists.txt +1 -1
  2. package/deps/lcb/CONTRIBUTING.md +1 -1
  3. package/deps/lcb/README.markdown +2 -2
  4. package/deps/lcb/RELEASE_NOTES.markdown +72 -17
  5. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  6. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  7. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
  8. package/deps/lcb/doc/Doxyfile +1 -1
  9. package/deps/lcb/example/minimal/query.c +9 -7
  10. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  11. package/deps/lcb/include/libcouchbase/couchbase.h +3 -1
  12. package/deps/lcb/include/libcouchbase/error.h +2 -0
  13. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  14. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  15. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  16. package/deps/lcb/libcouchbase.gyp +347 -349
  17. package/deps/lcb/packaging/deb/control +1 -1
  18. package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
  19. package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
  20. package/deps/lcb/src/capi/cmd_counter.hh +6 -0
  21. package/deps/lcb/src/capi/cmd_exists.hh +6 -0
  22. package/deps/lcb/src/capi/cmd_get.hh +5 -0
  23. package/deps/lcb/src/capi/cmd_get_replica.hh +6 -0
  24. package/deps/lcb/src/capi/cmd_remove.hh +6 -0
  25. package/deps/lcb/src/capi/cmd_search.hh +6 -0
  26. package/deps/lcb/src/capi/cmd_store.hh +16 -21
  27. package/deps/lcb/src/capi/cmd_subdoc.hh +18 -0
  28. package/deps/lcb/src/capi/cmd_touch.hh +6 -0
  29. package/deps/lcb/src/capi/cmd_unlock.hh +6 -0
  30. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  31. package/deps/lcb/src/capi/collection_qualifier.hh +2 -2
  32. package/deps/lcb/src/cntl.cc +42 -8
  33. package/deps/lcb/src/dns-srv.cc +5 -3
  34. package/deps/lcb/src/errmap.cc +5 -9
  35. package/deps/lcb/src/errmap.h +7 -3
  36. package/deps/lcb/src/handler.cc +24 -18
  37. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  38. package/deps/lcb/src/mcserver/mcserver.cc +8 -5
  39. package/deps/lcb/src/mcserver/negotiate.cc +39 -17
  40. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  41. package/deps/lcb/src/n1ql/query_handle.cc +27 -16
  42. package/deps/lcb/src/n1ql/query_handle.hh +27 -1
  43. package/deps/lcb/src/operations/counter.cc +1 -1
  44. package/deps/lcb/src/operations/exists.cc +2 -2
  45. package/deps/lcb/src/operations/get.cc +2 -2
  46. package/deps/lcb/src/operations/observe.cc +1 -1
  47. package/deps/lcb/src/operations/remove.cc +1 -1
  48. package/deps/lcb/src/operations/store.cc +1 -1
  49. package/deps/lcb/src/operations/subdoc.cc +1 -2
  50. package/deps/lcb/src/operations/touch.cc +2 -2
  51. package/deps/lcb/src/operations/unlock.cc +2 -2
  52. package/deps/lcb/src/search/search_handle.cc +27 -8
  53. package/deps/lcb/src/search/search_handle.hh +29 -0
  54. package/deps/lcb/src/ssl/ssl_common.c +6 -7
  55. package/deps/lcb/src/tracing/span.cc +43 -10
  56. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  57. package/deps/lcb/src/views/view_handle.cc +13 -5
  58. package/deps/lcb/src/views/view_handle.hh +29 -0
  59. package/deps/lcb/tests/CMakeLists.txt +21 -0
  60. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  61. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  62. package/deps/lcb/tests/iotests/mock-environment.cc +15 -0
  63. package/deps/lcb/tests/iotests/mock-environment.h +47 -0
  64. package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
  65. package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
  66. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  67. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  68. package/deps/lcb/tests/iotests/t_get.cc +14 -4
  69. package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
  70. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  71. package/deps/lcb/tests/iotests/testutil.cc +168 -0
  72. package/deps/lcb/tests/iotests/testutil.h +111 -0
  73. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  74. package/deps/lcb/tests/mocksupport/server.c +0 -1
  75. package/deps/lcb/tools/cbc.cc +7 -0
  76. package/dist/analyticsindexmanager.js +3 -3
  77. package/dist/binding.d.ts +2 -0
  78. package/dist/bindingutilities.js +4 -0
  79. package/dist/bucketmanager.d.ts +31 -1
  80. package/dist/bucketmanager.js +28 -2
  81. package/dist/collection.js +2 -2
  82. package/dist/collectionmanager.js +2 -2
  83. package/dist/connection.js +3 -0
  84. package/dist/errors.d.ts +18 -0
  85. package/dist/errors.js +26 -2
  86. package/dist/eventingfunctionmanager.js +6 -6
  87. package/dist/queryindexmanager.js +3 -3
  88. package/dist/searchexecutor.js +3 -0
  89. package/dist/searchindexmanager.js +1 -1
  90. package/dist/searchquery.d.ts +17 -0
  91. package/dist/searchquery.js +22 -1
  92. package/dist/searchtypes.d.ts +7 -2
  93. package/dist/searchtypes.js +2 -2
  94. package/dist/usermanager.js +1 -1
  95. package/dist/viewindexmanager.js +1 -1
  96. package/package.json +1 -1
  97. package/src/connection.cpp +2 -0
  98. package/src/constants.cpp +2 -0
  99. package/src/instance.cpp +8 -1
  100. package/src/instance.h +1 -0
@@ -30,7 +30,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
30
30
  # Couchbase mock path to download
31
31
  SET(COUCHBASE_MOCK_VERSION 1.5.25)
32
32
  SET(COUCHBASE_MOCK_URL "https://github.com/couchbase/CouchbaseMock/releases/download/${COUCHBASE_MOCK_VERSION}/CouchbaseMock-${COUCHBASE_MOCK_VERSION}.jar")
33
- project(libcouchbase VERSION 3.2.1 LANGUAGES C CXX)
33
+ project(libcouchbase VERSION 3.2.4 LANGUAGES C CXX)
34
34
 
35
35
  if (NOT CMAKE_VERSION VERSION_LESS "3.13")
36
36
  # CMP0077: option() honors normal variables
@@ -66,7 +66,7 @@ Add your public SSH key to gerrit before submitting.
66
66
  Assuming you have a repository created like so:
67
67
 
68
68
  ```
69
- $ git clone git://github.com/couchbase/libcouchbase.git
69
+ $ git clone https://github.com/couchbase/libcouchbase.git
70
70
  ```
71
71
 
72
72
  you can simply perform two simple steps to get started with gerrit:
@@ -48,7 +48,7 @@ Provided is a convenience script called `cmake/configure`. It is a Perl
48
48
  script and functions like a normal `autotools` script.
49
49
 
50
50
  ```shell
51
- $ git clone git://github.com/couchbase/libcouchbase.git
51
+ $ git clone https://github.com/couchbase/libcouchbase.git
52
52
  $ cd libcouchbase && mkdir build && cd build
53
53
  $ ../cmake/configure
54
54
  $ make
@@ -60,7 +60,7 @@ $ ctest
60
60
  Assuming `git` and Visual Studio 2010 are installed, from a `CMD` shell, do:
61
61
 
62
62
  ```
63
- C:\> git clone git://github.com/couchbase/libcouchbase.git
63
+ C:\> git clone https://github.com/couchbase/libcouchbase.git
64
64
  C:\> mkdir lcb-build
65
65
  C:\> cd lcb-build
66
66
  C:\> cmake -G "Visual Studio 10" ..\libcouchbase
@@ -1,15 +1,70 @@
1
1
  # Release Notes
2
2
 
3
+ ## 3.2.4 (2021-11-23)
4
+
5
+ CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
6
+
7
+ CCBC-1521: Fixed bootstrap process when client certificate is used. We always pipeline error map request with `HELLO`
8
+ request, and usually await for `hello`+`error_map` responses, because after that goes SASL authentication (and then
9
+ optional selection of the bucket) which cannot be completely pipelined. But in case of client certificate, we might
10
+ terminate bootstrap process too early if the bootstrap process does not require immediate selection of the bucket.
11
+
12
+ CCBC-1432: Support for rate limiting error codes: `LCB_ERR_RATE_LIMITED` and `LCB_ERR_QUOTA_LIMITED`.
13
+
14
+ CCBC-1514: Do not translate unknown error with "item-only" attribute into `LCB_ERR_CAS_MISMATCH`.
15
+
16
+ CCBC-1515: Performance optimization: replace `sstream` with string `append()`. Only if list of IO vectors supplied for
17
+ value in mutation operations.
18
+
19
+ ## 3.2.3 (2021-10-20)
20
+
21
+ * CCBC-1484: Fixed tracing tags in accordance to RFC.
22
+
23
+ * CCBC-1510: Fixed key length calculation for exists/get/touch/unlock.
24
+
25
+ * CCBC-1495: Fixed payload encoding in query index management helpers. Query index management helpers now explicitly
26
+ declared deperecated.
27
+
28
+ * CCBC-1506: Duration values now accepted golang style encoding. Connection string and `lcb_cntl_string` now can parse
29
+ strings with duration encoded in golang style, e.g. `analytics_timeout=5s42us`. The result still converted into 32-bit
30
+ value with microsecond resolution.
31
+
32
+ * Improved test coverage, stability and documentation.
33
+
34
+ ## 3.2.2 (2021-09-22)
35
+
36
+ * CCBC-1485: Allow disabling tracer for connected instance.
37
+
38
+ * CCBC-1472: Ensure strict JSON parsing mode for query meta.
39
+
40
+ * CCBC-1494: Disconnect logger after `lcb_destroy` invoked to avoid double free errors.
41
+
42
+ * CCBC-1457: improve error message when server enforces encryption
43
+
44
+ * CCBC-1489: Fixed get_and_touch to use the correct expiry.
45
+
46
+ * CCBC-1487: Fixed `retryq` erasing already sent packets.
47
+
48
+ * CCBC-1488: Fixed incorrect refcounting in `Connstart`.
49
+
50
+ * CCBC-1479: Initialize fields of custom tracer struct.
51
+
52
+ * CCBC-1478: Do not retry successful query with empty result.
53
+
54
+ * CCBC-1216: Implement user impersonation API
55
+
56
+ * Improved test coverage and stability.
57
+
3
58
  ## 3.2.1 (2021-08-20)
4
59
 
5
60
  * CCBC-1429: Fixed positional parameters for query/analtyics:
6
-
61
+
7
62
  * reverts behaviour `lcb_cmdquery_positional_param` and `lcb_cmdanalytics_positional_param` to append single
8
63
  JSON-encoded value to arguments array.
9
-
64
+
10
65
  * introduces new functions `lcb_cmdquery_positional_params` and `lcb_cmdanalytics_positional_params` that accept all
11
66
  positional arguments at once as JSON-encoded array.
12
-
67
+
13
68
  * document, that old functions will emit compiler warning since 3.3.0 release and will be removed later.
14
69
 
15
70
  * CCBC-1428: Clear callback upon error in `lcb_search`.
@@ -35,56 +90,56 @@
35
90
  * Various improvements and fixes in test and build infrastruture
36
91
 
37
92
  * CBCC-1280 Support for OpenTelemetry tracing.
38
-
93
+
39
94
  Tracing updated to allow for an external tracer that creates and finishes spans, adds tags, destroys spans. Also,
40
95
  spans now have the notion of being the 'outer' span. That is the span that has all the outer span tags, and is the
41
96
  one whose duration is used to determine whether or not the operation has exceeded the threshold if the
42
97
  ThresholdLoggingTracer is used.
43
-
98
+
44
99
  If you pass in a parent that is an outer span, you must call `lcbtrace_span_finish` yourself. When an operation
45
100
  begins, if there is no parent span passed in, or if there is but it isn't an 'outer' span, then the operation creates
46
101
  the outer span itself.
47
102
  See `/examples/tracing/otel_tracing.cc` for an example.
48
-
103
+
49
104
  * CCBC-1362: Support for metrics.
50
-
105
+
51
106
  When enabled, by default will output a histogram of latencies for various kv operations plus query, search, analytics
52
107
  and view queries.
53
-
108
+
54
109
  If desired, an external metrics collector can be passed in when the instance is created, which will then be called
55
110
  with latencies for each operation. This can be used to call into an opentelemetry meter for aggregation and export.
56
111
  See `/examples/metrics/otel_metrics.cc` for an example.
57
112
 
58
113
  * CCBC-1421: Allow empty path for subdocument array methods.
59
-
114
+
60
115
  * CCBC-1417: Depecate CAS usage with counter operation.
61
116
 
62
117
  * CCBC-1418: Map query error 13014 to `LCB_ERR_AUTHENTICATION_FAILURE`.
63
-
118
+
64
119
  * CCBC-1357: Allow to preserve expiration with Replace, Upsert and MutateIn operations.
65
120
 
66
121
  * CCBC-1384: Allow the operations to be deferred until the instance will be connected to cluster.
67
122
 
68
123
  * CCBC-1410: Refactor dynamic authenticator. NOTE: this API still volatile and might be changed in future.
69
-
124
+
70
125
  In order to improve UX and allow caller to implement credential caching the API for authenticator was revised:
71
-
126
+
72
127
  * instead of separate callbacks for username/password, now it uses single callback
73
-
128
+
74
129
  * in the callback, the caller can figure out the reason of credentials request using `lcbauth_credentials_reason()`
75
-
130
+
76
131
  * the caller can signal that it failed to retrieve credentials from external provider, and set result with
77
132
  `lcbauth_credentials_result()`. In this case the SDK will not retry the operation.
78
-
133
+
79
134
 
80
135
  * CCBC-1413: Skip `SELECT_BUCKET` packets waiting retry queue.
81
136
 
82
137
  * CCBC-1169: Request copy from active vbucket for `get_all_replicas` operation.
83
138
 
84
139
  * CCBC-1406: Fill in prepared statement handle on retry.
85
-
140
+
86
141
  * CCBC-1405: Remove const from command cookie.
87
-
142
+
88
143
  * CCBC-1402: Fix parsing JSON primitives as query rows.
89
144
 
90
145
  ## 3.1.3 (2021-05-10)
@@ -65,7 +65,7 @@ IF(APPLE)
65
65
  ELSE()
66
66
  SET(LCB_SONAME_MAJOR "8")
67
67
  ENDIF()
68
- SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.2")
68
+ SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.5")
69
69
 
70
70
  MESSAGE(STATUS "libcouchbase ${LCB_VERSION_MAJOR},${LCB_VERSION_MINOR},${LCB_VERSION_PATCH}")
71
71
  MESSAGE(STATUS "Building libcouchbase ${LCB_VERSION}/${LCB_VERSION_CHANGESET}")
@@ -16,8 +16,8 @@
16
16
 
17
17
  #include "scram_utils.h"
18
18
  #include "config.h"
19
- #include <time.h>
20
- #include <ctype.h>
19
+ #include <ctime>
20
+ #include <cctype>
21
21
  #include "strcodecs/strcodecs.h"
22
22
 
23
23
  #ifndef LCB_NO_SSL
@@ -46,9 +46,9 @@ void seed_rand(void)
46
46
  // The entropy of these values is not good, but that's enough for generating nonces.
47
47
 
48
48
  #ifdef LCB_NO_SSL
49
- srand(time(NULL));
49
+ srand(time(nullptr));
50
50
  #else
51
- time_t current_time = time(NULL);
51
+ time_t current_time = time(nullptr);
52
52
  clock_t clk;
53
53
  #ifdef _WIN32
54
54
  int pid;
@@ -73,7 +73,7 @@ void seed_rand(void)
73
73
  */
74
74
  void generate_nonce(char *buffer, int buffer_length)
75
75
  {
76
- if ((NULL == buffer) || (0 == buffer_length)) {
76
+ if ((nullptr == buffer) || (0 == buffer_length)) {
77
77
  // invalid input arguments
78
78
  return;
79
79
  }
@@ -88,14 +88,13 @@ void generate_nonce(char *buffer, int buffer_length)
88
88
  int aRandom = 0;
89
89
  unsigned int aMaxRandBits = 0, aRandRange,
90
90
  aMaxRand = RAND_MAX; // we have to compute how many bits the rand() function can return
91
- int i;
92
91
  while (aMaxRand >>= 1) {
93
92
  aMaxRandBits++;
94
93
  }
95
94
  aRandRange = aMaxRandBits / 8; // number of bytes we can extract from a rand() value.
96
95
  // To avoid generating a new random number for each character, we call rand() only once every 5 characters.
97
96
  // A 32-bits integer can give 5 values of 6 bits.
98
- for (i = 0; i < buffer_length; ++i) {
97
+ for (int i = 0; i < buffer_length; ++i) {
99
98
  if (i % aRandRange == 0) {
100
99
  // we refill aRandom
101
100
  aRandom = rand();
@@ -115,8 +114,7 @@ void generate_nonce(char *buffer, int buffer_length)
115
114
  int compute_special_chars(const char *buffer, int buffer_length)
116
115
  {
117
116
  int result = 0;
118
- int i;
119
- for (i = 0; i < buffer_length; ++i) {
117
+ for (int i = 0; i < buffer_length; ++i) {
120
118
  char c = buffer[i];
121
119
  if (iscntrl(c)) {
122
120
  return -1; // control characters are not allowed
@@ -140,13 +138,12 @@ int compute_special_chars(const char *buffer, int buffer_length)
140
138
  void usernmcpy(char *dest, const char *src, size_t n)
141
139
  {
142
140
  char *newdest = dest;
143
- unsigned int i;
144
141
 
145
- if (NULL == dest || NULL == src || 0 == n) {
142
+ if (nullptr == dest || nullptr == src || 0 == n) {
146
143
  return; // invalid arguments
147
144
  }
148
145
 
149
- for (i = 0; i < n; ++i) {
146
+ for (size_t i = 0; i < n; ++i) {
150
147
  char c = src[i];
151
148
  switch (c) {
152
149
  case '=':
@@ -178,7 +175,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
178
175
  const char *oldptr = serverin;
179
176
  unsigned int remainlen = serverinlen;
180
177
 
181
- if (NULL == serverin || 0 == serverinlen) {
178
+ if (nullptr == serverin || 0 == serverinlen) {
182
179
  return SASL_BADPARAM;
183
180
  }
184
181
 
@@ -186,7 +183,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
186
183
  do {
187
184
  unsigned int attrlen; // attribute length
188
185
  ptr = static_cast<const char *>(memchr(ptr, ',', remainlen));
189
- if (ptr != NULL) {
186
+ if (ptr != nullptr) {
190
187
  // oldptr points to the beginning of the attribute
191
188
  // Ex: "r=xxxxx,s=zzzzzz,i=10"
192
189
  // ^ ^
@@ -209,7 +206,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
209
206
  }
210
207
  switch (oldptr[0]) {
211
208
  case 'r': // nonce
212
- if (*nonce != NULL) {
209
+ if (*nonce != nullptr) {
213
210
  // it looks like we already stored a previous occurrence of the nonce attribute
214
211
  return SASL_BADPARAM;
215
212
  }
@@ -217,7 +214,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
217
214
  *noncelength = attrlen - 2;
218
215
  break;
219
216
  case 's': // salt
220
- if (*salt != NULL) {
217
+ if (*salt != nullptr) {
221
218
  // it looks like we already stored a previous occurrence of the salt attribute
222
219
  return SASL_BADPARAM;
223
220
  }
@@ -244,7 +241,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
244
241
 
245
242
  remainlen = remainlen - attrlen - 1;
246
243
  oldptr = ptr;
247
- } while (ptr != NULL);
244
+ } while (ptr != nullptr);
248
245
 
249
246
  return SASL_OK;
250
247
  }
@@ -313,17 +310,17 @@ static cbsasl_error_t HMAC_digest(cbsasl_auth_mechanism_t auth_mech, const unsig
313
310
  {
314
311
  switch (auth_mech) {
315
312
  case SASL_AUTH_MECH_SCRAM_SHA1:
316
- if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) == NULL) {
313
+ if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
317
314
  return SASL_FAIL;
318
315
  }
319
316
  break;
320
317
  case SASL_AUTH_MECH_SCRAM_SHA256:
321
- if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) == NULL) {
318
+ if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
322
319
  return SASL_FAIL;
323
320
  }
324
321
  break;
325
322
  case SASL_AUTH_MECH_SCRAM_SHA512:
326
- if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) == NULL) {
323
+ if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
327
324
  return SASL_FAIL;
328
325
  }
329
326
  break;
@@ -369,19 +366,19 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
369
366
  unsigned int storedkeylen = 0;
370
367
  switch (auth_mech) {
371
368
  case SASL_AUTH_MECH_SCRAM_SHA1:
372
- if (SHA1(clientkeyhmac, hmaclen, storedkey) == NULL) {
369
+ if (SHA1(clientkeyhmac, hmaclen, storedkey) == nullptr) {
373
370
  return SASL_FAIL;
374
371
  }
375
372
  storedkeylen = SHA_DIGEST_LENGTH;
376
373
  break;
377
374
  case SASL_AUTH_MECH_SCRAM_SHA256:
378
- if (SHA256(clientkeyhmac, hmaclen, storedkey) == NULL) {
375
+ if (SHA256(clientkeyhmac, hmaclen, storedkey) == nullptr) {
379
376
  return SASL_FAIL;
380
377
  }
381
378
  storedkeylen = SHA256_DIGEST_LENGTH;
382
379
  break;
383
380
  case SASL_AUTH_MECH_SCRAM_SHA512:
384
- if (SHA512(clientkeyhmac, hmaclen, storedkey) == NULL) {
381
+ if (SHA512(clientkeyhmac, hmaclen, storedkey) == nullptr) {
385
382
  return SASL_FAIL;
386
383
  }
387
384
  storedkeylen = SHA512_DIGEST_LENGTH;
@@ -396,7 +393,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
396
393
  // client-final-message-without-proof
397
394
  unsigned int authmesslen = cfblen + 1 + sfmlen + 1 + cfwplen;
398
395
  char *authmess = static_cast<char *>(calloc(authmesslen + 1, 1)); // +1 for the binary zero
399
- if (NULL == authmess) {
396
+ if (nullptr == authmess) {
400
397
  return SASL_NOMEM;
401
398
  }
402
399
  memcpy(authmess, clientfirstbare, cfblen);
@@ -419,8 +416,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
419
416
  // final step:
420
417
  // ClientProof := ClientKey XOR ClientSignature
421
418
  char clientproof[EVP_MAX_MD_SIZE]; // binary client proof
422
- unsigned int i;
423
- for (i = 0; i < clientsignlen; ++i) {
419
+ for (unsigned i = 0; i < clientsignlen; ++i) {
424
420
  clientproof[i] = clientkeyhmac[i] ^ clientsign[i];
425
421
  }
426
422
 
@@ -288,6 +288,7 @@ bool Reader::parse(const char* beginDoc,
288
288
  const char* endDoc,
289
289
  Value& root,
290
290
  bool collectComments) {
291
+ try {
291
292
  if (!features_.allowComments_) {
292
293
  collectComments = false;
293
294
  }
@@ -324,6 +325,21 @@ bool Reader::parse(const char* beginDoc,
324
325
  }
325
326
  }
326
327
  return successful;
328
+ } catch (const RuntimeError &e) {
329
+ Token token;
330
+ token.type_ = tokenError;
331
+ token.start_ = beginDoc;
332
+ token.end_ = endDoc;
333
+ addError(std::string("RuntimeError: ") + e.what(), token);
334
+ return false;
335
+ } catch (const LogicError &e) {
336
+ Token token;
337
+ token.type_ = tokenError;
338
+ token.start_ = beginDoc;
339
+ token.end_ = endDoc;
340
+ addError(std::string("LogicError: ") + e.what(), token);
341
+ return false;
342
+ }
327
343
  }
328
344
 
329
345
  bool Reader::readValue() {
@@ -2356,15 +2372,13 @@ RuntimeError::RuntimeError(std::string const& msg)
2356
2372
  LogicError::LogicError(std::string const& msg)
2357
2373
  : Exception(msg)
2358
2374
  {}
2359
- void throwRuntimeError(std::string const& )
2375
+ void throwRuntimeError(std::string const& msg)
2360
2376
  {
2361
- assert(false);
2362
- // throw RuntimeError(msg);
2377
+ throw RuntimeError(msg);
2363
2378
  }
2364
- void throwLogicError(std::string const&)
2379
+ void throwLogicError(std::string const& msg)
2365
2380
  {
2366
- assert(false);
2367
- // throw LogicError(msg);
2381
+ throw LogicError(msg);
2368
2382
  }
2369
2383
 
2370
2384
  // //////////////////////////////////////////////////////////////////
@@ -38,7 +38,7 @@ PROJECT_NAME = "Couchbase C Client"
38
38
  # could be handy for archiving the generated documentation or if some version
39
39
  # control system is used.
40
40
 
41
- PROJECT_NUMBER = 3.2.1
41
+ PROJECT_NUMBER = 3.2.4
42
42
 
43
43
  # Using the PROJECT_BRIEF tag one can provide an optional one line description
44
44
  # for a project that appears at the top of each page and should give viewer a
@@ -71,7 +71,7 @@ static void row_callback(lcb_INSTANCE *instance, int type, const lcb_RESPQUERY *
71
71
 
72
72
  lcb_respquery_row(resp, &row, &nrow);
73
73
  ln2space(row, nrow);
74
- fprintf(stderr, "[\x1b[%dmQUERY\x1b[0m] %s, (%d) %.*s\n", err2color(rc), lcb_strerror_short(rc), (int)nrow,
74
+ fprintf(stderr, "[\x1b[%dmQUERY\x1b[0m] %s, (size=%d) %.*s\n", err2color(rc), lcb_strerror_short(rc), (int)nrow,
75
75
  (int)nrow, row);
76
76
  if (lcb_respquery_is_final(resp)) {
77
77
  fprintf(stderr, "\n");
@@ -120,7 +120,6 @@ static void sigint_handler(int unused)
120
120
 
121
121
  int main(int argc, char *argv[])
122
122
  {
123
- lcb_STATUS err;
124
123
  lcb_INSTANCE *instance;
125
124
  char *bucket = NULL;
126
125
  const char *key = "user:king_arthur";
@@ -171,11 +170,14 @@ int main(int argc, char *argv[])
171
170
  }
172
171
 
173
172
  {
174
- lcb_CMDN1XMGMT cmd = {0};
175
- cmd.callback = idx_callback;
176
- cmd.spec.flags = LCB_N1XSPEC_F_PRIMARY;
177
- cmd.spec.ixtype = LCB_N1XSPEC_T_GSI;
178
- check(lcb_n1x_create(instance, NULL, &cmd), "schedule N1QL index creation operation");
173
+ lcb_CMDQUERY *cmd;
174
+ char query[1024] = {0};
175
+ lcb_cmdquery_create(&cmd);
176
+ snprintf(query, sizeof(query), "CREATE PRIMARY INDEX ON `%s` USING gsi", bucket);
177
+ check(lcb_cmdquery_statement(cmd, query, strlen(query)), "set QUERY statement");
178
+ lcb_cmdquery_callback(cmd, row_callback);
179
+ check(lcb_query(instance, NULL, cmd), "schedule QUERY INDEX create operation");
180
+ lcb_cmdquery_destroy(cmd);
179
181
  lcb_wait(instance, LCB_WAIT_DEFAULT);
180
182
  }
181
183
 
@@ -33,7 +33,7 @@
33
33
  */
34
34
 
35
35
  /** @brief libcouchbase version string */
36
- #define LCB_VERSION_STRING "3.2.1+13-njs"
36
+ #define LCB_VERSION_STRING "3.2.4-njs"
37
37
 
38
38
  /**@brief libcouchbase hex version
39
39
  *
@@ -50,12 +50,12 @@
50
50
  * 2.1.3 | 0x020103
51
51
  * 3.0.15 | 0x030015
52
52
  */
53
- #define LCB_VERSION 0x030201
53
+ #define LCB_VERSION 0x030204
54
54
 
55
55
  /**@brief The SCM revision ID
56
56
  * @see LCB_CNTL_CHANGESET
57
57
  */
58
- #define LCB_VERSION_CHANGESET "204a528618e9a86007b85c109fd46a45c21aa053"
58
+ #define LCB_VERSION_CHANGESET "38cc0708dfcc5a706c6b21dc80bcd84f05890225"
59
59
 
60
60
  /**@brief The client ID
61
61
  */
@@ -2562,7 +2562,9 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdanalytics_scope_name(lcb_CMDANALYTICS *cmd, c
2562
2562
  *
2563
2563
  * Associate scope_qualifier (also known as `query_context`) with the query.
2564
2564
  *
2565
- * The qualifier must be in form `${bucket_name}.${scope_name}` or `default:${bucket_name}.${scope_name}`.
2565
+ * The qualifier must be in form `default:${bucket_name}.${scope_name}`.
2566
+ *
2567
+ * @see REST API definition at https://docs.couchbase.com/server/current/analytics/rest-service.html
2566
2568
  *
2567
2569
  * @param cmd the command
2568
2570
  * @param qualifier the string containing qualifier
@@ -86,6 +86,8 @@ X(LCB_ERR_UNAMBIGUOUS_TIMEOUT, 216, LCB_ERROR_TYPE_SHARED, 0, "Unambiguous
86
86
  X(LCB_ERR_SCOPE_NOT_FOUND, 217, LCB_ERROR_TYPE_SHARED, 0, "Scope is not found") \
87
87
  X(LCB_ERR_INDEX_NOT_FOUND, 218, LCB_ERROR_TYPE_SHARED, 0, "Index is not found") \
88
88
  X(LCB_ERR_INDEX_EXISTS, 219, LCB_ERROR_TYPE_SHARED, 0, "Index is exist already") \
89
+ X(LCB_ERR_RATE_LIMITED, 220, LCB_ERROR_TYPE_SHARED, 0, "The service decided that the caller must be rate limited due to exceeding a rate threshold") \
90
+ X(LCB_ERR_QUOTA_LIMITED, 221, LCB_ERROR_TYPE_SHARED, 0, "The service decided that the caller must be limited due to exceeding a quota threshold") \
89
91
  \
90
92
  /* KeyValue Error Definitions */ \
91
93
  X(LCB_ERR_DOCUMENT_NOT_FOUND, 301, LCB_ERROR_TYPE_KEYVALUE, 0, "Document is not found") \
@@ -177,8 +177,9 @@ typedef struct lcb_RESPN1XMGMT_st {
177
177
  * Retrieve a list of all indexes in the cluster. If lcb_CMDN1XMGMT::spec
178
178
  * contains entries then the search will be limited to the appropriate criteria.
179
179
  */
180
- LIBCOUCHBASE_API
181
- lcb_STATUS lcb_n1x_list(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
180
+ LCB_DEPRECATED2(LIBCOUCHBASE_API lcb_STATUS lcb_n1x_list(lcb_INSTANCE *instance, const void *cookie,
181
+ const lcb_CMDN1XMGMT *cmd),
182
+ "lcb_http must be used directly");
182
183
 
183
184
  /**
184
185
  * @volatile
@@ -186,15 +187,17 @@ lcb_STATUS lcb_n1x_list(lcb_INSTANCE *instance, const void *cookie, const lcb_CM
186
187
  * Create an index. The index can either be a primary or secondary index, and
187
188
  * it may be created immediately or it may be deferred.
188
189
  */
189
- LIBCOUCHBASE_API
190
- lcb_STATUS lcb_n1x_create(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
190
+ LCB_DEPRECATED2(LIBCOUCHBASE_API lcb_STATUS lcb_n1x_create(lcb_INSTANCE *instance, const void *cookie,
191
+ const lcb_CMDN1XMGMT *cmd),
192
+ "lcb_http must be used directly");
191
193
 
192
194
  /**
193
195
  * @volatile
194
196
  * Remove an index.
195
197
  */
196
- LIBCOUCHBASE_API
197
- lcb_STATUS lcb_n1x_drop(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
198
+ LCB_DEPRECATED2(LIBCOUCHBASE_API lcb_STATUS lcb_n1x_drop(lcb_INSTANCE *instance, const void *cookie,
199
+ const lcb_CMDN1XMGMT *cmd),
200
+ "lcb_http must be used directly");
198
201
 
199
202
  /**
200
203
  * @volatile
@@ -205,8 +208,9 @@ lcb_STATUS lcb_n1x_drop(lcb_INSTANCE *instance, const void *cookie, const lcb_CM
205
208
  *
206
209
  * lcb_n1x_watchbuild may be used to wait on the status of those indexes.
207
210
  */
208
- LIBCOUCHBASE_API
209
- lcb_STATUS lcb_n1x_startbuild(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XMGMT *cmd);
211
+ LCB_DEPRECATED2(LIBCOUCHBASE_API lcb_STATUS lcb_n1x_startbuild(lcb_INSTANCE *instance, const void *cookie,
212
+ const lcb_CMDN1XMGMT *cmd),
213
+ "lcb_http must be used directly");
210
214
 
211
215
  /**
212
216
  * @volatile
@@ -250,8 +254,9 @@ typedef struct {
250
254
  * which are being built (using lcb_n1x_startbuild()) have been fully
251
255
  * created.
252
256
  */
253
- LIBCOUCHBASE_API
254
- lcb_STATUS lcb_n1x_watchbuild(lcb_INSTANCE *instance, const void *cookie, const lcb_CMDN1XWATCH *cmd);
257
+ LCB_DEPRECATED2(LIBCOUCHBASE_API lcb_STATUS lcb_n1x_watchbuild(lcb_INSTANCE *instance, const void *cookie,
258
+ const lcb_CMDN1XWATCH *cmd),
259
+ "lcb_http must be used directly");
255
260
 
256
261
  #ifdef __cplusplus
257
262
  }
@@ -406,7 +406,7 @@ lcb_STATUS lcbtrace_span_set_is_dispatch(lcbtrace_SPAN *span, int dispatch);
406
406
  /**
407
407
  * Bucket name
408
408
  */
409
- #define LCBTRACE_TAG_DB_INSTANCE "db.instance"
409
+ #define LCBTRACE_TAG_DB_INSTANCE "db.name"
410
410
  /**
411
411
  * The client's identifier string (the 'u' property in the updated HELLO request),
412
412
  * the same one that is shared with the server to identify the SDK.
@@ -492,7 +492,7 @@ lcb_STATUS lcbtrace_span_set_is_dispatch(lcbtrace_SPAN *span, int dispatch);
492
492
  /**
493
493
  * Transport used in trace.
494
494
  */
495
- #define LCBTRACE_TAG_TRANSPORT "db.net.transport"
495
+ #define LCBTRACE_TAG_TRANSPORT "net.transport"
496
496
  /**
497
497
  * Get ID of the span.
498
498
  *
@@ -133,6 +133,27 @@ typedef enum {
133
133
  * users access to the cluster. */
134
134
  PROTOCOL_BINARY_RESPONSE_NOT_INITIALIZED = 0x25,
135
135
 
136
+ /**
137
+ * The tenant exceeded network ingress limit
138
+ */
139
+ PROTOCOL_BINARY_RATE_LIMITED_NETWORK_INGRESS = 0x30,
140
+ /**
141
+ * The tenant exceeded network egress limit
142
+ */
143
+ PROTOCOL_BINARY_RATE_LIMITED_NETWORK_EGRESS = 0x31,
144
+ /**
145
+ * The tenant exceeded max number of connections
146
+ */
147
+ PROTOCOL_BINARY_RATE_LIMITED_MAX_CONNECTIONS = 0x32,
148
+ /**
149
+ * The tenant exceeded max number of commands
150
+ */
151
+ PROTOCOL_BINARY_RATE_LIMITED_MAX_COMMANDS = 0x33,
152
+ /**
153
+ * There is too much data in the scope
154
+ */
155
+ PROTOCOL_BINARY_SCOPE_SIZE_LIMIT_EXCEEDED = 0x34,
156
+
136
157
  /** The server have no idea what this command is for */
137
158
  PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
138
159
  /** Not enough memory */