couchbase 4.4.2 → 4.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. package/BUILDING.md +182 -0
  2. package/CMakeLists.txt +13 -0
  3. package/CONTRIBUTING.md +1 -1
  4. package/README.md +4 -2
  5. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/BUILDING.md +206 -0
  6. package/deps/couchbase-cxx-client/CMakeLists.txt +18 -13
  7. package/deps/couchbase-cxx-client/README.md +2 -2
  8. package/deps/couchbase-cxx-client/cmake/APKBUILD.in +54 -0
  9. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +0 -5
  10. package/deps/couchbase-cxx-client/cmake/Packaging.cmake +177 -10
  11. package/deps/couchbase-cxx-client/cmake/RPath.cmake +10 -0
  12. package/deps/couchbase-cxx-client/cmake/Testing.cmake +1 -1
  13. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +28 -2
  14. package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
  15. package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +45 -6
  16. package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +2 -2
  17. package/deps/couchbase-cxx-client/cmake/debian/changelog.in +5 -0
  18. package/deps/couchbase-cxx-client/cmake/debian/compat +1 -0
  19. package/deps/couchbase-cxx-client/cmake/debian/control +40 -0
  20. package/deps/couchbase-cxx-client/cmake/debian/rules +41 -0
  21. package/deps/couchbase-cxx-client/cmake/debian/source/format +1 -0
  22. package/deps/couchbase-cxx-client/core/agent_group.cxx +8 -0
  23. package/deps/couchbase-cxx-client/core/agent_group.hxx +4 -0
  24. package/deps/couchbase-cxx-client/core/bucket.cxx +16 -20
  25. package/deps/couchbase-cxx-client/core/bucket.hxx +12 -12
  26. package/deps/couchbase-cxx-client/core/cluster.cxx +44 -52
  27. package/deps/couchbase-cxx-client/core/cluster_agent.cxx +8 -0
  28. package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -0
  29. package/deps/couchbase-cxx-client/core/collections_component.cxx +2 -2
  30. package/deps/couchbase-cxx-client/core/columnar/agent.cxx +2 -2
  31. package/deps/couchbase-cxx-client/core/columnar/agent.hxx +1 -1
  32. package/deps/couchbase-cxx-client/core/columnar/management_component.cxx +3 -3
  33. package/deps/couchbase-cxx-client/core/columnar/query_component.cxx +103 -45
  34. package/deps/couchbase-cxx-client/core/columnar/query_component.hxx +1 -0
  35. package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +8 -0
  36. package/deps/couchbase-cxx-client/core/http_component.cxx +55 -24
  37. package/deps/couchbase-cxx-client/core/http_component.hxx +4 -0
  38. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
  39. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +15 -15
  40. package/deps/couchbase-cxx-client/core/impl/bootstrap_error.hxx +10 -2
  41. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +1 -1
  42. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +6 -6
  43. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +36 -40
  44. package/deps/couchbase-cxx-client/core/impl/collection.cxx +29 -5
  45. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +5 -5
  46. package/deps/couchbase-cxx-client/core/impl/error.cxx +24 -3
  47. package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
  48. package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +2 -0
  49. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +13 -5
  50. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -3
  51. package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
  52. package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
  53. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
  54. package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +1 -1
  55. package/deps/couchbase-cxx-client/core/impl/search.cxx +2 -0
  56. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +12 -12
  57. package/deps/couchbase-cxx-client/core/io/http_command.hxx +31 -20
  58. package/deps/couchbase-cxx-client/core/io/http_session.cxx +5 -0
  59. package/deps/couchbase-cxx-client/core/io/http_session.hxx +17 -4
  60. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +97 -49
  61. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +15 -14
  62. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
  63. package/deps/couchbase-cxx-client/core/io/streams.cxx +256 -0
  64. package/deps/couchbase-cxx-client/core/io/streams.hxx +31 -155
  65. package/deps/couchbase-cxx-client/core/logger/configuration.hxx +5 -0
  66. package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +2 -3
  67. package/deps/couchbase-cxx-client/core/logger/logger.cxx +39 -7
  68. package/deps/couchbase-cxx-client/core/logger/logger.hxx +7 -0
  69. package/deps/couchbase-cxx-client/core/meta/features.hxx +11 -0
  70. package/deps/couchbase-cxx-client/core/meta/version.cxx +47 -6
  71. package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.cxx +188 -0
  72. package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.hxx +73 -0
  73. package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +23 -17
  74. package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +1 -0
  75. package/deps/couchbase-cxx-client/core/operations/document_append.hxx +2 -0
  76. package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +2 -0
  77. package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +2 -0
  78. package/deps/couchbase-cxx-client/core/operations/document_get.hxx +2 -0
  79. package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +2 -0
  80. package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +2 -0
  81. package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +2 -0
  82. package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +2 -0
  83. package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +2 -0
  84. package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +2 -0
  85. package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +2 -0
  86. package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +2 -0
  87. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +2 -0
  88. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +2 -0
  89. package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +2 -0
  90. package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +2 -0
  91. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
  92. package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +2 -0
  93. package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +2 -0
  94. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -0
  95. package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +2 -0
  96. package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +2 -0
  97. package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +2 -0
  98. package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
  99. package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
  100. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +1 -0
  101. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +1 -0
  102. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +1 -0
  103. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +1 -0
  104. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +1 -0
  105. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
  106. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +1 -0
  107. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +1 -0
  108. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +1 -0
  109. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +1 -0
  110. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +1 -0
  111. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +1 -0
  112. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +1 -0
  113. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +23 -15
  114. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +4 -3
  115. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +1 -0
  116. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +1 -0
  117. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -1
  118. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +1 -0
  119. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +3 -1
  120. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +1 -0
  121. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +3 -1
  122. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +1 -0
  123. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +3 -1
  124. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +1 -0
  125. package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +1 -0
  126. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +3 -1
  127. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +1 -0
  128. package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +1 -0
  129. package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +1 -0
  130. package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +1 -0
  131. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +3 -2
  132. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
  133. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +5 -2
  134. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +1 -0
  135. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +4 -2
  136. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
  137. package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
  138. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +3 -2
  139. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +3 -2
  140. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +3 -2
  141. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +3 -2
  142. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +3 -2
  143. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +3 -2
  144. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +3 -2
  145. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +3 -2
  146. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +3 -2
  147. package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
  148. package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +1 -0
  149. package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +1 -0
  150. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +1 -0
  151. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +3 -3
  152. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +1 -0
  153. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
  154. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +3 -0
  155. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -0
  156. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +1 -0
  157. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +2 -0
  158. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -0
  159. package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +1 -0
  160. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -1
  161. package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +1 -0
  162. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +4 -1
  163. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +1 -0
  164. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +3 -1
  165. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +1 -0
  166. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +1 -0
  167. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +3 -2
  168. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +1 -0
  169. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +3 -2
  170. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +1 -0
  171. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +3 -2
  172. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +1 -0
  173. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +3 -2
  174. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +1 -0
  175. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +5 -2
  176. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +1 -0
  177. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +5 -2
  178. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +1 -0
  179. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +4 -2
  180. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +1 -0
  181. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +3 -2
  182. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
  183. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +1 -0
  184. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +5 -2
  185. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +1 -0
  186. package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +1 -0
  187. package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +1 -0
  188. package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +1 -0
  189. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +3 -3
  190. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +1 -0
  191. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -1
  192. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +1 -0
  193. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -1
  194. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +1 -0
  195. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +3 -1
  196. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
  197. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -1
  198. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +1 -0
  199. package/deps/couchbase-cxx-client/core/origin.cxx +37 -17
  200. package/deps/couchbase-cxx-client/core/platform/base64.cc +1 -1
  201. package/deps/couchbase-cxx-client/core/platform/random.cc +2 -0
  202. package/deps/couchbase-cxx-client/core/platform/uuid.h +6 -6
  203. package/deps/couchbase-cxx-client/core/row_streamer.cxx +1 -1
  204. package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +1 -1
  205. package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.h +4 -4
  206. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +2 -0
  207. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +8 -0
  208. package/deps/couchbase-cxx-client/core/tracing/constants.hxx +3 -0
  209. package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.cxx +87 -0
  210. package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.hxx +57 -0
  211. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +9 -21
  212. package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +6 -33
  213. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +57 -56
  214. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +17 -18
  215. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +2 -2
  216. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +2 -2
  217. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +0 -20
  218. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +2 -2
  219. package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +128 -52
  220. package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +4 -3
  221. package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +1 -1
  222. package/deps/couchbase-cxx-client/couchbase/common_options.hxx +16 -1
  223. package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +16 -20
  224. package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +2 -2
  225. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +4 -3
  226. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +1 -1
  227. package/dist/analyticsindexmanager.d.ts +98 -14
  228. package/dist/analyticsindexmanager.js +452 -411
  229. package/dist/binding.d.ts +53 -4
  230. package/dist/bindingutilities.d.ts +26 -1
  231. package/dist/bindingutilities.js +108 -1
  232. package/dist/couchbase.d.ts +3 -1
  233. package/dist/couchbase.js +2 -0
  234. package/dist/rangeScan.d.ts +1 -1
  235. package/dist/rangeScan.js +1 -1
  236. package/dist/transactions.d.ts +34 -3
  237. package/dist/transactions.js +25 -18
  238. package/dist/transcoders.d.ts +68 -0
  239. package/dist/transcoders.js +194 -1
  240. package/dist/usermanager.d.ts +14 -14
  241. package/dist/usermanager.js +178 -228
  242. package/dist/utilities.js +4 -6
  243. package/dist/utilities_internal.js +1 -2
  244. package/package.json +9 -8
  245. package/src/binding.cpp +13 -13
  246. package/src/connection.cpp +22 -0
  247. package/src/connection.hpp +12 -0
  248. package/src/connection_autogen.cpp +100 -0
  249. package/src/jstocbpp_autogen.hpp +315 -8
  250. package/src/jstocbpp_transactions.hpp +1 -2
  251. package/tools/gen-bindings-js.js +38 -3
  252. package/tools/gen-bindings-json.py +575 -328
@@ -18,6 +18,7 @@
18
18
  #include "view_index_get_all.hxx"
19
19
 
20
20
  #include "core/utils/json.hxx"
21
+ #include "core/utils/url_codec.hxx"
21
22
  #include "error_utils.hxx"
22
23
 
23
24
  #include <fmt/core.h>
@@ -30,7 +31,8 @@ view_index_get_all_request::encode_to(encoded_request_type& encoded,
30
31
  http_context& /* context */) const -> std::error_code
31
32
  {
32
33
  encoded.method = "GET";
33
- encoded.path = fmt::format("/pools/default/buckets/{}/ddocs", bucket_name);
34
+ encoded.path = fmt::format("/pools/default/buckets/{}/ddocs",
35
+ utils::string_codec::v2::path_escape(bucket_name));
34
36
  return {};
35
37
  }
36
38
 
@@ -38,6 +38,8 @@ struct view_index_get_all_request {
38
38
  using error_context_type = error_context::http;
39
39
 
40
40
  static const inline service_type type = service_type::management;
41
+ static const inline std::string observability_identifier =
42
+ "manager_views_get_all_design_documents";
41
43
 
42
44
  std::string bucket_name;
43
45
  design_document_namespace ns;
@@ -18,6 +18,7 @@
18
18
  #include "view_index_upsert.hxx"
19
19
 
20
20
  #include "core/utils/json.hxx"
21
+ #include "core/utils/url_codec.hxx"
21
22
  #include "error_utils.hxx"
22
23
 
23
24
  #include <fmt/core.h>
@@ -45,7 +46,7 @@ view_index_upsert_request::encode_to(encoded_request_type& encoded,
45
46
  encoded.headers["content-type"] = "application/json";
46
47
  encoded.method = "PUT";
47
48
  encoded.path = fmt::format("/{}/_design/{}{}",
48
- bucket_name,
49
+ utils::string_codec::v2::path_escape(bucket_name),
49
50
  document.ns == design_document_namespace::development ? "dev_" : "",
50
51
  document.name);
51
52
  encoded.body = utils::json::generate(body);
@@ -37,6 +37,7 @@ struct view_index_upsert_request {
37
37
  using error_context_type = error_context::http;
38
38
 
39
39
  static const inline service_type type = service_type::view;
40
+ static const inline std::string observability_identifier = "manager_views_upsert_design_document";
40
41
 
41
42
  std::string bucket_name;
42
43
  couchbase::core::management::views::design_document document;
@@ -210,6 +210,24 @@ struct traits<couchbase::transactions::transactions_config::built> {
210
210
  }
211
211
  };
212
212
 
213
+ template<>
214
+ struct traits<couchbase::core::columnar::security_options> {
215
+ template<template<typename...> class Traits>
216
+ static void assign(tao::json::basic_value<Traits>& v,
217
+ const couchbase::core::columnar::security_options& o)
218
+ {
219
+ v = {
220
+ { "trust_only_capella", o.trust_only_capella },
221
+ { "trust_only_pem_file", o.trust_only_pem_file },
222
+ { "trust_only_pem_string", o.trust_only_pem_string },
223
+ { "trust_only_platform", o.trust_only_platform },
224
+ { "trust_only_certificates", o.trust_only_certificates.size() },
225
+ // TODO(JC): add if/when we support the cipher_suites option
226
+ // { "cipher_suites", utils::join_strings(o.cipher_suites, ":") },
227
+ };
228
+ }
229
+ };
230
+
213
231
  } // namespace tao::json
214
232
 
215
233
  namespace couchbase::core
@@ -222,45 +240,47 @@ origin::to_json() const -> std::string
222
240
  "options",
223
241
  {
224
242
  { "bootstrap_timeout", options_.bootstrap_timeout },
225
- #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
226
- { "dispatch_timeout", options_.dispatch_timeout },
227
- #endif
228
243
  { "resolve_timeout", options_.resolve_timeout },
229
244
  { "connect_timeout", options_.connect_timeout },
245
+ { "query_timeout", options_.query_timeout },
246
+ { "management_timeout", options_.management_timeout },
247
+ { "trust_certificate", options_.trust_certificate },
248
+ { "use_ip_protocol", options_.use_ip_protocol },
249
+ { "enable_dns_srv", options_.enable_dns_srv },
250
+ { "dns_config", options_.dns_config },
251
+ { "enable_clustermap_notification", options_.enable_clustermap_notification },
252
+ { "config_poll_interval", options_.config_poll_interval },
253
+ { "config_poll_floor", options_.config_poll_floor },
254
+ { "user_agent_extra", options_.user_agent_extra },
255
+ { "dump_configuration", options_.dump_configuration },
256
+ { "disable_mozilla_ca_certificates", options_.disable_mozilla_ca_certificates },
257
+ { "network", options_.network },
258
+ { "tls_verify", options_.tls_verify },
259
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
260
+ { "dispatch_timeout", options_.dispatch_timeout },
261
+ { "security_options", options_.security_options },
262
+ #else
230
263
  { "key_value_timeout", options_.key_value_timeout },
231
264
  { "key_value_durable_timeout", options_.key_value_durable_timeout },
232
265
  { "view_timeout", options_.view_timeout },
233
- { "query_timeout", options_.query_timeout },
234
266
  { "analytics_timeout", options_.analytics_timeout },
235
267
  { "search_timeout", options_.search_timeout },
236
- { "management_timeout", options_.management_timeout },
237
268
  { "enable_tls", options_.enable_tls },
238
- { "trust_certificate", options_.trust_certificate },
239
269
  { "enable_mutation_tokens", options_.enable_mutation_tokens },
240
270
  { "enable_tcp_keep_alive", options_.enable_tcp_keep_alive },
241
- { "use_ip_protocol", options_.use_ip_protocol },
242
- { "enable_dns_srv", options_.enable_dns_srv },
243
- { "dns_config", options_.dns_config },
244
271
  { "show_queries", options_.show_queries },
245
272
  { "enable_unordered_execution", options_.enable_unordered_execution },
246
- { "enable_clustermap_notification", options_.enable_clustermap_notification },
247
273
  { "enable_compression", options_.enable_compression },
248
274
  { "enable_tracing", options_.enable_tracing },
249
275
  { "enable_metrics", options_.enable_metrics },
250
276
  { "tcp_keep_alive_interval", options_.tcp_keep_alive_interval },
251
- { "config_poll_interval", options_.config_poll_interval },
252
- { "config_poll_floor", options_.config_poll_floor },
253
277
  { "config_idle_redial_timeout", options_.config_idle_redial_timeout },
254
278
  { "max_http_connections", options_.max_http_connections },
255
279
  { "idle_http_connection_timeout", options_.idle_http_connection_timeout },
256
- { "user_agent_extra", options_.user_agent_extra },
257
- { "dump_configuration", options_.dump_configuration },
258
- { "disable_mozilla_ca_certificates", options_.disable_mozilla_ca_certificates },
259
280
  { "metrics_options", options_.metrics_options },
260
- { "network", options_.network },
261
- { "tls_verify", options_.tls_verify },
262
281
  { "tracing_options", options_.tracing_options },
263
282
  { "transactions_options", options_.transactions },
283
+ #endif
264
284
  },
265
285
  },
266
286
  };
@@ -182,7 +182,7 @@ encode(gsl::span<const std::byte> blob, bool pretty_print) -> std::string
182
182
  if (pretty_print) {
183
183
  // In pretty-print mode we insert a newline after adding
184
184
  // 16 chunks (four characters).
185
- result.reserve(chunks * 4 + chunks / 16);
185
+ result.reserve((chunks * 4) + (chunks / 16));
186
186
  } else {
187
187
  result.reserve(chunks * 4);
188
188
  }
@@ -82,6 +82,8 @@ public:
82
82
  #ifdef WIN32
83
83
  return CryptGenRandom(handle, (DWORD)size, static_cast<BYTE*>(dest));
84
84
  #else
85
+ // TODO(CXXCBC-549)
86
+ // NOLINTNEXTLINE(clang-analyzer-unix.BlockInCriticalSection)
85
87
  return static_cast<std::size_t>(read(handle, dest, size)) == size;
86
88
  #endif
87
89
  }
@@ -34,23 +34,23 @@ random(uuid_t& uuid);
34
34
  /**
35
35
  * Generate a new random uuid and return it
36
36
  */
37
- uuid_t
38
- random();
37
+ auto
38
+ random() -> uuid_t;
39
39
 
40
40
  /**
41
41
  * Convert a textual version of a UUID to a uuid type
42
42
  * @throw std::invalid_argument if the textual uuid is not
43
43
  * formatted correctly
44
44
  */
45
- uuid_t
46
- from_string(std::string_view str);
45
+ auto
46
+ from_string(std::string_view str) -> uuid_t;
47
47
 
48
48
  /**
49
49
  * Print a textual version of the UUID in the form:
50
50
  *
51
51
  * 00000000-0000-0000-0000-000000000000
52
52
  */
53
- std::string
54
- to_string(const couchbase::core::uuid::uuid_t& uuid);
53
+ auto
54
+ to_string(const couchbase::core::uuid::uuid_t& uuid) -> std::string;
55
55
 
56
56
  } // namespace couchbase::core::uuid
@@ -162,7 +162,7 @@ private:
162
162
 
163
163
  feeding_ = true;
164
164
 
165
- body_.next([self = shared_from_this()](auto data, auto ec) mutable {
165
+ body_.next([self = shared_from_this()](const auto& data, auto ec) mutable {
166
166
  if (ec) {
167
167
  self->received_all_data_ = true;
168
168
  auto signal = row_stream_end_signal{ ec };
@@ -44,7 +44,7 @@ namespace couchbase::core::sasl::mechanism::scram
44
44
  * - Tagging characters [StringPrep, C.9]
45
45
  */
46
46
  auto
47
- sasl_prep(const std::string& string) -> const std::string&
47
+ sasl_prep(const std::string& string) -> std::string
48
48
  {
49
49
  for (const auto& c : string) {
50
50
  if ((static_cast<unsigned int>(c) & 0x80U) != 0) {
@@ -32,8 +32,8 @@ namespace couchbase::core::sasl::mechanism::scram
32
32
  * @return a sasl_prep'd string
33
33
  * @throws std::runtime_error if we encounter a multibyte character
34
34
  */
35
- const std::string&
36
- sasl_prep(const std::string& string);
35
+ auto
36
+ sasl_prep(const std::string& string) -> std::string;
37
37
 
38
38
  /**
39
39
  * According to https://www.ietf.org/rfc/rfc5802.txt all occurrences
@@ -42,7 +42,7 @@ sasl_prep(const std::string& string);
42
42
  * @param username the username to encode
43
43
  * @return the escaped string
44
44
  */
45
- std::string
46
- encode_username(const std::string& username);
45
+ auto
46
+ encode_username(const std::string& username) -> std::string;
47
47
 
48
48
  } // namespace couchbase::core::sasl::mechanism::scram
@@ -100,6 +100,8 @@ struct configuration {
100
100
  std::optional<std::uint64_t> collections_manifest_uid{};
101
101
  configuration_capabilities capabilities{};
102
102
  node_locator_type node_locator{ node_locator_type::unknown };
103
+ std::optional<std::string> cluster_name{};
104
+ std::optional<std::string> cluster_uuid{};
103
105
  bool force{ false };
104
106
 
105
107
  auto operator==(const configuration& other) const -> bool
@@ -319,6 +319,14 @@ struct traits<couchbase::core::topology::configuration> {
319
319
  }
320
320
  }
321
321
  }
322
+
323
+ if (const auto n = v.find("clusterName"); n != nullptr) {
324
+ result.cluster_name = n->get_string();
325
+ }
326
+ if (const auto u = v.find("clusterUUID"); u != nullptr) {
327
+ result.cluster_uuid = u->get_string();
328
+ }
329
+
322
330
  return result;
323
331
  }
324
332
  };
@@ -78,6 +78,9 @@ constexpr auto mcbp_internal = "cb.internal";
78
78
  namespace attributes
79
79
  {
80
80
  constexpr auto system = "db.system";
81
+ constexpr auto cluster_name = "db.couchbase.cluster_name";
82
+ constexpr auto cluster_uuid = "db.couchbase.cluster_uuid";
83
+
81
84
  constexpr auto span_kind = "span.kind";
82
85
  constexpr auto component = "db.couchbase.component";
83
86
  constexpr auto instance = "db.instance";
@@ -0,0 +1,87 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2024. 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
+ #include "tracer_wrapper.hxx"
19
+
20
+ #include "constants.hxx"
21
+
22
+ #include <mutex>
23
+
24
+ namespace couchbase::core::tracing
25
+ {
26
+ tracer_wrapper::tracer_wrapper(std::shared_ptr<couchbase::tracing::request_tracer> tracer)
27
+ : tracer_{ std::move(tracer) }
28
+ {
29
+ }
30
+
31
+ void
32
+ tracer_wrapper::start()
33
+ {
34
+ tracer_->start();
35
+ }
36
+
37
+ void
38
+ tracer_wrapper::stop()
39
+ {
40
+ tracer_->stop();
41
+ }
42
+
43
+ auto
44
+ tracer_wrapper::create_span(std::string span_name,
45
+ std::shared_ptr<couchbase::tracing::request_span> parent_span)
46
+ -> std::shared_ptr<couchbase::tracing::request_span>
47
+ {
48
+ auto span = tracer_->start_span(std::move(span_name), std::move(parent_span));
49
+ span->add_tag(attributes::system, "couchbase");
50
+
51
+ std::optional<std::string> cluster_name;
52
+ std::optional<std::string> cluster_uuid;
53
+ {
54
+ const std::shared_lock lock{ cluster_labels_mutex_ };
55
+ cluster_name = cluster_name_;
56
+ cluster_uuid = cluster_uuid_;
57
+ }
58
+
59
+ if (cluster_name) {
60
+ span->add_tag(attributes::cluster_name, cluster_name.value());
61
+ }
62
+ if (cluster_uuid) {
63
+ span->add_tag(attributes::cluster_uuid, cluster_uuid.value());
64
+ }
65
+
66
+ return span;
67
+ }
68
+
69
+ void
70
+ tracer_wrapper::update_config(topology::configuration config)
71
+ {
72
+ const std::scoped_lock<std::shared_mutex> lock{ cluster_labels_mutex_ };
73
+ if (config.cluster_uuid.has_value()) {
74
+ cluster_uuid_ = config.cluster_uuid;
75
+ }
76
+ if (config.cluster_name.has_value()) {
77
+ cluster_name_ = config.cluster_name;
78
+ }
79
+ }
80
+
81
+ auto
82
+ tracer_wrapper::create(std::shared_ptr<couchbase::tracing::request_tracer> tracer)
83
+ -> std::shared_ptr<tracer_wrapper>
84
+ {
85
+ return std::make_shared<tracer_wrapper>(std::move(tracer));
86
+ }
87
+ } // namespace couchbase::core::tracing
@@ -0,0 +1,57 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2024. 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
+ #pragma once
19
+
20
+ #include "core/config_listener.hxx"
21
+ #include "core/topology/configuration.hxx"
22
+
23
+ #include <couchbase/tracing/request_span.hxx>
24
+ #include <couchbase/tracing/request_tracer.hxx>
25
+
26
+ #include <memory>
27
+ #include <optional>
28
+ #include <shared_mutex>
29
+ #include <string>
30
+
31
+ namespace couchbase::core::tracing
32
+ {
33
+ class tracer_wrapper : public config_listener
34
+ {
35
+ public:
36
+ explicit tracer_wrapper(std::shared_ptr<couchbase::tracing::request_tracer> tracer);
37
+
38
+ void start();
39
+ void stop();
40
+
41
+ auto create_span(std::string span_name,
42
+ std::shared_ptr<couchbase::tracing::request_span> parent_span)
43
+ -> std::shared_ptr<couchbase::tracing::request_span>;
44
+
45
+ void update_config(topology::configuration config) override;
46
+
47
+ [[nodiscard]] static auto create(std::shared_ptr<couchbase::tracing::request_tracer> tracer)
48
+ -> std::shared_ptr<tracer_wrapper>;
49
+
50
+ private:
51
+ std::shared_ptr<couchbase::tracing::request_tracer> tracer_;
52
+
53
+ std::optional<std::string> cluster_name_{};
54
+ std::optional<std::string> cluster_uuid_{};
55
+ std::shared_mutex cluster_labels_mutex_{};
56
+ };
57
+ } // namespace couchbase::core::tracing
@@ -42,7 +42,9 @@ public:
42
42
  using VoidCallback = std::function<void(std::exception_ptr)>;
43
43
  using QueryCallback =
44
44
  std::function<void(std::exception_ptr, std::optional<core::operations::query_response>)>;
45
+
45
46
  virtual ~async_attempt_context() = default;
47
+
46
48
  /**
47
49
  * Gets a document from the specified Couchbase collection matching the
48
50
  * specified id.
@@ -91,6 +93,7 @@ public:
91
93
  *
92
94
  * If the mutation fails, the transaction will automatically rollback this
93
95
  * attempt, then retry.
96
+ *
94
97
  * @param document the doc to be updated
95
98
  * @param content the content to replace the doc with.
96
99
  * @param cb callback function called with the updated @ref
@@ -98,11 +101,10 @@ public:
98
101
  * transaction_operation_failed
99
102
  *
100
103
  */
101
- template<typename Transcoder = codec::default_json_transcoder, typename Content>
102
- void replace(const transaction_get_result& document, const Content& content, Callback&& cb)
103
- {
104
- return replace_raw(document, Transcoder::encode(content), std::move(cb));
105
- }
104
+ virtual void replace(const transaction_get_result& document,
105
+ codec::encoded_value content,
106
+ Callback&& cb) = 0;
107
+
106
108
  /**
107
109
  * Inserts a new document into the specified Couchbase collection.
108
110
  *
@@ -119,11 +121,8 @@ public:
119
121
  * @param cb callback function called with a @ref transaction_get_result with
120
122
  * the new CAS value when successful, or @ref transaction_operation_failed
121
123
  */
122
- template<typename Transcoder = codec::default_json_transcoder, typename Content>
123
- void insert(const core::document_id& id, const Content& content, Callback&& cb)
124
- {
125
- return insert_raw(id, Transcoder::encode(content), std::move(cb));
126
- }
124
+ virtual void insert(const core::document_id& id, codec::encoded_value content, Callback&& cb) = 0;
125
+
127
126
  /**
128
127
  * Removes the specified document, using the document's last
129
128
  * TransactionDocument#cas
@@ -195,17 +194,6 @@ public:
195
194
  * @param cb callback which is called when the rollback succeeds
196
195
  */
197
196
  virtual void rollback(VoidCallback&& cb) = 0;
198
-
199
- protected:
200
- /** @internal */
201
- virtual void insert_raw(const core::document_id& id,
202
- codec::encoded_value content,
203
- Callback&& cb) = 0;
204
-
205
- /** @internal */
206
- virtual void replace_raw(const transaction_get_result& document,
207
- codec::encoded_value content,
208
- Callback&& cb) = 0;
209
197
  };
210
198
 
211
199
  } // namespace couchbase::core::transactions
@@ -101,19 +101,8 @@ public:
101
101
  * @throws transaction_operation_failed which either should not be caught by
102
102
  * the lambda, or rethrown if it is caught.
103
103
  */
104
- template<typename Transcoder = codec::default_json_transcoder, typename Content>
105
- auto replace(const transaction_get_result& document,
106
- const Content& content) -> transaction_get_result
107
- {
108
- codec::encoded_value data;
109
- try {
110
- data = Transcoder::encode(content);
111
- } catch (std::runtime_error& e) {
112
- throw transaction_operation_failed(
113
- FAIL_OTHER, std::string("failed to encode content as JSON: ") + e.what());
114
- }
115
- return replace_raw(document, data);
116
- }
104
+ virtual auto replace(const transaction_get_result& document,
105
+ codec::encoded_value content) -> transaction_get_result = 0;
117
106
 
118
107
  /**
119
108
  * Inserts a new document into the specified Couchbase collection.
@@ -135,18 +124,9 @@ public:
135
124
  * @throws transaction_operation_failed which either should not be caught by
136
125
  * the lambda, or rethrown if it is caught.
137
126
  */
138
- template<typename Transcoder = codec::default_json_transcoder, typename Content>
139
- auto insert(const core::document_id& id, const Content& content) -> transaction_get_result
140
- {
141
- codec::encoded_value data;
142
- try {
143
- data = Transcoder::encode(content);
144
- } catch (std::runtime_error& e) {
145
- throw transaction_operation_failed(
146
- FAIL_OTHER, std::string("failed to encode content as JSON: ") + e.what());
147
- }
148
- return insert_raw(id, data);
149
- }
127
+ virtual auto insert(const core::document_id& id,
128
+ codec::encoded_value content) -> transaction_get_result = 0;
129
+
150
130
  /**
151
131
  * Removes the specified document, using the document's last
152
132
  * TransactionDocument#cas
@@ -179,6 +159,7 @@ public:
179
159
  {
180
160
  return do_core_query(statement, opts, query_context);
181
161
  };
162
+
182
163
  /**
183
164
  * Performs a Query, within the current transaction.
184
165
  *
@@ -218,14 +199,6 @@ public:
218
199
  virtual void rollback() = 0;
219
200
 
220
201
  protected:
221
- /** @internal */
222
- virtual auto insert_raw(const core::document_id& id,
223
- codec::encoded_value content) -> transaction_get_result = 0;
224
-
225
- /** @internal */
226
- virtual auto replace_raw(const transaction_get_result& document,
227
- codec::encoded_value content) -> transaction_get_result = 0;
228
-
229
202
  virtual auto do_core_query(const std::string&,
230
203
  const couchbase::transactions::transaction_query_options& opts,
231
204
  std::optional<std::string> query_context)