couchbase 4.2.8 → 4.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (315) hide show
  1. package/CMakeLists.txt +1 -1
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +139 -56
  3. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  4. package/deps/couchbase-cxx-client/CMakeLists.txt +397 -424
  5. package/deps/couchbase-cxx-client/core/agent_config.hxx +1 -1
  6. package/deps/couchbase-cxx-client/core/agent_group.cxx +0 -1
  7. package/deps/couchbase-cxx-client/core/agent_group.hxx +9 -0
  8. package/deps/couchbase-cxx-client/core/agent_group_config.hxx +1 -1
  9. package/deps/couchbase-cxx-client/core/bucket.cxx +22 -8
  10. package/deps/couchbase-cxx-client/core/bucket.hxx +3 -1
  11. package/deps/couchbase-cxx-client/core/cluster.cxx +1453 -108
  12. package/deps/couchbase-cxx-client/core/cluster.hxx +183 -473
  13. package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +1 -1
  14. package/deps/couchbase-cxx-client/core/cluster_options.cxx +12 -2
  15. package/deps/couchbase-cxx-client/core/cluster_options.hxx +9 -8
  16. package/deps/couchbase-cxx-client/core/config_profiles.cxx +2 -2
  17. package/deps/couchbase-cxx-client/core/config_profiles.hxx +1 -1
  18. package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +1 -2
  19. package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +3 -2
  20. package/deps/couchbase-cxx-client/core/diagnostics.hxx +0 -1
  21. package/deps/couchbase-cxx-client/core/dispatcher.cxx +2 -2
  22. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +38 -76
  23. package/deps/couchbase-cxx-client/core/impl/analytics.hxx +40 -0
  24. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +820 -0
  25. package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +403 -0
  26. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +78 -0
  27. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +433 -0
  28. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +226 -44
  29. package/deps/couchbase-cxx-client/core/impl/collection.cxx +1384 -0
  30. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +306 -0
  31. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +3 -1
  32. package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +2 -0
  33. package/deps/couchbase-cxx-client/core/{operations/mcbp_noop.cxx → impl/doc_id_query.cxx} +19 -15
  34. package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +4 -2
  35. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +0 -10
  36. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +0 -10
  37. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +24 -17
  38. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
  39. package/deps/couchbase-cxx-client/core/impl/query.cxx +45 -68
  40. package/deps/couchbase-cxx-client/core/impl/query.hxx +34 -0
  41. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +628 -0
  42. package/deps/couchbase-cxx-client/core/impl/scope.cxx +172 -0
  43. package/deps/couchbase-cxx-client/core/impl/search.cxx +12 -61
  44. package/deps/couchbase-cxx-client/core/impl/search.hxx +37 -0
  45. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +469 -0
  46. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +12 -0
  47. package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +87 -0
  48. package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +23 -25
  49. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +28 -0
  50. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +6 -25
  51. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +9 -1
  52. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
  53. package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +3 -2
  54. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +51 -21
  55. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -1
  56. package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -4
  57. package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +1 -1
  58. package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +1 -1
  59. package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +1 -1
  60. package/deps/couchbase-cxx-client/core/meta/features.hxx +28 -0
  61. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +17 -1
  62. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -1
  63. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +2 -0
  64. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +2 -0
  65. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +2 -0
  66. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +2 -0
  67. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +2 -0
  68. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +2 -0
  69. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +2 -0
  70. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +2 -0
  71. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +2 -0
  72. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +2 -0
  73. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +1 -1
  74. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -0
  75. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +2 -0
  76. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +2 -0
  77. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +2 -0
  78. package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +3 -1
  79. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +2 -0
  80. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +2 -0
  81. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +2 -0
  82. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +6 -5
  83. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +2 -0
  84. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +2 -0
  85. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +2 -0
  86. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +2 -0
  87. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +2 -0
  88. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +2 -0
  89. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +2 -0
  90. package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +2 -0
  91. package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +2 -0
  92. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +1 -1
  93. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +2 -2
  94. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +4 -1
  95. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +4 -1
  96. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +1 -1
  97. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +1 -1
  98. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -0
  99. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +2 -0
  100. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +2 -0
  101. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +4 -4
  102. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +4 -4
  103. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +2 -0
  104. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +2 -0
  105. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +2 -0
  106. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +2 -0
  107. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +2 -0
  108. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +2 -0
  109. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +1 -1
  110. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +2 -0
  111. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +2 -0
  112. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +2 -0
  113. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -0
  114. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -0
  115. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +2 -0
  116. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -0
  117. package/deps/couchbase-cxx-client/core/operations.hxx +0 -1
  118. package/deps/couchbase-cxx-client/core/operations_fwd.hxx +260 -0
  119. package/deps/couchbase-cxx-client/core/origin.cxx +146 -5
  120. package/deps/couchbase-cxx-client/core/origin.hxx +30 -140
  121. package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +3 -3
  122. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -0
  123. package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +4 -4
  124. package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
  125. package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
  126. package/deps/couchbase-cxx-client/core/protocol/status.cxx +6 -0
  127. package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
  128. package/deps/couchbase-cxx-client/core/query_context.hxx +11 -7
  129. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +1 -1
  130. package/deps/couchbase-cxx-client/core/topology/configuration.cxx +23 -0
  131. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +8 -12
  132. package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +3 -3
  133. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -0
  134. package/deps/couchbase-cxx-client/core/topology/error_map.hxx +2 -2
  135. package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +4 -0
  136. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +58 -0
  137. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +5 -40
  138. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +30 -0
  139. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +18 -18
  140. package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +36 -0
  141. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +39 -41
  142. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +2 -2
  143. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +3 -1
  144. package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +2 -0
  145. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +32 -0
  146. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +4 -30
  147. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +41 -0
  148. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +17 -15
  149. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +1 -1
  150. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +4 -4
  151. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +1 -13
  152. package/deps/couchbase-cxx-client/core/transactions/result.hxx +0 -26
  153. package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +46 -0
  154. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +16 -14
  155. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +6 -6
  156. package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +48 -0
  157. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +1 -0
  158. package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +61 -4
  159. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +9 -8
  160. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +9 -16
  161. package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +7 -6
  162. package/deps/couchbase-cxx-client/core/transactions.hxx +6 -5
  163. package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +4 -3
  164. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +4 -4
  165. package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +44 -0
  166. package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +463 -0
  167. package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +44 -0
  168. package/deps/couchbase-cxx-client/couchbase/append_options.hxx +0 -24
  169. package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +1 -1
  170. package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +19 -115
  171. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +13 -30
  172. package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +8 -7
  173. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +0 -1
  174. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +41 -73
  175. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +1 -27
  176. package/deps/couchbase-cxx-client/couchbase/collection.hxx +176 -386
  177. package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +8 -9
  178. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +21 -24
  179. package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +116 -0
  180. package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +3 -3
  181. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +3 -2
  182. package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +120 -0
  183. package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +85 -0
  184. package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +103 -0
  185. package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +63 -0
  186. package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +0 -23
  187. package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +43 -0
  188. package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +105 -0
  189. package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +103 -0
  190. package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +84 -0
  191. package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +103 -0
  192. package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +63 -0
  193. package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +43 -0
  194. package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +22 -1
  195. package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +0 -23
  196. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +6 -0
  197. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -0
  198. package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +37 -0
  199. package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +43 -0
  200. package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +66 -0
  201. package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +65 -0
  202. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +1 -4
  203. package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +0 -23
  204. package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +45 -0
  205. package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +0 -24
  206. package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +0 -24
  207. package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +0 -23
  208. package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +43 -0
  209. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +121 -0
  210. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +0 -23
  211. package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +67 -0
  212. package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +44 -0
  213. package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +0 -23
  214. package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +0 -24
  215. package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +12 -0
  216. package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
  217. package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +0 -24
  218. package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +48 -0
  219. package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +48 -0
  220. package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +239 -0
  221. package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +3 -3
  222. package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +40 -0
  223. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -1
  224. package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +0 -24
  225. package/deps/couchbase-cxx-client/couchbase/network_options.hxx +1 -1
  226. package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +43 -0
  227. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +19 -0
  228. package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +0 -24
  229. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +99 -20
  230. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +0 -21
  231. package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +0 -23
  232. package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +63 -0
  233. package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +0 -24
  234. package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +43 -0
  235. package/deps/couchbase-cxx-client/couchbase/scope.hxx +13 -45
  236. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +1 -7
  237. package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +26 -0
  238. package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +292 -0
  239. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +10 -0
  240. package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +84 -0
  241. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +1 -1
  242. package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +0 -24
  243. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +1 -1
  244. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +10 -7
  245. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +10 -10
  246. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +8 -58
  247. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +28 -70
  248. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +7 -2
  249. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +2 -1
  250. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +11 -38
  251. package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +43 -0
  252. package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +0 -24
  253. package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +0 -24
  254. package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +41 -0
  255. package/dist/binding.d.ts +7 -9
  256. package/dist/bindingutilities.js +2 -0
  257. package/dist/collection.js +3 -3
  258. package/dist/errors.d.ts +9 -0
  259. package/dist/errors.js +14 -2
  260. package/dist/transactions.d.ts +2 -0
  261. package/dist/transactions.js +2 -3
  262. package/dist/usermanager.js +1 -1
  263. package/package.json +7 -7
  264. package/src/binding.cpp +1 -0
  265. package/src/connection.cpp +12 -9
  266. package/src/connection.hpp +3 -3
  267. package/src/connection_autogen.cpp +7 -5
  268. package/src/constants.cpp +3 -0
  269. package/src/instance.cpp +2 -2
  270. package/src/instance.hpp +1 -1
  271. package/src/jstocbpp_autogen.hpp +21 -38
  272. package/src/jstocbpp_basic.hpp +2 -0
  273. package/src/jstocbpp_errors.hpp +1 -0
  274. package/src/jstocbpp_transactions.hpp +6 -22
  275. package/src/mutationtoken.hpp +1 -0
  276. package/tools/gen-bindings-json.py +39 -16
  277. package/deps/couchbase-cxx-client/core/impl/append.cxx +0 -87
  278. package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +0 -157
  279. package/deps/couchbase-cxx-client/core/impl/create_bucket.cxx +0 -158
  280. package/deps/couchbase-cxx-client/core/impl/create_collection.cxx +0 -83
  281. package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +0 -232
  282. package/deps/couchbase-cxx-client/core/impl/create_scope.cxx +0 -69
  283. package/deps/couchbase-cxx-client/core/impl/decrement.cxx +0 -96
  284. package/deps/couchbase-cxx-client/core/impl/drop_bucket.cxx +0 -66
  285. package/deps/couchbase-cxx-client/core/impl/drop_collection.cxx +0 -76
  286. package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +0 -187
  287. package/deps/couchbase-cxx-client/core/impl/drop_scope.cxx +0 -68
  288. package/deps/couchbase-cxx-client/core/impl/exists.cxx +0 -47
  289. package/deps/couchbase-cxx-client/core/impl/flush_bucket.cxx +0 -66
  290. package/deps/couchbase-cxx-client/core/impl/get.cxx +0 -68
  291. package/deps/couchbase-cxx-client/core/impl/get_all_buckets.cxx +0 -178
  292. package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +0 -106
  293. package/deps/couchbase-cxx-client/core/impl/get_all_replicas.cxx +0 -145
  294. package/deps/couchbase-cxx-client/core/impl/get_all_scopes.cxx +0 -94
  295. package/deps/couchbase-cxx-client/core/impl/get_and_lock.cxx +0 -49
  296. package/deps/couchbase-cxx-client/core/impl/get_and_touch.cxx +0 -49
  297. package/deps/couchbase-cxx-client/core/impl/get_any_replica.cxx +0 -134
  298. package/deps/couchbase-cxx-client/core/impl/get_bucket.cxx +0 -168
  299. package/deps/couchbase-cxx-client/core/impl/increment.cxx +0 -96
  300. package/deps/couchbase-cxx-client/core/impl/insert.cxx +0 -90
  301. package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +0 -69
  302. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +0 -178
  303. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +0 -169
  304. package/deps/couchbase-cxx-client/core/impl/mutate_in.cxx +0 -125
  305. package/deps/couchbase-cxx-client/core/impl/prepend.cxx +0 -87
  306. package/deps/couchbase-cxx-client/core/impl/remove.cxx +0 -86
  307. package/deps/couchbase-cxx-client/core/impl/replace.cxx +0 -102
  308. package/deps/couchbase-cxx-client/core/impl/touch.cxx +0 -49
  309. package/deps/couchbase-cxx-client/core/impl/unlock.cxx +0 -47
  310. package/deps/couchbase-cxx-client/core/impl/update_bucket.cxx +0 -133
  311. package/deps/couchbase-cxx-client/core/impl/update_collection.cxx +0 -83
  312. package/deps/couchbase-cxx-client/core/impl/upsert.cxx +0 -100
  313. package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +0 -196
  314. package/deps/couchbase-cxx-client/core/operations/mcbp_noop.hxx +0 -49
  315. /package/deps/couchbase-cxx-client/core/impl/{streaming_json_lexter_error_category.cxx → streaming_json_lexer_error_category.cxx} +0 -0
@@ -17,498 +17,208 @@
17
17
 
18
18
  #pragma once
19
19
 
20
- #include "bucket.hxx"
21
- #include "capella_ca.hxx"
22
- #include "core/io/http_command.hxx"
23
- #include "core/io/http_session_manager.hxx"
24
- #include "core/io/mcbp_command.hxx"
25
- #include "core/io/mcbp_session.hxx"
26
- #include "core/metrics/logging_meter.hxx"
27
- #include "core/metrics/noop_meter.hxx"
28
- #include "core/operations/management/bucket_create.hxx"
29
- #include "core/tracing/noop_tracer.hxx"
30
- #include "core/tracing/threshold_logging_tracer.hxx"
31
- #include "core/utils/join_strings.hxx"
32
- #include "crud_component.hxx"
33
20
  #include "diagnostics.hxx"
34
- #include "dispatcher.hxx"
35
- #include "impl/dns_srv_tracker.hxx"
36
- #include "mozilla_ca_bundle.hxx"
37
- #include "operations.hxx"
21
+ #include "operations_fwd.hxx"
38
22
  #include "origin.hxx"
23
+ #include "topology/configuration.hxx"
24
+ #include "utils/movable_function.hxx"
39
25
 
40
- #include <asio/ssl.hpp>
41
- #include <fstream>
42
- #include <thread>
26
+ #include <asio/io_context.hpp>
27
+ #include <chrono>
28
+ #include <optional>
43
29
  #include <utility>
44
30
 
31
+ namespace couchbase
32
+ {
33
+ class cluster;
34
+ } // namespace couchbase
35
+
45
36
  namespace couchbase::core
46
37
  {
47
38
  class crud_component;
39
+ class cluster_impl;
48
40
 
49
- class cluster : public std::enable_shared_from_this<cluster>
41
+ namespace mcbp
50
42
  {
51
- public:
52
- [[nodiscard]] auto io_context() -> asio::io_context&
53
- {
54
- return ctx_;
55
- }
56
- [[nodiscard]] static std::shared_ptr<cluster> create(asio::io_context& ctx)
57
- {
58
- return std::shared_ptr<cluster>(new cluster(ctx));
59
- }
60
-
61
- [[nodiscard]] std::pair<std::error_code, couchbase::core::origin> origin() const
62
- {
63
- if (stopped_) {
64
- return { errc::network::cluster_closed, {} };
65
- }
66
- return { {}, origin_ };
67
- }
68
-
69
- template<typename Handler>
70
- void open(couchbase::core::origin origin, Handler&& handler)
71
- {
72
- if (stopped_) {
73
- return handler(errc::network::cluster_closed);
74
- }
75
- if (origin.get_nodes().empty()) {
76
- stopped_ = true;
77
- work_.reset();
78
- return handler(errc::common::invalid_argument);
79
- }
80
-
81
- origin_ = std::move(origin);
82
- CB_LOG_DEBUG(R"(open cluster, id: "{}", core version: "{}", {})", id_, couchbase::core::meta::sdk_semver(), origin_.to_json());
83
- // ignore the enable_tracing flag if a tracer was passed in
84
- if (nullptr != origin_.options().tracer) {
85
- tracer_ = origin_.options().tracer;
86
- } else {
87
- if (origin_.options().enable_tracing) {
88
- tracer_ = std::make_shared<tracing::threshold_logging_tracer>(ctx_, origin_.options().tracing_options);
89
- } else {
90
- tracer_ = std::make_shared<tracing::noop_tracer>();
91
- }
92
- }
93
- tracer_->start();
94
- // ignore the metrics options if a meter was passed in.
95
- if (nullptr != origin_.options().meter) {
96
- meter_ = origin_.options().meter;
97
- } else {
98
- if (origin_.options().enable_metrics) {
99
- meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
100
- } else {
101
- meter_ = std::make_shared<metrics::noop_meter>();
102
- }
103
- }
104
- meter_->start();
105
- session_manager_->set_tracer(tracer_);
106
- if (origin_.options().enable_dns_srv) {
107
- auto [hostname, _] = origin_.next_address();
108
- dns_srv_tracker_ =
109
- std::make_shared<impl::dns_srv_tracker>(ctx_, hostname, origin_.options().dns_config, origin_.options().enable_tls);
110
- return asio::post(asio::bind_executor(
111
- ctx_, [self = shared_from_this(), hostname = std::move(hostname), handler = std::forward<Handler>(handler)]() mutable {
112
- return self->dns_srv_tracker_->get_srv_nodes(
113
- [self, hostname = std::move(hostname), handler = std::forward<Handler>(handler)](origin::node_list nodes,
114
- std::error_code ec) mutable {
115
- if (!ec && !nodes.empty()) {
116
- self->origin_.set_nodes(std::move(nodes));
117
- CB_LOG_INFO("replace list of bootstrap nodes with addresses from DNS SRV of \"{}\": [{}]",
118
- hostname,
119
- utils::join_strings(self->origin_.get_nodes(), ", "));
120
- }
121
- return self->do_open(std::forward<Handler>(handler));
122
- });
123
- }));
124
- }
125
- do_open(std::forward<Handler>(handler));
126
- }
127
-
128
- template<typename Handler>
129
- void close(Handler&& handler)
130
- {
131
- if (stopped_) {
132
- return handler();
133
- }
134
- stopped_ = true;
135
- asio::post(asio::bind_executor(ctx_, [self = shared_from_this(), handler = std::forward<Handler>(handler)]() mutable {
136
- if (self->session_) {
137
- self->session_->stop(retry_reason::do_not_retry);
138
- self->session_.reset();
139
- }
140
- self->for_each_bucket([](auto& bucket) { bucket->close(); });
141
- self->session_manager_->close();
142
- handler();
143
- self->work_.reset();
144
- if (self->tracer_) {
145
- self->tracer_->stop();
146
- }
147
- self->tracer_.reset();
148
- if (self->meter_) {
149
- self->meter_->stop();
150
- }
151
- self->meter_.reset();
152
- }));
153
- }
154
-
155
- template<typename Handler>
156
- void open_bucket(const std::string& bucket_name, Handler&& handler)
157
- {
158
- if (stopped_) {
159
- return handler(errc::network::cluster_closed);
160
- }
161
- std::shared_ptr<bucket> b{};
162
- {
163
- std::scoped_lock lock(buckets_mutex_);
164
- auto ptr = buckets_.find(bucket_name);
165
- if (ptr == buckets_.end()) {
166
- std::vector<protocol::hello_feature> known_features;
167
- if (session_ && session_->has_config()) {
168
- known_features = session_->supported_features();
169
- }
170
- b = std::make_shared<bucket>(id_, ctx_, tls_, tracer_, meter_, bucket_name, origin_, known_features, dns_srv_tracker_);
171
- buckets_.try_emplace(bucket_name, b);
172
- }
173
- }
174
- if (b == nullptr) {
175
- return handler({});
176
- }
43
+ class queue_request;
44
+ } // namespace mcbp
177
45
 
178
- b->on_configuration_update(session_manager_);
179
- b->bootstrap([self = shared_from_this(), bucket_name, handler = std::forward<Handler>(handler)](
180
- std::error_code ec, const topology::configuration& config) mutable {
181
- if (ec) {
182
- std::scoped_lock lock(self->buckets_mutex_);
183
- self->buckets_.erase(bucket_name);
184
- } else if (self->session_ && !self->session_->supports_gcccp()) {
185
- self->session_manager_->set_configuration(config, self->origin_.options());
186
- }
187
- handler(ec);
188
- });
189
- }
46
+ namespace o = operations;
47
+ namespace om = operations::management;
48
+ template<typename T>
49
+ using mf = utils::movable_function<T>;
190
50
 
191
- template<typename Handler>
192
- void close_bucket(const std::string& bucket_name, Handler&& handler)
193
- {
194
- if (stopped_) {
195
- return handler(errc::network::cluster_closed);
196
- }
197
- std::shared_ptr<bucket> b{};
198
- {
199
- std::scoped_lock lock(buckets_mutex_);
200
-
201
- if (auto ptr = buckets_.find(bucket_name); ptr != buckets_.end()) {
202
- b = std::move(ptr->second);
203
- buckets_.erase(ptr);
204
- }
205
- }
206
- if (b != nullptr) {
207
- b->close();
208
- }
209
- return handler({});
210
- }
211
-
212
- template<class Handler>
213
- void with_bucket_configuration(const std::string& bucket_name, Handler&& handler)
214
- {
215
- if (stopped_) {
216
- return handler(errc::network::cluster_closed, {});
217
- }
218
- if (auto bucket = find_bucket_by_name(bucket_name); bucket != nullptr) {
219
- return bucket->with_configuration(std::forward<Handler>(handler));
220
- }
221
- return handler(errc::common::bucket_not_found, {});
222
- }
223
-
224
- template<class Request,
225
- class Handler,
226
- typename std::enable_if_t<!std::is_same_v<typename Request::encoded_request_type, io::http_request>, int> = 0>
227
- void execute(Request request, Handler&& handler)
228
- {
229
- if constexpr (operations::is_compound_operation_v<Request>) {
230
- return request.execute(shared_from_this(), std::forward<Handler>(handler));
231
- } else {
232
- using response_type = typename Request::encoded_response_type;
233
- if (stopped_) {
234
- return handler(
235
- request.make_response(make_key_value_error_context(errc::network::cluster_closed, request.id), response_type{}));
236
- }
237
- if (auto bucket = find_bucket_by_name(request.id.bucket()); bucket != nullptr) {
238
- return bucket->execute(std::move(request), std::forward<Handler>(handler));
239
- }
240
- if (request.id.bucket().empty()) {
241
- return handler(
242
- request.make_response(make_key_value_error_context(errc::common::bucket_not_found, request.id), response_type{}));
243
- }
244
- auto bucket_name = request.id.bucket();
245
- return open_bucket(bucket_name,
246
- [self = shared_from_this(), request = std::move(request), handler = std::forward<Handler>(handler)](
247
- std::error_code ec) mutable {
248
- if (ec) {
249
- return handler(request.make_response(make_key_value_error_context(ec, request.id), response_type{}));
250
- }
251
- return self->execute(std::move(request), std::forward<Handler>(handler));
252
- });
253
- }
254
- }
255
-
256
- template<class Request,
257
- class Handler,
258
- typename std::enable_if_t<std::is_same_v<typename Request::encoded_request_type, io::http_request>, int> = 0>
259
- void execute(Request request, Handler&& handler)
260
- {
261
- using response_type = typename Request::encoded_response_type;
262
- if (stopped_) {
263
- return handler(request.make_response({ errc::network::cluster_closed }, response_type{}));
264
- }
265
- if constexpr (operations::is_compound_operation_v<Request>) {
266
- return request.execute(shared_from_this(), std::forward<Handler>(handler));
267
- } else {
268
- return session_manager_->execute(std::move(request), std::forward<Handler>(handler), origin_.credentials());
269
- }
270
- }
271
-
272
- template<typename Handler>
273
- void diagnostics(std::optional<std::string> report_id, Handler&& handler)
274
- {
275
- if (!report_id) {
276
- report_id = std::make_optional(uuid::to_string(uuid::random()));
277
- }
278
- if (stopped_) {
279
- return handler({ report_id.value(), couchbase::core::meta::sdk_id() });
280
- }
281
- asio::post(asio::bind_executor(ctx_, [self = shared_from_this(), report_id, handler = std::forward<Handler>(handler)]() mutable {
282
- diag::diagnostics_result res{ report_id.value(), couchbase::core::meta::sdk_id() };
283
- if (self->session_) {
284
- res.services[service_type::key_value].emplace_back(self->session_->diag_info());
285
- }
286
- self->for_each_bucket([&res](const auto& bucket) { bucket->export_diag_info(res); });
287
- self->session_manager_->export_diag_info(res);
288
- handler(std::move(res));
289
- }));
290
- }
51
+ class cluster
52
+ {
53
+ public:
54
+ explicit cluster(asio::io_context& ctx);
55
+
56
+ [[nodiscard]] auto io_context() const -> asio::io_context&;
57
+
58
+ [[nodiscard]] std::pair<std::error_code, couchbase::core::origin> origin() const;
59
+
60
+ void open(couchbase::core::origin origin, utils::movable_function<void(std::error_code)>&& handler) const;
61
+
62
+ void close(utils::movable_function<void()>&& handler) const;
63
+
64
+ void open_bucket(const std::string& bucket_name, utils::movable_function<void(std::error_code)>&& handler) const;
65
+
66
+ void close_bucket(const std::string& bucket_name, utils::movable_function<void(std::error_code)>&& handler) const;
67
+
68
+ void with_bucket_configuration(const std::string& bucket_name,
69
+ utils::movable_function<void(std::error_code, topology::configuration)>&& handler) const;
70
+
71
+ void execute(o::analytics_request request, mf<void(o::analytics_response)>&& handler) const;
72
+ void execute(o::append_request request, mf<void(o::append_response)>&& handler) const;
73
+ void execute(o::decrement_request request, mf<void(o::decrement_response)>&& handler) const;
74
+ void execute(o::exists_request request, mf<void(o::exists_response)>&& handler) const;
75
+ void execute(o::get_request request, mf<void(o::get_response)>&& handler) const;
76
+ void execute(o::get_all_replicas_request request, mf<void(o::get_all_replicas_response)>&& handler) const;
77
+ void execute(o::get_and_lock_request request, mf<void(o::get_and_lock_response)>&& handler) const;
78
+ void execute(o::get_and_touch_request request, mf<void(o::get_and_touch_response)>&& handler) const;
79
+ void execute(o::get_any_replica_request request, mf<void(o::get_any_replica_response)>&& handler) const;
80
+ void execute(o::get_projected_request request, mf<void(o::get_projected_response)>&& handler) const;
81
+ void execute(o::increment_request request, mf<void(o::increment_response)>&& handler) const;
82
+ void execute(o::insert_request request, mf<void(o::insert_response)>&& handler) const;
83
+ void execute(o::lookup_in_request request, mf<void(o::lookup_in_response)>&& handler) const;
84
+ void execute(o::lookup_in_any_replica_request request, mf<void(o::lookup_in_any_replica_response)>&& handler) const;
85
+ void execute(o::lookup_in_all_replicas_request request, mf<void(o::lookup_in_all_replicas_response)>&& handler) const;
86
+ void execute(o::mutate_in_request request, mf<void(o::mutate_in_response)>&& handler) const;
87
+ void execute(o::prepend_request request, mf<void(o::prepend_response)>&& handler) const;
88
+ void execute(o::query_request request, mf<void(o::query_response)>&& handler) const;
89
+ void execute(o::remove_request request, mf<void(o::remove_response)>&& handler) const;
90
+ void execute(o::replace_request request, mf<void(o::replace_response)>&& handler) const;
91
+ void execute(o::search_request request, mf<void(o::search_response)>&& handler) const;
92
+ void execute(o::touch_request request, mf<void(o::touch_response)>&& handler) const;
93
+ void execute(o::unlock_request request, mf<void(o::unlock_response)>&& handler) const;
94
+ void execute(o::upsert_request request, mf<void(o::upsert_response)>&& handler) const;
95
+ void execute(o::upsert_request_with_legacy_durability request, mf<void(o::upsert_response)>&& handler) const;
96
+ void execute(o::append_request_with_legacy_durability request, mf<void(o::append_response)>&& handler) const;
97
+ void execute(o::decrement_request_with_legacy_durability request, mf<void(o::decrement_response)>&& handler) const;
98
+ void execute(o::increment_request_with_legacy_durability request, mf<void(o::increment_response)>&& handler) const;
99
+ void execute(o::insert_request_with_legacy_durability request, mf<void(o::insert_response)>&& handler) const;
100
+ void execute(o::mutate_in_request_with_legacy_durability request, mf<void(o::mutate_in_response)>&& handler) const;
101
+ void execute(o::prepend_request_with_legacy_durability request, mf<void(o::prepend_response)>&& handler) const;
102
+ void execute(o::remove_request_with_legacy_durability request, mf<void(o::remove_response)>&& handler) const;
103
+ void execute(o::replace_request_with_legacy_durability request, mf<void(o::replace_response)>&& handler) const;
104
+
105
+ void execute(o::document_view_request request, mf<void(o::document_view_response)>&& handler) const;
106
+ void execute(o::http_noop_request request, mf<void(o::http_noop_response)>&& handler) const;
107
+
108
+ void execute(om::analytics_dataset_create_request request, mf<void(om::analytics_dataset_create_response)>&& handler) const;
109
+ void execute(om::analytics_dataset_drop_request request, mf<void(om::analytics_dataset_drop_response)>&& handler) const;
110
+ void execute(om::analytics_dataset_get_all_request request, mf<void(om::analytics_dataset_get_all_response)>&& handler) const;
111
+ void execute(om::analytics_dataverse_create_request request, mf<void(om::analytics_dataverse_create_response)>&& handler) const;
112
+ void execute(om::analytics_dataverse_drop_request request, mf<void(om::analytics_dataverse_drop_response)>&& handler) const;
113
+ void execute(om::analytics_get_pending_mutations_request request,
114
+ mf<void(om::analytics_get_pending_mutations_response)>&& handler) const;
115
+ void execute(om::analytics_index_create_request request, mf<void(om::analytics_index_create_response)>&& handler) const;
116
+ void execute(om::analytics_index_drop_request request, mf<void(om::analytics_index_drop_response)>&& handler) const;
117
+ void execute(om::analytics_index_get_all_request request, mf<void(om::analytics_index_get_all_response)>&& handler) const;
118
+ void execute(om::analytics_link_connect_request request, mf<void(om::analytics_link_connect_response)>&& handler) const;
119
+ void execute(om::analytics_link_disconnect_request request, mf<void(om::analytics_link_disconnect_response)>&& handler) const;
120
+ void execute(om::analytics_link_drop_request request, mf<void(om::analytics_link_drop_response)>&& handler) const;
121
+ void execute(om::analytics_link_get_all_request request, mf<void(om::analytics_link_get_all_response)>&& handler) const;
122
+ void execute(om::bucket_create_request request, mf<void(om::bucket_create_response)>&& handler) const;
123
+ void execute(om::bucket_drop_request request, mf<void(om::bucket_drop_response)>&& handler) const;
124
+ void execute(om::bucket_flush_request request, mf<void(om::bucket_flush_response)>&& handler) const;
125
+ void execute(om::bucket_get_request request, mf<void(om::bucket_get_response)>&& handler) const;
126
+ void execute(om::bucket_get_all_request request, mf<void(om::bucket_get_all_response)>&& handler) const;
127
+ void execute(om::bucket_update_request request, mf<void(om::bucket_update_response)>&& handler) const;
128
+ void execute(om::cluster_developer_preview_enable_request request,
129
+ mf<void(om::cluster_developer_preview_enable_response)>&& handler) const;
130
+ void execute(om::collection_create_request request, mf<void(om::collection_create_response)>&& handler) const;
131
+ void execute(om::collection_update_request request, mf<void(om::collection_update_response)>&& handler) const;
132
+ void execute(om::collection_drop_request request, mf<void(om::collection_drop_response)>&& handler) const;
133
+ void execute(om::collections_manifest_get_request request, mf<void(om::collections_manifest_get_response)>&& handler) const;
134
+ void execute(om::scope_create_request request, mf<void(om::scope_create_response)>&& handler) const;
135
+ void execute(om::scope_drop_request request, mf<void(om::scope_drop_response)>&& handler) const;
136
+ void execute(om::scope_get_all_request request, mf<void(om::scope_get_all_response)>&& handler) const;
137
+ void execute(om::eventing_deploy_function_request request, mf<void(om::eventing_deploy_function_response)>&& handler) const;
138
+ void execute(om::eventing_drop_function_request request, mf<void(om::eventing_drop_function_response)>&& handler) const;
139
+ void execute(om::eventing_get_all_functions_request request, mf<void(om::eventing_get_all_functions_response)>&& handler) const;
140
+ void execute(om::eventing_get_function_request request, mf<void(om::eventing_get_function_response)>&& handler) const;
141
+ void execute(om::eventing_get_status_request request, mf<void(om::eventing_get_status_response)>&& handler) const;
142
+ void execute(om::eventing_pause_function_request request, mf<void(om::eventing_pause_function_response)>&& handler) const;
143
+ void execute(om::eventing_resume_function_request request, mf<void(om::eventing_resume_function_response)>&& handler) const;
144
+ void execute(om::eventing_undeploy_function_request request, mf<void(om::eventing_undeploy_function_response)>&& handler) const;
145
+ void execute(om::eventing_upsert_function_request request, mf<void(om::eventing_upsert_function_response)>&& handler) const;
146
+ void execute(om::view_index_drop_request request, mf<void(om::view_index_drop_response)>&& handler) const;
147
+ void execute(om::view_index_get_request request, mf<void(om::view_index_get_response)>&& handler) const;
148
+ void execute(om::view_index_get_all_request request, mf<void(om::view_index_get_all_response)>&& handler) const;
149
+ void execute(om::view_index_upsert_request request, mf<void(om::view_index_upsert_response)>&& handler) const;
150
+ void execute(om::change_password_request request, mf<void(om::change_password_response)>&& handler) const;
151
+ void execute(om::group_drop_request request, mf<void(om::group_drop_response)>&& handler) const;
152
+ void execute(om::group_get_request request, mf<void(om::group_get_response)>&& handler) const;
153
+ void execute(om::group_get_all_request request, mf<void(om::group_get_all_response)>&& handler) const;
154
+ void execute(om::group_upsert_request request, mf<void(om::group_upsert_response)>&& handler) const;
155
+ void execute(om::role_get_all_request request, mf<void(om::role_get_all_response)>&& handler) const;
156
+ void execute(om::user_drop_request request, mf<void(om::user_drop_response)>&& handler) const;
157
+ void execute(om::user_get_request request, mf<void(om::user_get_response)>&& handler) const;
158
+ void execute(om::user_get_all_request request, mf<void(om::user_get_all_response)>&& handler) const;
159
+ void execute(om::user_upsert_request request, mf<void(om::user_upsert_response)>&& handler) const;
160
+ void execute(om::search_get_stats_request request, mf<void(om::search_get_stats_response)>&& handler) const;
161
+ void execute(om::search_index_analyze_document_request request, mf<void(om::search_index_analyze_document_response)>&& handler) const;
162
+ void execute(om::search_index_control_ingest_request request, mf<void(om::search_index_control_ingest_response)>&& handler) const;
163
+ void execute(om::search_index_control_plan_freeze_request request,
164
+ mf<void(om::search_index_control_plan_freeze_response)>&& handler) const;
165
+ void execute(om::search_index_control_query_request request, mf<void(om::search_index_control_query_response)>&& handler) const;
166
+ void execute(om::search_index_drop_request request, mf<void(om::search_index_drop_response)>&& handler) const;
167
+ void execute(om::search_index_get_request request, mf<void(om::search_index_get_response)>&& handler) const;
168
+ void execute(om::search_index_get_all_request request, mf<void(om::search_index_get_all_response)>&& handler) const;
169
+ void execute(om::search_index_get_documents_count_request request,
170
+ mf<void(om::search_index_get_documents_count_response)>&& handler) const;
171
+ void execute(om::search_index_get_stats_request request, mf<void(om::search_index_get_stats_response)>&& handler) const;
172
+ void execute(om::search_index_upsert_request request, mf<void(om::search_index_upsert_response)>&& handler) const;
173
+ void execute(om::query_index_build_request request, mf<void(om::query_index_build_response)>&& handler) const;
174
+ void execute(om::query_index_build_deferred_request request, mf<void(om::query_index_build_deferred_response)>&& handler) const;
175
+ void execute(om::query_index_create_request request, mf<void(om::query_index_create_response)>&& handler) const;
176
+ void execute(om::query_index_drop_request request, mf<void(om::query_index_drop_response)>&& handler) const;
177
+ void execute(om::query_index_get_all_request request, mf<void(om::query_index_get_all_response)>&& handler) const;
178
+ void execute(om::query_index_get_all_deferred_request request, mf<void(om::query_index_get_all_deferred_response)>&& handler) const;
179
+
180
+ void execute(om::freeform_request request, mf<void(om::freeform_response)>&& handler) const;
181
+ void execute(om::bucket_describe_request request, mf<void(om::bucket_describe_response)>&& handler) const;
182
+ void execute(om::cluster_describe_request request, mf<void(om::cluster_describe_response)>&& handler) const;
183
+
184
+ void execute(impl::get_replica_request request, mf<void(impl::get_replica_response)>&& handler) const;
185
+ void execute(impl::lookup_in_replica_request request, mf<void(impl::lookup_in_replica_response)>&& handler) const;
186
+ void execute(impl::observe_seqno_request request, mf<void(impl::observe_seqno_response)>&& handler) const;
187
+
188
+ void execute(om::analytics_link_replace_request<management::analytics::azure_blob_external_link> request,
189
+ mf<void(om::analytics_link_replace_response)>&& handler) const;
190
+ void execute(om::analytics_link_replace_request<management::analytics::couchbase_remote_link> request,
191
+ mf<void(om::analytics_link_replace_response)>&& handler) const;
192
+ void execute(om::analytics_link_replace_request<management::analytics::s3_external_link> request,
193
+ mf<void(om::analytics_link_replace_response)>&& handler) const;
194
+ void execute(om::analytics_link_create_request<management::analytics::azure_blob_external_link> request,
195
+ mf<void(om::analytics_link_create_response)>&& handler) const;
196
+ void execute(om::analytics_link_create_request<management::analytics::couchbase_remote_link> request,
197
+ mf<void(om::analytics_link_create_response)>&& handler) const;
198
+ void execute(om::analytics_link_create_request<management::analytics::s3_external_link> request,
199
+ mf<void(om::analytics_link_create_response)>&& handler) const;
200
+
201
+ void diagnostics(std::optional<std::string> report_id, mf<void(diag::diagnostics_result)>&& handler) const;
291
202
 
292
- template<typename Handler>
293
203
  void ping(std::optional<std::string> report_id,
294
204
  std::optional<std::string> bucket_name,
295
205
  std::set<service_type> services,
296
- Handler&& handler)
297
- {
298
- do_ping(report_id, bucket_name, services, std::forward<Handler>(handler));
299
- }
206
+ std::optional<std::chrono::milliseconds> timeout,
207
+ utils::movable_function<void(diag::ping_result)>&& handler) const;
300
208
 
301
- auto direct_dispatch(const std::string& bucket_name, std::shared_ptr<couchbase::core::mcbp::queue_request> req) -> std::error_code;
209
+ [[nodiscard]] auto direct_dispatch(const std::string& bucket_name, std::shared_ptr<couchbase::core::mcbp::queue_request> req) const
210
+ -> std::error_code;
302
211
 
303
- auto direct_re_queue(const std::string& bucket_name, std::shared_ptr<mcbp::queue_request> req, bool is_retry) -> std::error_code;
212
+ [[nodiscard]] auto direct_re_queue(const std::string& bucket_name, std::shared_ptr<mcbp::queue_request> req, bool is_retry) const
213
+ -> std::error_code;
304
214
 
305
- private:
306
- explicit cluster(asio::io_context& ctx)
307
- : ctx_(ctx)
308
- , work_(asio::make_work_guard(ctx_))
309
- , session_manager_(std::make_shared<io::http_session_manager>(id_, ctx_, tls_))
310
- {
311
- }
215
+ [[nodiscard]] auto to_string() const -> std::string;
312
216
 
313
- std::shared_ptr<bucket> find_bucket_by_name(const std::string& name);
314
-
315
- void do_ping(std::optional<std::string> report_id,
316
- std::optional<std::string> bucket_name,
317
- std::set<service_type> services,
318
- utils::movable_function<void(diag::ping_result)> handler);
319
-
320
- template<typename Handler>
321
- void for_each_bucket(Handler handler)
322
- {
323
- std::vector<std::shared_ptr<bucket>> buckets{};
324
- {
325
- std::scoped_lock lock(buckets_mutex_);
326
- buckets.reserve(buckets_.size());
327
- for (const auto& [name, bucket] : buckets_) {
328
- buckets.push_back(bucket);
329
- }
330
- }
331
- for (auto bucket : buckets) {
332
- handler(bucket);
333
- }
334
- }
335
-
336
- void configure_tls_options(bool has_capella_host);
337
-
338
- template<typename Handler>
339
- void do_open(Handler&& handler)
340
- {
341
- // Warn users if idle_http_connection_timeout is too close to server idle timeouts
342
- if (origin_.options().idle_http_connection_timeout > std::chrono::milliseconds(4'500)) {
343
- CB_LOG_INFO("[{}]: The SDK may produce trivial warnings due to the idle HTTP connection timeout being set above the idle"
344
- "timeout of various services",
345
- id_);
346
- }
347
-
348
- // Warn users if they attempt to use Capella without TLS being enabled.
349
- bool has_capella_host = false;
350
- {
351
- bool has_non_capella_host = false;
352
- static std::string suffix = "cloud.couchbase.com";
353
- for (const auto& node : origin_.get_hostnames()) {
354
- if (auto pos = node.find(suffix); pos != std::string::npos && pos + suffix.size() == node.size()) {
355
- has_capella_host = true;
356
- } else {
357
- has_non_capella_host = true;
358
- }
359
- }
360
-
361
- if (has_capella_host && !origin_.options().enable_tls) {
362
- CB_LOG_WARNING("[{}]: TLS is required when connecting to Couchbase Capella. Please enable TLS by prefixing "
363
- "the connection string with \"couchbases://\" (note the final 's').",
364
- id_);
365
- }
366
-
367
- if (origin_.options().enable_tls /* TLS is enabled */
368
- && origin_.options().trust_certificate.empty() /* No CA certificate (or other SDK-specific trust source) is specified */
369
- && origin_.options().trust_certificate_value.empty() /* and certificate value has not been specified */
370
- && origin_.options().tls_verify != tls_verify_mode::none /* The user did not disable all TLS verification */
371
- && has_non_capella_host /* The connection string has a hostname that does NOT end in ".cloud.couchbase.com" */) {
372
- CB_LOG_WARNING("[{}] When TLS is enabled, the cluster options must specify certificate(s) to trust or ensure that they are "
373
- "available in system CA store. (Unless connecting to cloud.couchbase.com.)",
374
- id_);
375
- }
376
- }
377
-
378
- if (origin_.options().enable_tls) {
379
- configure_tls_options(has_capella_host);
380
-
381
- if (origin_.options().trust_certificate.empty() &&
382
- origin_.options().trust_certificate_value.empty()) { // trust certificate is not explicitly specified
383
- CB_LOG_DEBUG(R"([{}]: use default CA for TLS verify)", id_);
384
- std::error_code ec{};
385
-
386
- // load system certificates
387
- tls_.set_default_verify_paths(ec);
388
- if (ec) {
389
- CB_LOG_WARNING(R"([{}]: failed to load system CAs: {})", id_, ec.message());
390
- }
391
-
392
- // add the Capella Root CA in addition to system CAs
393
- tls_.add_certificate_authority(
394
- asio::const_buffer(couchbase::core::default_ca::capellaCaCert, strlen(couchbase::core::default_ca::capellaCaCert)), ec);
395
- if (ec) {
396
- CB_LOG_WARNING("[{}]: unable to load default CAs: {}", id_, ec.message());
397
- // we don't consider this fatal and try to continue without it
398
- }
399
-
400
- if (const auto certificates = default_ca::mozilla_ca_certs();
401
- !origin_.options().disable_mozilla_ca_certificates && !certificates.empty()) {
402
- CB_LOG_DEBUG("[{}]: loading {} CA certificates from Mozilla bundle. Update date: \"{}\", SHA256: \"{}\"",
403
- id_,
404
- certificates.size(),
405
- default_ca::mozilla_ca_certs_date(),
406
- default_ca::mozilla_ca_certs_sha256());
407
- for (const auto& cert : certificates) {
408
- tls_.add_certificate_authority(asio::const_buffer(cert.body.data(), cert.body.size()), ec);
409
- if (ec) {
410
- CB_LOG_WARNING("[{}]: unable to load CA \"{}\" from Mozilla bundle: {}", id_, cert.authority, ec.message());
411
- }
412
- }
413
- }
414
- } else { // trust certificate is explicitly specified
415
- std::error_code ec{};
416
- // load only the explicit certificate
417
- // system and default capella certificates are not loaded
418
- if (!origin_.options().trust_certificate_value.empty()) {
419
- CB_LOG_DEBUG(R"([{}]: use TLS certificate passed through via options object)", id_);
420
- tls_.add_certificate_authority(asio::const_buffer(origin_.options().trust_certificate_value.data(),
421
- origin_.options().trust_certificate_value.size()),
422
- ec);
423
- if (ec) {
424
- CB_LOG_WARNING("[{}]: unable to load CA passed via options object: {}", id_, ec.message());
425
- }
426
- }
427
- if (!origin_.options().trust_certificate.empty()) {
428
- CB_LOG_DEBUG(R"([{}]: use TLS verify file: "{}")", id_, origin_.options().trust_certificate);
429
- tls_.load_verify_file(origin_.options().trust_certificate, ec);
430
- if (ec) {
431
- CB_LOG_ERROR("[{}]: unable to load verify file \"{}\": {}", id_, origin_.options().trust_certificate, ec.message());
432
- return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
433
- }
434
- }
435
- }
436
- if (origin_.credentials().uses_certificate()) {
437
- std::error_code ec{};
438
- CB_LOG_DEBUG(R"([{}]: use TLS certificate chain: "{}")", id_, origin_.certificate_path());
439
- tls_.use_certificate_chain_file(origin_.certificate_path(), ec);
440
- if (ec) {
441
- CB_LOG_ERROR("[{}]: unable to load certificate chain \"{}\": {}", id_, origin_.certificate_path(), ec.message());
442
- return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
443
- }
444
- CB_LOG_DEBUG(R"([{}]: use TLS private key: "{}")", id_, origin_.key_path());
445
- tls_.use_private_key_file(origin_.key_path(), asio::ssl::context::file_format::pem, ec);
446
- if (ec) {
447
- CB_LOG_ERROR("[{}]: unable to load private key \"{}\": {}", id_, origin_.key_path(), ec.message());
448
- return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
449
- }
450
- }
451
- session_ = io::mcbp_session(id_, ctx_, tls_, origin_, dns_srv_tracker_);
452
- } else {
453
- session_ = io::mcbp_session(id_, ctx_, origin_, dns_srv_tracker_);
454
- }
455
- session_->bootstrap([self = shared_from_this(),
456
- handler = std::forward<Handler>(handler)](std::error_code ec, const topology::configuration& config) mutable {
457
- if (!ec) {
458
- if (self->origin_.options().network == "auto") {
459
- self->origin_.options().network = config.select_network(self->session_->bootstrap_hostname());
460
- if (self->origin_.options().network == "default") {
461
- CB_LOG_DEBUG(R"({} detected network is "{}")", self->session_->log_prefix(), self->origin_.options().network);
462
- } else {
463
- CB_LOG_INFO(R"({} detected network is "{}")", self->session_->log_prefix(), self->origin_.options().network);
464
- }
465
- }
466
- if (self->origin_.options().network != "default") {
467
- origin::node_list nodes;
468
- nodes.reserve(config.nodes.size());
469
- for (const auto& address : config.nodes) {
470
- auto port =
471
- address.port_or(self->origin_.options().network, service_type::key_value, self->origin_.options().enable_tls, 0);
472
- if (port == 0) {
473
- continue;
474
- }
475
- origin::node_entry node;
476
- node.first = address.hostname_for(self->origin_.options().network);
477
- node.second = std::to_string(port);
478
- nodes.emplace_back(node);
479
- }
480
- self->origin_.set_nodes(nodes);
481
- CB_LOG_INFO("replace list of bootstrap nodes with addresses of alternative network \"{}\": [{}]",
482
- self->origin_.options().network,
483
- utils::join_strings(self->origin_.get_nodes(), ","));
484
- }
485
- self->session_manager_->set_configuration(config, self->origin_.options());
486
- self->session_->on_configuration_update(self->session_manager_);
487
- self->session_->on_stop([self]() {
488
- if (self->session_) {
489
- self->session_.reset();
490
- }
491
- });
492
- }
493
- if (ec) {
494
- return self->close([ec, handler = std::forward<Handler>(handler)]() mutable { handler(ec); });
495
- }
496
- handler(ec);
497
- });
498
- }
499
-
500
- std::string id_{ uuid::to_string(uuid::random()) };
501
- asio::io_context& ctx_;
502
- asio::executor_work_guard<asio::io_context::executor_type> work_;
503
- asio::ssl::context tls_{ asio::ssl::context::tls_client };
504
- std::shared_ptr<io::http_session_manager> session_manager_;
505
- std::optional<io::mcbp_session> session_{};
506
- std::shared_ptr<impl::dns_srv_tracker> dns_srv_tracker_{};
507
- std::mutex buckets_mutex_{};
508
- std::map<std::string, std::shared_ptr<bucket>> buckets_{};
509
- couchbase::core::origin origin_{};
510
- std::shared_ptr<couchbase::tracing::request_tracer> tracer_{ nullptr };
511
- std::shared_ptr<couchbase::metrics::meter> meter_{ nullptr };
512
- std::atomic_bool stopped_{ false };
217
+ private:
218
+ std::shared_ptr<cluster_impl> impl_;
513
219
  };
220
+
221
+ // FIXME: temporary solution for the core API migration. FIT performer needs to access core for KV range APIs
222
+ auto
223
+ get_core_cluster(couchbase::cluster public_api_cluster) -> core::cluster;
514
224
  } // namespace couchbase::core