couchbase 3.2.4 → 3.2.5

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.
Files changed (70) hide show
  1. package/binding.gyp +5 -0
  2. package/deps/lcb/CMakeLists.txt +1 -1
  3. package/deps/lcb/RELEASE_NOTES.markdown +12 -0
  4. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  5. package/deps/lcb/doc/Doxyfile +1 -1
  6. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  7. package/deps/lcb/include/libcouchbase/couchbase.h +52 -0
  8. package/deps/lcb/include/libcouchbase/error.h +4 -1
  9. package/deps/lcb/libcouchbase.gyp +7 -1
  10. package/deps/lcb/src/capi/cmd_counter.hh +12 -0
  11. package/deps/lcb/src/capi/cmd_exists.hh +12 -0
  12. package/deps/lcb/src/capi/cmd_get.hh +12 -0
  13. package/deps/lcb/src/capi/cmd_get_replica.hh +14 -1
  14. package/deps/lcb/src/capi/cmd_query.cc +13 -0
  15. package/deps/lcb/src/capi/cmd_query.hh +22 -14
  16. package/deps/lcb/src/capi/cmd_remove.hh +12 -0
  17. package/deps/lcb/src/capi/cmd_store.hh +12 -0
  18. package/deps/lcb/src/capi/cmd_subdoc.hh +12 -0
  19. package/deps/lcb/src/capi/cmd_touch.hh +12 -0
  20. package/deps/lcb/src/capi/cmd_unlock.hh +12 -0
  21. package/deps/lcb/src/capi/collection_qualifier.hh +4 -6
  22. package/deps/lcb/src/internal.h +2 -1
  23. package/deps/lcb/src/mcserver/negotiate.cc +3 -0
  24. package/deps/lcb/src/n1ql/n1ql.cc +5 -1
  25. package/deps/lcb/src/n1ql/query_handle.cc +55 -30
  26. package/deps/lcb/src/n1ql/query_handle.hh +14 -2
  27. package/deps/lcb/src/operations/counter.cc +12 -0
  28. package/deps/lcb/src/operations/exists.cc +12 -0
  29. package/deps/lcb/src/operations/get.cc +12 -0
  30. package/deps/lcb/src/operations/get_replica.cc +18 -6
  31. package/deps/lcb/src/operations/remove.cc +12 -0
  32. package/deps/lcb/src/operations/store.cc +12 -0
  33. package/deps/lcb/src/operations/subdoc.cc +12 -0
  34. package/deps/lcb/src/operations/touch.cc +12 -0
  35. package/deps/lcb/src/operations/unlock.cc +12 -0
  36. package/deps/lcb/src/search/search_handle.cc +1 -2
  37. package/deps/lcb/src/ssl/ssl_common.c +1 -1
  38. package/deps/lcb/src/utilities.cc +21 -0
  39. package/deps/lcb/src/utilities.h +3 -0
  40. package/deps/lcb/tests/iotests/mock-environment.cc +10 -1
  41. package/deps/lcb/tests/iotests/mock-environment.h +2 -1
  42. package/deps/lcb/tests/iotests/serverparams.h +7 -2
  43. package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
  44. package/deps/lcb/tests/iotests/testutil.cc +174 -0
  45. package/deps/lcb/tests/iotests/testutil.h +53 -0
  46. package/dist/analyticsexecutor.js +2 -2
  47. package/dist/analyticsindexmanager.js +3 -3
  48. package/dist/binarycollection.d.ts +17 -0
  49. package/dist/binding.js +1 -1
  50. package/dist/bindingutilities.js +5 -1
  51. package/dist/bucketmanager.d.ts +1 -22
  52. package/dist/bucketmanager.js +5 -5
  53. package/dist/cluster.js +1 -1
  54. package/dist/collection.js +6 -6
  55. package/dist/collectionmanager.js +2 -2
  56. package/dist/connection.js +3 -3
  57. package/dist/connspec.js +5 -1
  58. package/dist/couchbase.js +5 -1
  59. package/dist/httpexecutor.js +5 -1
  60. package/dist/logging.js +1 -1
  61. package/dist/queryexecutor.js +3 -3
  62. package/dist/searchindexmanager.js +1 -1
  63. package/dist/usermanager.js +2 -2
  64. package/dist/utilities.d.ts +1 -2
  65. package/dist/utilities.js +9 -2
  66. package/dist/viewexecutor.js +1 -1
  67. package/package.json +1 -1
  68. package/src/uv-plugin-all.cpp +1 -0
  69. package/dist/cas.d.ts +0 -0
  70. package/dist/cas.js +0 -1
package/binding.gyp CHANGED
@@ -67,6 +67,11 @@
67
67
  '-pedantic',
68
68
  '-std=gnu99',
69
69
  ]
70
+ }],
71
+ ['OS=="linux"', {
72
+ "libraries": [
73
+ '-static-libgcc -static-libstdc++',
74
+ ]
70
75
  }]
71
76
  ],
72
77
  'sources': [
@@ -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.4 LANGUAGES C CXX)
33
+ project(libcouchbase VERSION 3.2.5 LANGUAGES C CXX)
34
34
 
35
35
  if (NOT CMAKE_VERSION VERSION_LESS "3.13")
36
36
  # CMP0077: option() honors normal variables
@@ -1,5 +1,17 @@
1
1
  # Release Notes
2
2
 
3
+ ## 3.2.5 (2022-02-08)
4
+
5
+ CCBC-1486: Add support for preserve expiry to query options
6
+ CCBC-1534, CCBC-1411: improve query error handling
7
+ CCBC-1519: pass extra privilege with KV "on-behalf-of".
8
+ CCBC-1521: fix bootstrap process when client cert is used and error map is supported. If client cert auth is used, once
9
+ the error map response has been received, the negotiation is complete.
10
+ CCBC-1529: load authentication certificate as chain file.
11
+ CCBC-1525: remove stringstream in `collection_qualifier`. Constructing a stringstream object every time
12
+ `collection_qualifier` is constructed is very expensive.
13
+ CCBC-1528: update parsing of "quota limit" error for FTS
14
+
3
15
  ## 3.2.4 (2021-11-23)
4
16
 
5
17
  CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
@@ -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.5")
68
+ SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.6")
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}")
@@ -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.4
41
+ PROJECT_NUMBER = 3.2.5
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
@@ -33,7 +33,7 @@
33
33
  */
34
34
 
35
35
  /** @brief libcouchbase version string */
36
- #define LCB_VERSION_STRING "3.2.4-njs"
36
+ #define LCB_VERSION_STRING "3.2.5-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 0x030204
53
+ #define LCB_VERSION 0x030205
54
54
 
55
55
  /**@brief The SCM revision ID
56
56
  * @see LCB_CNTL_CHANGESET
57
57
  */
58
- #define LCB_VERSION_CHANGESET "38cc0708dfcc5a706c6b21dc80bcd84f05890225"
58
+ #define LCB_VERSION_CHANGESET "e4de408c96550b48745b3a142d9827c898d4e96f"
59
59
 
60
60
  /**@brief The client ID
61
61
  */
@@ -710,6 +710,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_timeout(lcb_CMDGET *cmd, uint32_t timeout
710
710
  * @internal Internal: This should never be used and is not supported.
711
711
  */
712
712
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_on_behalf_of(lcb_CMDGET *cmd, const char *data, size_t data_len);
713
+ /**
714
+ * @internal Internal: This should never be used and is not supported.
715
+ */
716
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_on_behalf_of_extra_privilege(lcb_CMDGET *cmd, const char *privilege,
717
+ size_t privilege_len);
713
718
 
714
719
  LIBCOUCHBASE_API lcb_STATUS lcb_get(lcb_INSTANCE *instance, void *cookie, const lcb_CMDGET *cmd);
715
720
  /**@}*/
@@ -816,6 +821,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_timeout(lcb_CMDGETREPLICA *cmd, ui
816
821
  * @internal Internal: This should never be used and is not supported.
817
822
  */
818
823
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_on_behalf_of(lcb_CMDGETREPLICA *cmd, const char *data, size_t data_len);
824
+ /**
825
+ * @internal Internal: This should never be used and is not supported.
826
+ */
827
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_on_behalf_of_extra_privilege(lcb_CMDGETREPLICA *cmd,
828
+ const char *privilege, size_t privilege_len);
819
829
  LIBCOUCHBASE_API lcb_STATUS lcb_getreplica(lcb_INSTANCE *instance, void *cookie, const lcb_CMDGETREPLICA *cmd);
820
830
 
821
831
  /**@}*/
@@ -843,6 +853,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_timeout(lcb_CMDEXISTS *cmd, uint32_t t
843
853
  * @internal Internal: This should never be used and is not supported.
844
854
  */
845
855
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_on_behalf_of(lcb_CMDEXISTS *cmd, const char *data, size_t data_len);
856
+ /**
857
+ * @internal Internal: This should never be used and is not supported.
858
+ */
859
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_on_behalf_of_extra_privilege(lcb_CMDEXISTS *cmd, const char *privilege,
860
+ size_t privilege_len);
846
861
 
847
862
  LIBCOUCHBASE_API lcb_STATUS lcb_exists(lcb_INSTANCE *instance, void *cookie, const lcb_CMDEXISTS *cmd);
848
863
 
@@ -994,6 +1009,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_timeout(lcb_CMDSTORE *cmd, uint32_t tim
994
1009
  * @internal Internal: This should never be used and is not supported.
995
1010
  */
996
1011
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_on_behalf_of(lcb_CMDSTORE *cmd, const char *data, size_t data_len);
1012
+ /**
1013
+ * @internal Internal: This should never be used and is not supported.
1014
+ */
1015
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_on_behalf_of_extra_privilege(lcb_CMDSTORE *cmd, const char *privilege,
1016
+ size_t privilege_len);
997
1017
  LIBCOUCHBASE_API lcb_STATUS lcb_store(lcb_INSTANCE *instance, void *cookie, const lcb_CMDSTORE *cmd);
998
1018
  /**@}*/
999
1019
 
@@ -1103,6 +1123,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_timeout(lcb_CMDREMOVE *cmd, uint32_t t
1103
1123
  * @internal Internal: This should never be used and is not supported.
1104
1124
  */
1105
1125
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_on_behalf_of(lcb_CMDREMOVE *cmd, const char *data, size_t data_len);
1126
+ /**
1127
+ * @internal Internal: This should never be used and is not supported.
1128
+ */
1129
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_on_behalf_of_extra_privilege(lcb_CMDREMOVE *cmd, const char *privilege,
1130
+ size_t privilege_len);
1106
1131
  LIBCOUCHBASE_API lcb_STATUS lcb_remove(lcb_INSTANCE *instance, void *cookie, const lcb_CMDREMOVE *cmd);
1107
1132
 
1108
1133
  /**@}*/
@@ -1196,6 +1221,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_timeout(lcb_CMDCOUNTER *cmd, uint32_t
1196
1221
  * @internal Internal: This should never be used and is not supported.
1197
1222
  */
1198
1223
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_on_behalf_of(lcb_CMDCOUNTER *cmd, const char *data, size_t data_len);
1224
+ /**
1225
+ * @internal Internal: This should never be used and is not supported.
1226
+ */
1227
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_on_behalf_of_extra_privilege(lcb_CMDCOUNTER *cmd, const char *privilege,
1228
+ size_t privilege_len);
1199
1229
  LIBCOUCHBASE_API lcb_STATUS lcb_counter(lcb_INSTANCE *instance, void *cookie, const lcb_CMDCOUNTER *cmd);
1200
1230
 
1201
1231
  /**@} (Group: Counter) */
@@ -1277,6 +1307,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_timeout(lcb_CMDUNLOCK *cmd, uint32_t t
1277
1307
  * @internal Internal: This should never be used and is not supported.
1278
1308
  */
1279
1309
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_on_behalf_of(lcb_CMDUNLOCK *cmd, const char *data, size_t data_len);
1310
+ /**
1311
+ * @internal Internal: This should never be used and is not supported.
1312
+ */
1313
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_on_behalf_of_extra_privilege(lcb_CMDUNLOCK *cmd, const char *privilege,
1314
+ size_t privilege_len);
1280
1315
  LIBCOUCHBASE_API lcb_STATUS lcb_unlock(lcb_INSTANCE *instance, void *cookie, const lcb_CMDUNLOCK *cmd);
1281
1316
 
1282
1317
  /**@} (Group: Unlock) */
@@ -1348,6 +1383,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_timeout(lcb_CMDTOUCH *cmd, uint32_t tim
1348
1383
  * @internal Internal: This should never be used and is not supported.
1349
1384
  */
1350
1385
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_on_behalf_of(lcb_CMDTOUCH *cmd, const char *data, size_t data_len);
1386
+ /**
1387
+ * @internal Internal: This should never be used and is not supported.
1388
+ */
1389
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_on_behalf_of_extra_privilege(lcb_CMDTOUCH *cmd, const char *privilege,
1390
+ size_t privilege_len);
1351
1391
  LIBCOUCHBASE_API lcb_STATUS lcb_touch(lcb_INSTANCE *instance, void *cookie, const lcb_CMDTOUCH *cmd);
1352
1392
 
1353
1393
  /**@} (Group: Touch) */
@@ -3070,6 +3110,16 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_option(lcb_CMDQUERY *cmd, const char *n
3070
3110
  size_t value_len);
3071
3111
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_handle(lcb_CMDQUERY *cmd, lcb_QUERY_HANDLE **handle);
3072
3112
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_timeout(lcb_CMDQUERY *cmd, uint32_t timeout);
3113
+ /**
3114
+ * @uncommitted
3115
+ * Indicates that the query engine to preserve expiration values set on any
3116
+ * documents modified by this query.
3117
+ *
3118
+ *
3119
+ * @param cmd the command
3120
+ * @param preserve_expiry if non-zero, the query will preserve expiration values
3121
+ */
3122
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_preserve_expiry(lcb_CMDQUERY *cmd, int preserve_expiry);
3073
3123
 
3074
3124
  /**
3075
3125
  * @internal Internal: This should never be used and is not supported.
@@ -3290,6 +3340,8 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_timeout(lcb_CMDSUBDOC *cmd, uint32_t t
3290
3340
  * @internal Internal: This should never be used and is not supported.
3291
3341
  */
3292
3342
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_on_behalf_of(lcb_CMDSUBDOC *cmd, const char *data, size_t data_len);
3343
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_on_behalf_of_extra_privilege(lcb_CMDSUBDOC *cmd, const char *privilege,
3344
+ size_t privilege_len);
3293
3345
 
3294
3346
  LIBCOUCHBASE_API lcb_STATUS lcb_subdoc(lcb_INSTANCE *instance, void *cookie, const lcb_CMDSUBDOC *cmd);
3295
3347
  /** @} */
@@ -250,6 +250,8 @@ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_rc(const lcb_QUERY_ERROR_CONTEXT *c
250
250
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_code(const lcb_QUERY_ERROR_CONTEXT *ctx, uint32_t *code);
251
251
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_message(const lcb_QUERY_ERROR_CONTEXT *ctx,
252
252
  const char **message, size_t *message_len);
253
+ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_error_response_body(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **body,
254
+ size_t *body_len);
253
255
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_statement(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **statement,
254
256
  size_t *statement_len);
255
257
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_client_context_id(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **id,
@@ -388,7 +390,8 @@ lcb_errmap_callback lcb_set_errmap_callback(lcb_INSTANCE *instance, lcb_errmap_c
388
390
  X(LCB_RETRY_REASON_CIRCUIT_BREAKER_OPEN, 13, 1, 0) \
389
391
  X(LCB_RETRY_REASON_QUERY_PREPARED_STATEMENT_FAILURE, 14, 1, 0) \
390
392
  X(LCB_RETRY_REASON_ANALYTICS_TEMPORARY_FAILURE, 15, 1, 0) \
391
- X(LCB_RETRY_REASON_SEARCH_TOO_MANY_REQUESTS, 16, 1, 0)
393
+ X(LCB_RETRY_REASON_SEARCH_TOO_MANY_REQUESTS, 16, 1, 0) \
394
+ X(LCB_RETRY_REASON_QUERY_ERROR_RETRYABLE, 17, 1, 0)
392
395
  /* clang-format on */
393
396
 
394
397
  typedef enum {
@@ -12,6 +12,7 @@
12
12
  'msvs_settings': {
13
13
  'VCCLCompilerTool': {
14
14
  'RuntimeLibrary': 1, # static debug
15
+ 'ExceptionHandling': 2
15
16
  },
16
17
  },
17
18
  },
@@ -20,6 +21,7 @@
20
21
  'msvs_settings': {
21
22
  'VCCLCompilerTool': {
22
23
  'RuntimeLibrary': 0, # static release
24
+ 'ExceptionHandling': 2
23
25
  },
24
26
  },
25
27
  }
@@ -64,6 +66,11 @@
64
66
  ]
65
67
  }
66
68
  }],
69
+ ['OS=="linux"', {
70
+ "libraries": [
71
+ '-static-libgcc -static-libstdc++',
72
+ ]
73
+ }],
67
74
  ]
68
75
  },
69
76
 
@@ -155,7 +162,6 @@
155
162
  'type': 'static_library',
156
163
  'sources': [
157
164
  'contrib/HdrHistogram_c/src/hdr_encoding.c',
158
- 'contrib/HdrHistogram_c/src/hdr_histogram_log_no_op.c',
159
165
  'contrib/HdrHistogram_c/src/hdr_histogram_log.c',
160
166
  'contrib/HdrHistogram_c/src/hdr_histogram.c',
161
167
  'contrib/HdrHistogram_c/src/hdr_interval_recorder.c',
@@ -187,6 +187,17 @@ struct lcb_CMDCOUNTER_ {
187
187
  return LCB_SUCCESS;
188
188
  }
189
189
 
190
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
191
+ {
192
+ extra_privileges_.emplace_back(std::move(privilege));
193
+ return LCB_SUCCESS;
194
+ }
195
+
196
+ const std::vector<std::string> &extra_privileges() const
197
+ {
198
+ return extra_privileges_;
199
+ }
200
+
190
201
  bool want_impersonation() const
191
202
  {
192
203
  return !impostor_.empty();
@@ -210,6 +221,7 @@ struct lcb_CMDCOUNTER_ {
210
221
  bool initialize_if_does_not_exist_{false};
211
222
  lcb_DURABILITY_LEVEL durability_level_{LCB_DURABILITYLEVEL_NONE};
212
223
  std::string impostor_{};
224
+ std::vector<std::string> extra_privileges_{};
213
225
  };
214
226
 
215
227
  /**
@@ -127,6 +127,17 @@ struct lcb_CMDEXISTS_ {
127
127
  return LCB_SUCCESS;
128
128
  }
129
129
 
130
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
131
+ {
132
+ extra_privileges_.emplace_back(std::move(privilege));
133
+ return LCB_SUCCESS;
134
+ }
135
+
136
+ const std::vector<std::string> &extra_privileges() const
137
+ {
138
+ return extra_privileges_;
139
+ }
140
+
130
141
  bool want_impersonation() const
131
142
  {
132
143
  return !impostor_.empty();
@@ -145,6 +156,7 @@ struct lcb_CMDEXISTS_ {
145
156
  void *cookie_{nullptr};
146
157
  std::string key_{};
147
158
  std::string impostor_{};
159
+ std::vector<std::string> extra_privileges_{};
148
160
  };
149
161
 
150
162
  /**
@@ -186,6 +186,17 @@ struct lcb_CMDGET_ {
186
186
  return LCB_SUCCESS;
187
187
  }
188
188
 
189
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
190
+ {
191
+ extra_privileges_.emplace_back(std::move(privilege));
192
+ return LCB_SUCCESS;
193
+ }
194
+
195
+ const std::vector<std::string> &extra_privileges() const
196
+ {
197
+ return extra_privileges_;
198
+ }
199
+
189
200
  bool want_impersonation() const
190
201
  {
191
202
  return !impostor_.empty();
@@ -208,6 +219,7 @@ struct lcb_CMDGET_ {
208
219
  get_mode mode_{get_mode::normal};
209
220
  bool cookie_is_callback_{false};
210
221
  std::string impostor_{};
222
+ std::vector<std::string> extra_privileges_{};
211
223
  };
212
224
 
213
225
  /** @private */
@@ -60,7 +60,8 @@ struct lcb_CMDGETREPLICA_ {
60
60
  return LCB_SUCCESS;
61
61
  }
62
62
 
63
- int selected_replica_index() const {
63
+ int selected_replica_index() const
64
+ {
64
65
  return select_index_;
65
66
  }
66
67
 
@@ -162,6 +163,17 @@ struct lcb_CMDGETREPLICA_ {
162
163
  return LCB_SUCCESS;
163
164
  }
164
165
 
166
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
167
+ {
168
+ extra_privileges_.emplace_back(std::move(privilege));
169
+ return LCB_SUCCESS;
170
+ }
171
+
172
+ const std::vector<std::string> &extra_privileges() const
173
+ {
174
+ return extra_privileges_;
175
+ }
176
+
165
177
  bool want_impersonation() const
166
178
  {
167
179
  return !impostor_.empty();
@@ -182,6 +194,7 @@ struct lcb_CMDGETREPLICA_ {
182
194
  get_replica_mode mode_{get_replica_mode::any};
183
195
  int select_index_{0};
184
196
  std::string impostor_{};
197
+ std::vector<std::string> extra_privileges_{};
185
198
  };
186
199
 
187
200
  struct lcb_RESPGETREPLICA_ {
@@ -268,6 +268,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_on_behalf_of(lcb_CMDQUERY *cmd, const c
268
268
  return cmd->on_behalf_of(std::string(data, data_len));
269
269
  }
270
270
 
271
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_preserve_expiry(lcb_CMDQUERY *cmd, int preserve_expiry)
272
+ {
273
+ return cmd->preserve_expiry(preserve_expiry);
274
+ }
275
+
271
276
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_rc(const lcb_QUERY_ERROR_CONTEXT *ctx)
272
277
  {
273
278
  return ctx->rc;
@@ -287,6 +292,14 @@ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_message(const lcb_QUERY
287
292
  return LCB_SUCCESS;
288
293
  }
289
294
 
295
+ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_error_response_body(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **body,
296
+ size_t *body_len)
297
+ {
298
+ *body = ctx->error_response_body;
299
+ *body_len = ctx->error_response_body_len;
300
+ return LCB_SUCCESS;
301
+ }
302
+
290
303
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_statement(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **statement,
291
304
  size_t *statement_len)
292
305
  {
@@ -30,20 +30,22 @@
30
30
  */
31
31
  struct lcb_QUERY_ERROR_CONTEXT_ {
32
32
  lcb_STATUS rc;
33
- uint32_t first_error_code;
34
- const char *first_error_message;
35
- size_t first_error_message_len;
36
- const char *statement;
37
- size_t statement_len;
38
- const char *client_context_id;
39
- size_t client_context_id_len;
40
- const char *query_params;
41
- size_t query_params_len;
42
- uint32_t http_response_code;
43
- const char *http_response_message;
44
- size_t http_response_message_len;
45
- const char *endpoint;
46
- size_t endpoint_len;
33
+ uint32_t first_error_code{};
34
+ const char *first_error_message{};
35
+ size_t first_error_message_len{};
36
+ const char *error_response_body{};
37
+ size_t error_response_body_len{};
38
+ const char *statement{};
39
+ size_t statement_len{};
40
+ const char *client_context_id{};
41
+ size_t client_context_id_len{};
42
+ const char *query_params{};
43
+ size_t query_params_len{};
44
+ uint32_t http_response_code{};
45
+ const char *http_response_message{};
46
+ size_t http_response_message_len{};
47
+ const char *endpoint{};
48
+ size_t endpoint_len{};
47
49
  };
48
50
 
49
51
  /**
@@ -203,6 +205,12 @@ struct lcb_CMDQUERY_ {
203
205
  return LCB_SUCCESS;
204
206
  }
205
207
 
208
+ lcb_STATUS preserve_expiry(bool preserve_expiry)
209
+ {
210
+ root_["preserve_expiry"] = preserve_expiry;
211
+ return LCB_SUCCESS;
212
+ }
213
+
206
214
  lcb_STATUS callback(lcb_QUERY_CALLBACK row_callback)
207
215
  {
208
216
  callback_ = row_callback;
@@ -154,6 +154,17 @@ struct lcb_CMDREMOVE_ {
154
154
  return LCB_SUCCESS;
155
155
  }
156
156
 
157
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
158
+ {
159
+ extra_privileges_.emplace_back(std::move(privilege));
160
+ return LCB_SUCCESS;
161
+ }
162
+
163
+ const std::vector<std::string> &extra_privileges() const
164
+ {
165
+ return extra_privileges_;
166
+ }
167
+
157
168
  bool want_impersonation() const
158
169
  {
159
170
  return !impostor_.empty();
@@ -174,6 +185,7 @@ struct lcb_CMDREMOVE_ {
174
185
  std::uint64_t cas_{0};
175
186
  lcb_DURABILITY_LEVEL durability_level_{LCB_DURABILITYLEVEL_NONE};
176
187
  std::string impostor_{};
188
+ std::vector<std::string> extra_privileges_{};
177
189
  };
178
190
 
179
191
  /**
@@ -371,6 +371,17 @@ struct lcb_CMDSTORE_ {
371
371
  return LCB_SUCCESS;
372
372
  }
373
373
 
374
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
375
+ {
376
+ extra_privileges_.emplace_back(std::move(privilege));
377
+ return LCB_SUCCESS;
378
+ }
379
+
380
+ const std::vector<std::string> &extra_privileges() const
381
+ {
382
+ return extra_privileges_;
383
+ }
384
+
374
385
  bool want_impersonation() const
375
386
  {
376
387
  return !impostor_.empty();
@@ -402,6 +413,7 @@ struct lcb_CMDSTORE_ {
402
413
  bool cookie_is_callback_{false};
403
414
  bool preserve_expiry_{false};
404
415
  std::string impostor_{};
416
+ std::vector<std::string> extra_privileges_{};
405
417
  };
406
418
 
407
419
  /**
@@ -445,6 +445,17 @@ struct lcb_CMDSUBDOC_ {
445
445
  return LCB_SUCCESS;
446
446
  }
447
447
 
448
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
449
+ {
450
+ extra_privileges_.emplace_back(std::move(privilege));
451
+ return LCB_SUCCESS;
452
+ }
453
+
454
+ const std::vector<std::string> &extra_privileges() const
455
+ {
456
+ return extra_privileges_;
457
+ }
458
+
448
459
  bool want_impersonation() const
449
460
  {
450
461
  return !impostor_.empty();
@@ -469,6 +480,7 @@ struct lcb_CMDSUBDOC_ {
469
480
  lcb_SUBDOCSPECS_ specs_{};
470
481
  bool preserve_expiry_{false};
471
482
  std::string impostor_{};
483
+ std::vector<std::string> extra_privileges_{};
472
484
  };
473
485
 
474
486
  /**
@@ -138,6 +138,17 @@ struct lcb_CMDTOUCH_ {
138
138
  return LCB_SUCCESS;
139
139
  }
140
140
 
141
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
142
+ {
143
+ extra_privileges_.emplace_back(std::move(privilege));
144
+ return LCB_SUCCESS;
145
+ }
146
+
147
+ const std::vector<std::string> &extra_privileges() const
148
+ {
149
+ return extra_privileges_;
150
+ }
151
+
141
152
  bool want_impersonation() const
142
153
  {
143
154
  return !impostor_.empty();
@@ -157,6 +168,7 @@ struct lcb_CMDTOUCH_ {
157
168
  void *cookie_{nullptr};
158
169
  std::string key_{};
159
170
  std::string impostor_{};
171
+ std::vector<std::string> extra_privileges_{};
160
172
  };
161
173
 
162
174
  /**
@@ -141,6 +141,17 @@ struct lcb_CMDUNLOCK_ {
141
141
  return LCB_SUCCESS;
142
142
  }
143
143
 
144
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
145
+ {
146
+ extra_privileges_.emplace_back(std::move(privilege));
147
+ return LCB_SUCCESS;
148
+ }
149
+
150
+ const std::vector<std::string> &extra_privileges() const
151
+ {
152
+ return extra_privileges_;
153
+ }
154
+
144
155
  bool want_impersonation() const
145
156
  {
146
157
  return !impostor_.empty();
@@ -160,6 +171,7 @@ struct lcb_CMDUNLOCK_ {
160
171
  std::string key_{};
161
172
  std::uint64_t cas_{};
162
173
  std::string impostor_{};
174
+ std::vector<std::string> extra_privileges_{};
163
175
  };
164
176
 
165
177
  /**
@@ -21,7 +21,6 @@
21
21
  #include <cstddef>
22
22
  #include <cstdint>
23
23
  #include <string>
24
- #include <sstream>
25
24
  #include <stdexcept>
26
25
 
27
26
  namespace lcb
@@ -48,11 +47,10 @@ struct collection_qualifier {
48
47
  if (collection_name != nullptr && collection_name_len > 0) {
49
48
  collection_.assign(collection_name, collection_name_len);
50
49
  }
51
- std::stringstream ss;
52
- ss << (scope_.empty() ? "_default" : scope_);
53
- ss << '.';
54
- ss << (collection_.empty() ? "_default" : collection_);
55
- spec_ = ss.str();
50
+
51
+ spec_ = (scope_.empty() ? "_default" : scope_) +
52
+ '.' +
53
+ (collection_.empty() ? "_default" : collection_);
56
54
  }
57
55
 
58
56
  const std::string &scope() const
@@ -259,7 +259,8 @@ lcb_STATUS lcb_initialize_socket_subsystem(void);
259
259
  lcb_STATUS lcb_reinit(lcb_INSTANCE *obj, const char *connstr);
260
260
 
261
261
  lcb_RETRY_ACTION lcb_kv_should_retry(const lcb_settings *settings, const mc_PACKET *pkt, lcb_STATUS err);
262
- lcb_RETRY_ACTION lcb_query_should_retry(const lcb_settings *settings, lcb_QUERY_HANDLE *query, lcb_STATUS err);
262
+ lcb_RETRY_ACTION lcb_query_should_retry(const lcb_settings *settings, lcb_QUERY_HANDLE *query, lcb_STATUS err,
263
+ int retry_attribute);
263
264
 
264
265
  lcb_RESPCALLBACK lcb_find_callback(lcb_INSTANCE *instance, lcb_CALLBACK_TYPE cbtype);
265
266
 
@@ -660,6 +660,9 @@ GT_NEXT_PACKET:
660
660
  status);
661
661
  set_error(LCB_ERR_PROTOCOL_ERROR, "GET_ERRMAP response unexpected", &resp);
662
662
  }
663
+ if (settings->keypath) {
664
+ completed = !maybe_select_bucket();
665
+ }
663
666
  // Note, there is no explicit state transition here. LIST_MECHS is
664
667
  // pipelined after this request.
665
668
  break;
@@ -52,10 +52,14 @@ static lcb_RETRY_REASON query_code_to_reason(lcb_STATUS err)
52
52
  }
53
53
  }
54
54
 
55
- lcb_RETRY_ACTION lcb_query_should_retry(const lcb_settings *settings, lcb_QUERY_HANDLE *query, lcb_STATUS err)
55
+ lcb_RETRY_ACTION lcb_query_should_retry(const lcb_settings *settings, lcb_QUERY_HANDLE *query, lcb_STATUS err,
56
+ int retry_attribute)
56
57
  {
57
58
  lcb_RETRY_ACTION retry_action{};
58
59
  lcb_RETRY_REASON retry_reason = query_code_to_reason(err);
60
+ if (retry_attribute) {
61
+ retry_reason = LCB_RETRY_REASON_QUERY_ERROR_RETRYABLE;
62
+ }
59
63
  if (err == LCB_ERR_TIMEOUT) {
60
64
  /* We can't exceed a timeout for ETIMEDOUT */
61
65
  retry_action.should_retry = 0;