couchbase 4.2.8 → 4.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) 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 +401 -424
  5. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
  6. package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
  7. package/deps/couchbase-cxx-client/core/agent_config.hxx +1 -1
  8. package/deps/couchbase-cxx-client/core/agent_group.cxx +0 -1
  9. package/deps/couchbase-cxx-client/core/agent_group.hxx +9 -0
  10. package/deps/couchbase-cxx-client/core/agent_group_config.hxx +1 -1
  11. package/deps/couchbase-cxx-client/core/bucket.cxx +74 -10
  12. package/deps/couchbase-cxx-client/core/bucket.hxx +4 -2
  13. package/deps/couchbase-cxx-client/core/cluster.cxx +1491 -108
  14. package/deps/couchbase-cxx-client/core/cluster.hxx +183 -473
  15. package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +1 -1
  16. package/deps/couchbase-cxx-client/core/cluster_options.cxx +12 -2
  17. package/deps/couchbase-cxx-client/core/cluster_options.hxx +9 -8
  18. package/deps/couchbase-cxx-client/core/config_profiles.cxx +2 -2
  19. package/deps/couchbase-cxx-client/core/config_profiles.hxx +1 -1
  20. package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +1 -2
  21. package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +3 -2
  22. package/deps/couchbase-cxx-client/core/diagnostics.hxx +0 -1
  23. package/deps/couchbase-cxx-client/core/dispatcher.cxx +2 -2
  24. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +38 -76
  25. package/deps/couchbase-cxx-client/core/impl/analytics.hxx +40 -0
  26. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +820 -0
  27. package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +403 -0
  28. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +102 -0
  29. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +433 -0
  30. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +299 -44
  31. package/deps/couchbase-cxx-client/core/impl/collection.cxx +1384 -0
  32. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +306 -0
  33. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +3 -1
  34. package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
  35. package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
  36. package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +2 -0
  37. package/deps/couchbase-cxx-client/core/{operations/mcbp_noop.cxx → impl/doc_id_query.cxx} +19 -15
  38. package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +4 -2
  39. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +0 -10
  40. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +0 -10
  41. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +24 -17
  42. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
  43. package/deps/couchbase-cxx-client/core/impl/query.cxx +45 -68
  44. package/deps/couchbase-cxx-client/core/impl/query.hxx +34 -0
  45. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +628 -0
  46. package/deps/couchbase-cxx-client/core/impl/scope.cxx +187 -0
  47. package/deps/couchbase-cxx-client/core/impl/search.cxx +81 -57
  48. package/deps/couchbase-cxx-client/core/impl/search.hxx +45 -0
  49. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +712 -0
  50. package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
  51. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +12 -0
  52. package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +87 -0
  53. package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
  54. package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
  55. package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +23 -25
  56. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +28 -0
  57. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +6 -25
  58. package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
  59. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +9 -1
  60. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
  61. package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +3 -2
  62. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +75 -53
  63. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +3 -1
  64. package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
  65. package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -4
  66. package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +1 -1
  67. package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +1 -1
  68. package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +1 -1
  69. package/deps/couchbase-cxx-client/core/meta/features.hxx +38 -0
  70. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +23 -2
  71. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -1
  72. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
  73. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
  74. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +2 -0
  75. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +2 -0
  76. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +2 -0
  77. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +2 -0
  78. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +2 -0
  79. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +2 -0
  80. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +2 -0
  81. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +2 -0
  82. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +2 -0
  83. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +2 -0
  84. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +1 -1
  85. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -0
  86. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +2 -0
  87. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +2 -0
  88. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +2 -0
  89. package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +3 -1
  90. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +9 -6
  91. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
  92. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +2 -0
  93. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +9 -8
  94. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
  95. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +9 -5
  96. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +2 -0
  97. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +2 -0
  98. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +2 -0
  99. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +2 -0
  100. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +2 -0
  101. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +2 -0
  102. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +2 -0
  103. package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +2 -0
  104. package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +2 -0
  105. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +1 -1
  106. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +2 -2
  107. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +4 -1
  108. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +4 -1
  109. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +1 -1
  110. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +1 -1
  111. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -0
  112. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +2 -0
  113. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +2 -0
  114. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +4 -4
  115. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +4 -4
  116. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +19 -1
  117. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
  118. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +23 -1
  119. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
  120. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +23 -1
  121. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
  122. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +23 -1
  123. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
  124. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +19 -1
  125. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
  126. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +19 -1
  127. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
  128. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
  129. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
  130. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +20 -1
  131. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
  132. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +2 -0
  133. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +19 -1
  134. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
  135. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -0
  136. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -0
  137. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +2 -0
  138. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -0
  139. package/deps/couchbase-cxx-client/core/operations.hxx +0 -1
  140. package/deps/couchbase-cxx-client/core/operations_fwd.hxx +260 -0
  141. package/deps/couchbase-cxx-client/core/origin.cxx +146 -5
  142. package/deps/couchbase-cxx-client/core/origin.hxx +30 -140
  143. package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +3 -3
  144. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -0
  145. package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +4 -4
  146. package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
  147. package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
  148. package/deps/couchbase-cxx-client/core/protocol/status.cxx +6 -0
  149. package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
  150. package/deps/couchbase-cxx-client/core/query_context.hxx +11 -7
  151. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +1 -1
  152. package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
  153. package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
  154. package/deps/couchbase-cxx-client/core/topology/configuration.cxx +23 -0
  155. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +8 -12
  156. package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +3 -3
  157. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -0
  158. package/deps/couchbase-cxx-client/core/topology/error_map.hxx +2 -2
  159. package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +4 -0
  160. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +58 -0
  161. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +5 -40
  162. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +30 -0
  163. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +18 -18
  164. package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +36 -0
  165. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +39 -41
  166. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +2 -2
  167. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +3 -1
  168. package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +2 -0
  169. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +32 -0
  170. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +4 -30
  171. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +41 -0
  172. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +17 -15
  173. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +1 -1
  174. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +4 -4
  175. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +5 -13
  176. package/deps/couchbase-cxx-client/core/transactions/result.hxx +0 -26
  177. package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +46 -0
  178. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +16 -14
  179. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +6 -6
  180. package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +48 -0
  181. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +1 -0
  182. package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +61 -4
  183. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +9 -8
  184. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +9 -16
  185. package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +7 -6
  186. package/deps/couchbase-cxx-client/core/transactions.hxx +6 -5
  187. package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +4 -3
  188. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +4 -4
  189. package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
  190. package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +44 -0
  191. package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +463 -0
  192. package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +44 -0
  193. package/deps/couchbase-cxx-client/couchbase/append_options.hxx +0 -24
  194. package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +1 -1
  195. package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +19 -115
  196. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +42 -30
  197. package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +8 -7
  198. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +0 -1
  199. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +151 -73
  200. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +1 -27
  201. package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
  202. package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
  203. package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
  204. package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
  205. package/deps/couchbase-cxx-client/couchbase/collection.hxx +176 -386
  206. package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +8 -9
  207. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +21 -24
  208. package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +116 -0
  209. package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +3 -3
  210. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +32 -3
  211. package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +120 -0
  212. package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +85 -0
  213. package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +103 -0
  214. package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +63 -0
  215. package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +0 -23
  216. package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
  217. package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
  218. package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +43 -0
  219. package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +105 -0
  220. package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +103 -0
  221. package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +84 -0
  222. package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +103 -0
  223. package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +63 -0
  224. package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +43 -0
  225. package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
  226. package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
  227. package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +22 -1
  228. package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +0 -23
  229. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +6 -0
  230. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -0
  231. package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +37 -0
  232. package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +43 -0
  233. package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +66 -0
  234. package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +65 -0
  235. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +1 -4
  236. package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +0 -23
  237. package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +45 -0
  238. package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +0 -24
  239. package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +0 -24
  240. package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +0 -23
  241. package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +43 -0
  242. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +121 -0
  243. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -29
  244. package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +67 -0
  245. package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +44 -0
  246. package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +0 -23
  247. package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +0 -24
  248. package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +12 -0
  249. package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
  250. package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +0 -24
  251. package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +48 -0
  252. package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +48 -0
  253. package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +239 -0
  254. package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
  255. package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +3 -3
  256. package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +40 -0
  257. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -1
  258. package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +0 -24
  259. package/deps/couchbase-cxx-client/couchbase/network_options.hxx +1 -1
  260. package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +43 -0
  261. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +19 -0
  262. package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
  263. package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
  264. package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +0 -24
  265. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +99 -20
  266. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +0 -21
  267. package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +0 -23
  268. package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +63 -0
  269. package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +0 -24
  270. package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +43 -0
  271. package/deps/couchbase-cxx-client/couchbase/scope.hxx +37 -53
  272. package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
  273. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +1 -7
  274. package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +26 -0
  275. package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +292 -0
  276. package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
  277. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +10 -0
  278. package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +84 -0
  279. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +1 -1
  280. package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
  281. package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +0 -24
  282. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +1 -1
  283. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +10 -7
  284. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +10 -10
  285. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +8 -58
  286. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +28 -70
  287. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +7 -2
  288. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +2 -1
  289. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +11 -38
  290. package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +43 -0
  291. package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +0 -24
  292. package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
  293. package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +0 -24
  294. package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +41 -0
  295. package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
  296. package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
  297. package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
  298. package/dist/binding.d.ts +16 -9
  299. package/dist/binding.js +4 -1
  300. package/dist/bindingutilities.d.ts +6 -1
  301. package/dist/bindingutilities.js +17 -1
  302. package/dist/cluster.d.ts +12 -1
  303. package/dist/cluster.js +22 -0
  304. package/dist/collection.js +3 -3
  305. package/dist/couchbase.d.ts +1 -0
  306. package/dist/couchbase.js +1 -0
  307. package/dist/errors.d.ts +9 -0
  308. package/dist/errors.js +14 -2
  309. package/dist/searchexecutor.d.ts +2 -2
  310. package/dist/searchexecutor.js +19 -3
  311. package/dist/searchtypes.d.ts +46 -0
  312. package/dist/searchtypes.js +81 -1
  313. package/dist/transactions.d.ts +2 -0
  314. package/dist/transactions.js +2 -3
  315. package/dist/usermanager.js +1 -1
  316. package/dist/vectorsearch.d.ts +99 -0
  317. package/dist/vectorsearch.js +132 -0
  318. package/package.json +7 -7
  319. package/src/binding.cpp +1 -0
  320. package/src/connection.cpp +12 -9
  321. package/src/connection.hpp +3 -3
  322. package/src/connection_autogen.cpp +7 -5
  323. package/src/constants.cpp +14 -0
  324. package/src/instance.cpp +2 -2
  325. package/src/instance.hpp +1 -1
  326. package/src/jstocbpp_autogen.hpp +45 -45
  327. package/src/jstocbpp_basic.hpp +2 -0
  328. package/src/jstocbpp_errors.hpp +1 -0
  329. package/src/jstocbpp_transactions.hpp +6 -22
  330. package/src/mutationtoken.hpp +1 -0
  331. package/tools/gen-bindings-json.py +41 -16
  332. package/deps/couchbase-cxx-client/core/impl/append.cxx +0 -87
  333. package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +0 -157
  334. package/deps/couchbase-cxx-client/core/impl/create_bucket.cxx +0 -158
  335. package/deps/couchbase-cxx-client/core/impl/create_collection.cxx +0 -83
  336. package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +0 -232
  337. package/deps/couchbase-cxx-client/core/impl/create_scope.cxx +0 -69
  338. package/deps/couchbase-cxx-client/core/impl/decrement.cxx +0 -96
  339. package/deps/couchbase-cxx-client/core/impl/drop_bucket.cxx +0 -66
  340. package/deps/couchbase-cxx-client/core/impl/drop_collection.cxx +0 -76
  341. package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +0 -187
  342. package/deps/couchbase-cxx-client/core/impl/drop_scope.cxx +0 -68
  343. package/deps/couchbase-cxx-client/core/impl/exists.cxx +0 -47
  344. package/deps/couchbase-cxx-client/core/impl/flush_bucket.cxx +0 -66
  345. package/deps/couchbase-cxx-client/core/impl/get.cxx +0 -68
  346. package/deps/couchbase-cxx-client/core/impl/get_all_buckets.cxx +0 -178
  347. package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +0 -106
  348. package/deps/couchbase-cxx-client/core/impl/get_all_replicas.cxx +0 -145
  349. package/deps/couchbase-cxx-client/core/impl/get_all_scopes.cxx +0 -94
  350. package/deps/couchbase-cxx-client/core/impl/get_and_lock.cxx +0 -49
  351. package/deps/couchbase-cxx-client/core/impl/get_and_touch.cxx +0 -49
  352. package/deps/couchbase-cxx-client/core/impl/get_any_replica.cxx +0 -134
  353. package/deps/couchbase-cxx-client/core/impl/get_bucket.cxx +0 -168
  354. package/deps/couchbase-cxx-client/core/impl/increment.cxx +0 -96
  355. package/deps/couchbase-cxx-client/core/impl/insert.cxx +0 -90
  356. package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +0 -69
  357. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +0 -178
  358. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +0 -169
  359. package/deps/couchbase-cxx-client/core/impl/mutate_in.cxx +0 -125
  360. package/deps/couchbase-cxx-client/core/impl/prepend.cxx +0 -87
  361. package/deps/couchbase-cxx-client/core/impl/remove.cxx +0 -86
  362. package/deps/couchbase-cxx-client/core/impl/replace.cxx +0 -102
  363. package/deps/couchbase-cxx-client/core/impl/touch.cxx +0 -49
  364. package/deps/couchbase-cxx-client/core/impl/unlock.cxx +0 -47
  365. package/deps/couchbase-cxx-client/core/impl/update_bucket.cxx +0 -133
  366. package/deps/couchbase-cxx-client/core/impl/update_collection.cxx +0 -83
  367. package/deps/couchbase-cxx-client/core/impl/upsert.cxx +0 -100
  368. package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +0 -196
  369. package/deps/couchbase-cxx-client/core/operations/mcbp_noop.hxx +0 -49
  370. /package/deps/couchbase-cxx-client/core/impl/{streaming_json_lexter_error_category.cxx → streaming_json_lexer_error_category.cxx} +0 -0
@@ -0,0 +1,306 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2023-Present 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 "core/cluster.hxx"
19
+
20
+ #include "core/operations/management/collection_create.hxx"
21
+ #include "core/operations/management/collection_drop.hxx"
22
+ #include "core/operations/management/collection_update.hxx"
23
+ #include "core/operations/management/scope_create.hxx"
24
+ #include "core/operations/management/scope_drop.hxx"
25
+ #include "core/operations/management/scope_get_all.hxx"
26
+ #include "internal_manager_error_context.hxx"
27
+
28
+ #include <couchbase/collection_manager.hxx>
29
+
30
+ #include <memory>
31
+
32
+ namespace couchbase
33
+ {
34
+ namespace
35
+ {
36
+ template<typename Response>
37
+ manager_error_context
38
+ build_context(Response& resp)
39
+ {
40
+ return manager_error_context(internal_manager_error_context{ resp.ctx.ec,
41
+ resp.ctx.last_dispatched_to,
42
+ resp.ctx.last_dispatched_from,
43
+ resp.ctx.retry_attempts,
44
+ std::move(resp.ctx.retry_reasons),
45
+ std::move(resp.ctx.client_context_id),
46
+ resp.ctx.http_status,
47
+ std::move(resp.ctx.http_body),
48
+ std::move(resp.ctx.path) });
49
+ }
50
+
51
+ management::bucket::collection_spec
52
+ map_collection(std::string scope_name, const core::topology::collections_manifest::collection& collection)
53
+ {
54
+ management::bucket::collection_spec spec{};
55
+ spec.name = collection.name;
56
+ spec.scope_name = std::move(scope_name);
57
+ spec.max_expiry = collection.max_expiry;
58
+ spec.history = collection.history;
59
+ return spec;
60
+ }
61
+
62
+ std::vector<couchbase::management::bucket::scope_spec>
63
+ map_scope_specs(core::topology::collections_manifest& manifest)
64
+ {
65
+ std::vector<couchbase::management::bucket::scope_spec> scope_specs{};
66
+ for (const auto& scope : manifest.scopes) {
67
+ couchbase::management::bucket::scope_spec converted_scope{};
68
+ converted_scope.name = scope.name;
69
+ for (const auto& collection : scope.collections) {
70
+ auto collection_spec = map_collection(scope.name, collection);
71
+ converted_scope.collections.emplace_back(collection_spec);
72
+ }
73
+ scope_specs.emplace_back(converted_scope);
74
+ }
75
+ return scope_specs;
76
+ }
77
+ } // namespace
78
+
79
+ class collection_manager_impl
80
+ {
81
+ public:
82
+ collection_manager_impl(core::cluster core, std::string_view bucket_name)
83
+ : core_{ std::move(core) }
84
+ , bucket_name_{ bucket_name }
85
+ {
86
+ }
87
+
88
+ void drop_collection(std::string scope_name,
89
+ std::string collection_name,
90
+ const couchbase::drop_collection_options::built& options,
91
+ couchbase::drop_collection_handler&& handler) const
92
+ {
93
+ return core_.execute(
94
+ core::operations::management::collection_drop_request{
95
+ bucket_name_,
96
+ std::move(scope_name),
97
+ std::move(collection_name),
98
+ {},
99
+ options.timeout,
100
+ },
101
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
102
+ }
103
+
104
+ void update_collection(std::string scope_name,
105
+ std::string collection_name,
106
+ const couchbase::update_collection_settings& settings,
107
+ const couchbase::update_collection_options::built& options,
108
+ couchbase::update_collection_handler&& handler) const
109
+ {
110
+ return core_.execute(
111
+ core::operations::management::collection_update_request{
112
+ bucket_name_,
113
+ std::move(scope_name),
114
+ std::move(collection_name),
115
+ settings.max_expiry,
116
+ settings.history,
117
+ {},
118
+ options.timeout,
119
+ },
120
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
121
+ }
122
+
123
+ void create_collection(std::string scope_name,
124
+ std::string collection_name,
125
+ const couchbase::create_collection_settings& settings,
126
+ const couchbase::create_collection_options::built& options,
127
+ couchbase::update_collection_handler&& handler) const
128
+ {
129
+ return core_.execute(
130
+ core::operations::management::collection_create_request{
131
+ bucket_name_,
132
+ std::move(scope_name),
133
+ std::move(collection_name),
134
+ settings.max_expiry,
135
+ settings.history,
136
+ {},
137
+ options.timeout,
138
+ },
139
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
140
+ }
141
+
142
+ void get_all_scopes(const get_all_scopes_options::built& options, get_all_scopes_handler&& handler) const
143
+ {
144
+ return core_.execute(
145
+ core::operations::management::scope_get_all_request{
146
+ bucket_name_,
147
+ {},
148
+ options.timeout,
149
+ },
150
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), map_scope_specs(resp.manifest)); });
151
+ }
152
+
153
+ void create_scope(std::string scope_name,
154
+ const couchbase::create_scope_options::built& options,
155
+ couchbase::create_scope_handler&& handler) const
156
+ {
157
+ return core_.execute(
158
+ core::operations::management::scope_create_request{
159
+ bucket_name_,
160
+ std::move(scope_name),
161
+ {},
162
+ options.timeout,
163
+ },
164
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
165
+ }
166
+
167
+ void drop_scope(std::string scope_name,
168
+ const couchbase::drop_scope_options::built& options,
169
+ couchbase::drop_scope_handler&& handler) const
170
+ {
171
+ core_.execute(
172
+ core::operations::management::scope_drop_request{
173
+ bucket_name_,
174
+ std::move(scope_name),
175
+ {},
176
+ options.timeout,
177
+ },
178
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
179
+ }
180
+
181
+ private:
182
+ core::cluster core_;
183
+ std::string bucket_name_;
184
+ };
185
+
186
+ collection_manager::collection_manager(core::cluster core, std::string_view bucket_name)
187
+ : impl_(std::make_shared<collection_manager_impl>(std::move(core), bucket_name))
188
+ {
189
+ }
190
+
191
+ void
192
+ collection_manager::drop_collection(std::string scope_name,
193
+ std::string collection_name,
194
+ const couchbase::drop_collection_options& options,
195
+ couchbase::drop_collection_handler&& handler) const
196
+ {
197
+ return impl_->drop_collection(std::move(scope_name), std::move(collection_name), options.build(), std::move(handler));
198
+ }
199
+
200
+ auto
201
+ collection_manager::drop_collection(std::string scope_name,
202
+ std::string collection_name,
203
+ const couchbase::drop_collection_options& options) const -> std::future<manager_error_context>
204
+ {
205
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
206
+ drop_collection(
207
+ std::move(scope_name), std::move(collection_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
208
+ return barrier->get_future();
209
+ }
210
+
211
+ void
212
+ collection_manager::update_collection(std::string scope_name,
213
+ std::string collection_name,
214
+ const update_collection_settings& settings,
215
+ const update_collection_options& options,
216
+ update_collection_handler&& handler) const
217
+ {
218
+ return impl_->update_collection(std::move(scope_name), std::move(collection_name), settings, options.build(), std::move(handler));
219
+ }
220
+
221
+ auto
222
+ collection_manager::update_collection(std::string scope_name,
223
+ std::string collection_name,
224
+ const couchbase::update_collection_settings& settings,
225
+ const couchbase::update_collection_options& options) const -> std::future<manager_error_context>
226
+ {
227
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
228
+ update_collection(std::move(scope_name), std::move(collection_name), settings, options, [barrier](auto ctx) mutable {
229
+ barrier->set_value(std::move(ctx));
230
+ });
231
+ return barrier->get_future();
232
+ }
233
+
234
+ void
235
+ collection_manager::create_collection(std::string scope_name,
236
+ std::string collection_name,
237
+ const couchbase::create_collection_settings& settings,
238
+ const couchbase::create_collection_options& options,
239
+ couchbase::create_collection_handler&& handler) const
240
+ {
241
+ return impl_->create_collection(std::move(scope_name), std::move(collection_name), settings, options.build(), std::move(handler));
242
+ }
243
+
244
+ auto
245
+ collection_manager::create_collection(std::string scope_name,
246
+ std::string collection_name,
247
+ const couchbase::create_collection_settings& settings,
248
+ const couchbase::create_collection_options& options) const -> std::future<manager_error_context>
249
+ {
250
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
251
+ create_collection(std::move(scope_name), std::move(collection_name), settings, options, [barrier](auto ctx) mutable {
252
+ barrier->set_value(std::move(ctx));
253
+ });
254
+ return barrier->get_future();
255
+ }
256
+
257
+ void
258
+ collection_manager::get_all_scopes(const get_all_scopes_options& options, get_all_scopes_handler&& handler) const
259
+ {
260
+ return impl_->get_all_scopes(options.build(), std::move(handler));
261
+ }
262
+
263
+ auto
264
+ collection_manager::get_all_scopes(const couchbase::get_all_scopes_options& options) const
265
+ -> std::future<std::pair<manager_error_context, std::vector<management::bucket::scope_spec>>>
266
+ {
267
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<management::bucket::scope_spec>>>>();
268
+ get_all_scopes(options,
269
+ [barrier](auto ctx, auto result) mutable { barrier->set_value(std::make_pair(std::move(ctx), std::move(result))); });
270
+ return barrier->get_future();
271
+ }
272
+
273
+ void
274
+ collection_manager::create_scope(std::string scope_name,
275
+ const couchbase::create_scope_options& options,
276
+ couchbase::create_scope_handler&& handler) const
277
+ {
278
+ return impl_->create_scope(std::move(scope_name), options.build(), std::move(handler));
279
+ }
280
+
281
+ auto
282
+ collection_manager::create_scope(std::string scope_name, const couchbase::create_scope_options& options) const
283
+ -> std::future<manager_error_context>
284
+ {
285
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
286
+ create_scope(std::move(scope_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
287
+ return barrier->get_future();
288
+ }
289
+
290
+ void
291
+ collection_manager::drop_scope(std::string scope_name,
292
+ const couchbase::drop_scope_options& options,
293
+ couchbase::drop_scope_handler&& handler) const
294
+ {
295
+ return impl_->drop_scope(std::move(scope_name), options.build(), std::move(handler));
296
+ }
297
+
298
+ auto
299
+ collection_manager::drop_scope(std::string scope_name, const couchbase::drop_scope_options& options) const
300
+ -> std::future<manager_error_context>
301
+ {
302
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
303
+ drop_scope(std::move(scope_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
304
+ return barrier->get_future();
305
+ }
306
+ } // namespace couchbase
@@ -57,7 +57,9 @@ configuration_profiles_registry::apply_profile(const std::string& name, couchbas
57
57
  }
58
58
  }
59
59
 
60
- profile->apply(options);
60
+ if (profile) {
61
+ profile->apply(options);
62
+ }
61
63
  }
62
64
 
63
65
  auto
@@ -0,0 +1,294 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2023-present 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 "diagnostics.hxx"
19
+
20
+ #include "core/diagnostics.hxx"
21
+ #include "core/service_type.hxx"
22
+
23
+ #include <couchbase/codec/tao_json_serializer.hxx>
24
+ #include <couchbase/diagnostics_result.hxx>
25
+ #include <couchbase/endpoint_ping_report.hxx>
26
+ #include <couchbase/ping_result.hxx>
27
+ #include <couchbase/service_type.hxx>
28
+
29
+ #include <cstdint>
30
+ #include <map>
31
+ #include <set>
32
+ #include <string>
33
+ #include <vector>
34
+
35
+ namespace couchbase
36
+ {
37
+ namespace
38
+ {
39
+ std::string
40
+ service_type_as_string(service_type service_type)
41
+ {
42
+ switch (service_type) {
43
+ case service_type::key_value:
44
+ return "kv";
45
+ case service_type::query:
46
+ return "query";
47
+ case service_type::analytics:
48
+ return "analytics";
49
+ case service_type::search:
50
+ return "search";
51
+ case service_type::view:
52
+ return "views";
53
+ case service_type::management:
54
+ return "mgmt";
55
+ case service_type::eventing:
56
+ return "eventing";
57
+ }
58
+ return "";
59
+ }
60
+
61
+ std::string
62
+ ping_state_as_string(ping_state state)
63
+ {
64
+ switch (state) {
65
+ case ping_state::ok:
66
+ return "ok";
67
+ case ping_state::timeout:
68
+ return "timeout";
69
+ case ping_state::error:
70
+ return "error";
71
+ }
72
+ return "";
73
+ }
74
+
75
+ std::string
76
+ endpoint_state_as_string(endpoint_state state)
77
+ {
78
+ switch (state) {
79
+ case endpoint_state::connected:
80
+ return "connected";
81
+ case endpoint_state::connecting:
82
+ return "connecting";
83
+ case endpoint_state::disconnected:
84
+ return "disconnected";
85
+ case endpoint_state::disconnecting:
86
+ return "disconnecting";
87
+ }
88
+ return "";
89
+ }
90
+
91
+ codec::tao_json_serializer::document_type
92
+ endpoint_ping_report_as_json(const endpoint_ping_report& report)
93
+ {
94
+ codec::tao_json_serializer::document_type res{
95
+ { "id", report.id() }, { "latency_us", report.latency().count() }, { "remote", report.remote() },
96
+ { "local", report.local() }, { "state", ping_state_as_string(report.state()) },
97
+ };
98
+ if (report.error()) {
99
+ res["error"] = report.error().value();
100
+ }
101
+ if (report.endpoint_namespace()) {
102
+ res["namespace"] = report.endpoint_namespace().value();
103
+ }
104
+ return res;
105
+ }
106
+
107
+ codec::tao_json_serializer::document_type
108
+ endpoint_diagnostics_as_json(const endpoint_diagnostics& report)
109
+ {
110
+ codec::tao_json_serializer::document_type res{
111
+ { "id", report.id() },
112
+ { "local", report.local() },
113
+ { "remote", report.remote() },
114
+ { "state", endpoint_state_as_string(report.state()) },
115
+ };
116
+ if (report.last_activity()) {
117
+ res["last_activity_us"] = report.last_activity().value().count();
118
+ }
119
+ if (report.endpoint_namespace()) {
120
+ res["namespace"] = report.endpoint_namespace().value();
121
+ }
122
+ if (report.details()) {
123
+ res["details"] = report.details();
124
+ }
125
+ return res;
126
+ }
127
+ } // namespace
128
+
129
+ auto
130
+ ping_result::as_json() const -> codec::tao_json_serializer::document_type
131
+ {
132
+ codec::tao_json_serializer::document_type endpoints{};
133
+ for (const auto& [service_type, reports] : endpoints_) {
134
+ std::vector<codec::tao_json_serializer::document_type> json_reports{};
135
+ for (const auto& report : reports) {
136
+ json_reports.emplace_back(endpoint_ping_report_as_json(report));
137
+ }
138
+ endpoints[service_type_as_string(service_type)] = json_reports;
139
+ }
140
+ return {
141
+ { "version", version_ },
142
+ { "id", id_ },
143
+ { "sdk", sdk_ },
144
+ { "services", endpoints },
145
+ };
146
+ }
147
+
148
+ auto
149
+ diagnostics_result::as_json() const -> codec::tao_json_serializer::document_type
150
+ {
151
+ codec::tao_json_serializer::document_type endpoints{};
152
+ for (const auto& [service_type, reports] : endpoints_) {
153
+ std::vector<codec::tao_json_serializer::document_type> json_reports{};
154
+ for (const auto& report : reports) {
155
+ json_reports.emplace_back(endpoint_diagnostics_as_json(report));
156
+ }
157
+ endpoints[service_type_as_string(service_type)] = json_reports;
158
+ }
159
+ return {
160
+ { "id", id_ },
161
+ { "sdk", sdk_ },
162
+ { "version", version_ },
163
+ { "services", endpoints },
164
+ };
165
+ }
166
+ } // namespace couchbase
167
+
168
+ namespace couchbase::core::impl
169
+ {
170
+ namespace
171
+ {
172
+ couchbase::service_type
173
+ to_public_service_type(core::service_type service_type)
174
+ {
175
+ switch (service_type) {
176
+ case core::service_type::key_value:
177
+ return couchbase::service_type::key_value;
178
+ case core::service_type::query:
179
+ return couchbase::service_type::query;
180
+ case core::service_type::analytics:
181
+ return couchbase::service_type::analytics;
182
+ case core::service_type::search:
183
+ return couchbase::service_type::search;
184
+ case core::service_type::view:
185
+ return couchbase::service_type::view;
186
+ case core::service_type::management:
187
+ return couchbase::service_type::management;
188
+ case core::service_type::eventing:
189
+ return couchbase::service_type::eventing;
190
+ }
191
+ return {};
192
+ }
193
+
194
+ couchbase::ping_state
195
+ to_public_ping_state(core::diag::ping_state ping_state)
196
+ {
197
+ switch (ping_state) {
198
+ case core::diag::ping_state::timeout:
199
+ return couchbase::ping_state::timeout;
200
+ case core::diag::ping_state::error:
201
+ return couchbase::ping_state::error;
202
+ case core::diag::ping_state::ok:
203
+ return couchbase::ping_state::ok;
204
+ }
205
+ return {};
206
+ }
207
+
208
+ couchbase::endpoint_state
209
+ to_public_endpoint_state(core::diag::endpoint_state endpoint_state)
210
+ {
211
+ switch (endpoint_state) {
212
+ case core::diag::endpoint_state::connected:
213
+ return couchbase::endpoint_state::connected;
214
+ case diag::endpoint_state::disconnected:
215
+ return couchbase::endpoint_state::disconnected;
216
+ case diag::endpoint_state::connecting:
217
+ return couchbase::endpoint_state::connecting;
218
+ case diag::endpoint_state::disconnecting:
219
+ return couchbase::endpoint_state::disconnecting;
220
+ }
221
+ return {};
222
+ }
223
+ } // namespace
224
+
225
+ std::set<core::service_type>
226
+ to_core_service_types(const std::set<couchbase::service_type>& service_types)
227
+ {
228
+ std::set<core::service_type> res{};
229
+ for (auto s : service_types) {
230
+ switch (s) {
231
+ case couchbase::service_type::key_value:
232
+ res.emplace(core::service_type::key_value);
233
+ break;
234
+ case couchbase::service_type::query:
235
+ res.emplace(core::service_type::query);
236
+ break;
237
+ case couchbase::service_type::analytics:
238
+ res.emplace(core::service_type::analytics);
239
+ break;
240
+ case couchbase::service_type::search:
241
+ res.emplace(core::service_type::search);
242
+ break;
243
+ case couchbase::service_type::view:
244
+ res.emplace(core::service_type::view);
245
+ break;
246
+ case couchbase::service_type::management:
247
+ res.emplace(core::service_type::management);
248
+ break;
249
+ case couchbase::service_type::eventing:
250
+ res.emplace(core::service_type::eventing);
251
+ break;
252
+ }
253
+ }
254
+ return res;
255
+ }
256
+
257
+ couchbase::ping_result
258
+ build_result(const core::diag::ping_result& result)
259
+ {
260
+ std::map<couchbase::service_type, std::vector<couchbase::endpoint_ping_report>> endpoints{};
261
+ for (const auto& [core_service_type, core_endpoints] : result.services) {
262
+ auto service_type = to_public_service_type(core_service_type);
263
+ endpoints[service_type] = std::vector<couchbase::endpoint_ping_report>{};
264
+ for (const auto& info : core_endpoints) {
265
+ endpoints[service_type].emplace_back(
266
+ service_type, info.id, info.local, info.remote, to_public_ping_state(info.state), info.error, info.bucket, info.latency);
267
+ }
268
+ }
269
+
270
+ return { result.id, static_cast<std::uint16_t>(result.version), result.sdk, endpoints };
271
+ }
272
+
273
+ couchbase::diagnostics_result
274
+ build_result(const core::diag::diagnostics_result& result)
275
+ {
276
+ std::map<couchbase::service_type, std::vector<couchbase::endpoint_diagnostics>> endpoints{};
277
+ for (const auto& [core_service_type, core_endpoints] : result.services) {
278
+ auto service_type = to_public_service_type(core_service_type);
279
+ endpoints[service_type] = std::vector<couchbase::endpoint_diagnostics>{};
280
+ for (const auto& info : core_endpoints) {
281
+ endpoints[service_type].emplace_back(service_type,
282
+ info.id,
283
+ info.last_activity,
284
+ info.local,
285
+ info.remote,
286
+ info.bucket,
287
+ to_public_endpoint_state(info.state),
288
+ info.details);
289
+ }
290
+ }
291
+
292
+ return { result.id, static_cast<std::uint16_t>(result.version), result.sdk, endpoints };
293
+ }
294
+ } // namespace couchbase::core::impl
@@ -0,0 +1,39 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2023-Present 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 <couchbase/diagnostics_result.hxx>
21
+ #include <couchbase/ping_result.hxx>
22
+ #include <couchbase/service_type.hxx>
23
+
24
+ #include "core/diagnostics.hxx"
25
+ #include "core/service_type.hxx"
26
+
27
+ #include <set>
28
+
29
+ namespace couchbase::core::impl
30
+ {
31
+ std::set<core::service_type>
32
+ to_core_service_types(const std::set<couchbase::service_type>& service_types);
33
+
34
+ couchbase::ping_result
35
+ build_result(const core::diag::ping_result& result);
36
+
37
+ couchbase::diagnostics_result
38
+ build_result(const core::diag::diagnostics_result& result);
39
+ } // namespace couchbase::core::impl
@@ -20,6 +20,8 @@
20
20
  #include "core/logger/logger.hxx"
21
21
  #include "core/utils/join_strings.hxx"
22
22
 
23
+ #include <couchbase/error_codes.hxx>
24
+
23
25
  #include <asio/bind_executor.hpp>
24
26
  #include <asio/io_context.hpp>
25
27
  #include <asio/post.hpp>