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,820 @@
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
+ #include "core/logger/logger.hxx"
20
+
21
+ #include "core/operations/management/analytics_dataset_create.hxx"
22
+ #include "core/operations/management/analytics_dataset_drop.hxx"
23
+ #include "core/operations/management/analytics_dataset_get_all.hxx"
24
+ #include "core/operations/management/analytics_dataverse_create.hxx"
25
+ #include "core/operations/management/analytics_dataverse_drop.hxx"
26
+ #include "core/operations/management/analytics_get_pending_mutations.hxx"
27
+ #include "core/operations/management/analytics_index_create.hxx"
28
+ #include "core/operations/management/analytics_index_drop.hxx"
29
+ #include "core/operations/management/analytics_index_get_all.hxx"
30
+ #include "core/operations/management/analytics_link_connect.hxx"
31
+ #include "core/operations/management/analytics_link_create.hxx"
32
+ #include "core/operations/management/analytics_link_disconnect.hxx"
33
+ #include "core/operations/management/analytics_link_drop.hxx"
34
+ #include "core/operations/management/analytics_link_get_all.hxx"
35
+ #include "core/operations/management/analytics_link_replace.hxx"
36
+ #include "internal_manager_error_context.hxx"
37
+
38
+ #include <couchbase/analytics_index_manager.hxx>
39
+ #include <couchbase/management/analytics_link.hxx>
40
+
41
+ namespace couchbase
42
+ {
43
+ namespace
44
+ {
45
+ template<typename Response>
46
+ manager_error_context
47
+ build_context(Response& resp)
48
+ {
49
+ return manager_error_context{ internal_manager_error_context{ resp.ctx.ec,
50
+ resp.ctx.last_dispatched_to,
51
+ resp.ctx.last_dispatched_from,
52
+ resp.ctx.retry_attempts,
53
+ std::move(resp.ctx.retry_reasons),
54
+ std::move(resp.ctx.client_context_id),
55
+ resp.ctx.http_status,
56
+ std::move(resp.ctx.http_body),
57
+ std::move(resp.ctx.path) } };
58
+ }
59
+
60
+ core::management::analytics::couchbase_remote_link
61
+ to_core_couchbase_remote_link(const management::analytics_link& link)
62
+ {
63
+ auto cb_link = dynamic_cast<const management::couchbase_remote_analytics_link&>(link);
64
+ core::management::analytics::couchbase_remote_link core_link{ cb_link.name,
65
+ cb_link.dataverse_name,
66
+ cb_link.hostname,
67
+ cb_link.username,
68
+ cb_link.password,
69
+ core::management::analytics::couchbase_link_encryption_settings{
70
+ {},
71
+ cb_link.encryption.certificate,
72
+ cb_link.encryption.client_certificate,
73
+ cb_link.encryption.client_key,
74
+ } };
75
+ switch (cb_link.encryption.encryption_level) {
76
+ case management::analytics_encryption_level::none:
77
+ core_link.encryption.level = core::management::analytics::couchbase_link_encryption_level::none;
78
+ break;
79
+ case management::analytics_encryption_level::half:
80
+ core_link.encryption.level = core::management::analytics::couchbase_link_encryption_level::half;
81
+ break;
82
+ case management::analytics_encryption_level::full:
83
+ core_link.encryption.level = core::management::analytics::couchbase_link_encryption_level::full;
84
+ break;
85
+ }
86
+ return core_link;
87
+ }
88
+
89
+ core::management::analytics::azure_blob_external_link
90
+ to_core_azure_blob_external_link(const management::analytics_link& link)
91
+ {
92
+ auto azure_link = dynamic_cast<const management::azure_blob_external_analytics_link&>(link);
93
+ return core::management::analytics::azure_blob_external_link{
94
+ azure_link.name, azure_link.dataverse_name, azure_link.connection_string, azure_link.account_name,
95
+ azure_link.account_key, azure_link.shared_access_signature, azure_link.blob_endpoint, azure_link.endpoint_suffix,
96
+ };
97
+ }
98
+
99
+ core::management::analytics::s3_external_link
100
+ to_core_s3_external_link(const management::analytics_link& link)
101
+ {
102
+ auto s3_link = dynamic_cast<const management::s3_external_analytics_link&>(link);
103
+ return core::management::analytics::s3_external_link{
104
+ s3_link.name, s3_link.dataverse_name, s3_link.access_key_id, s3_link.secret_access_key,
105
+ s3_link.session_token, s3_link.region, s3_link.service_endpoint,
106
+ };
107
+ }
108
+ } // namespace
109
+
110
+ class analytics_index_manager_impl : public std::enable_shared_from_this<analytics_index_manager_impl>
111
+ {
112
+ public:
113
+ explicit analytics_index_manager_impl(core::cluster core)
114
+ : core_{ std::move(core) }
115
+ {
116
+ }
117
+
118
+ void create_dataverse(const std::string& dataverse_name,
119
+ const create_dataverse_analytics_options::built& options,
120
+ create_dataverse_analytics_handler&& handler) const
121
+ {
122
+ return core_.execute(
123
+ core::operations::management::analytics_dataverse_create_request{
124
+ dataverse_name,
125
+ options.ignore_if_exists,
126
+ {},
127
+ options.timeout,
128
+ },
129
+ [dataverse_name, handler = std::move(handler)](auto resp) {
130
+ CB_LOG_DEBUG("Dataverse create for {} error code = {}", dataverse_name, resp.ctx.ec.value());
131
+ handler(build_context(resp));
132
+ });
133
+ }
134
+
135
+ void drop_dataverse(const std::string& dataverse_name,
136
+ const drop_dataverse_analytics_options::built& options,
137
+ drop_dataverse_analytics_handler&& handler) const
138
+ {
139
+ return core_.execute(
140
+ core::operations::management::analytics_dataverse_drop_request{
141
+ dataverse_name,
142
+ options.ignore_if_not_exists,
143
+ {},
144
+ options.timeout,
145
+ },
146
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
147
+ }
148
+
149
+ void create_dataset(const std::string& dataset_name,
150
+ const std::string& bucket_name,
151
+ const create_dataset_analytics_options::built& options,
152
+ create_dataset_analytics_handler&& handler) const
153
+ {
154
+ return core_.execute(
155
+ core::operations::management::analytics_dataset_create_request{
156
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
157
+ dataset_name,
158
+ bucket_name,
159
+ options.condition,
160
+ {},
161
+ options.timeout,
162
+ options.ignore_if_exists,
163
+ },
164
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
165
+ }
166
+
167
+ void drop_dataset(const std::string& dataset_name,
168
+ const drop_dataset_analytics_options::built& options,
169
+ drop_dataset_analytics_handler&& handler) const
170
+ {
171
+ return core_.execute(
172
+ core::operations::management::analytics_dataset_drop_request{
173
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
174
+ dataset_name,
175
+ options.ignore_if_not_exists,
176
+ {},
177
+ options.timeout,
178
+ },
179
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
180
+ }
181
+
182
+ void get_all_datasets(const get_all_datasets_analytics_options::built& options, get_all_datasets_analytics_handler&& handler) const
183
+ {
184
+ return core_.execute(
185
+ core::operations::management::analytics_dataset_get_all_request{
186
+ {},
187
+ options.timeout,
188
+ },
189
+ [handler = std::move(handler)](core::operations::management::analytics_dataset_get_all_response resp) {
190
+ if (resp.ctx.ec) {
191
+ return handler(build_context(resp), {});
192
+ }
193
+ std::vector<management::analytics_dataset> datasets{};
194
+ datasets.reserve(resp.datasets.size());
195
+ for (const auto& d : resp.datasets) {
196
+ datasets.push_back(management::analytics_dataset{
197
+ d.name,
198
+ d.dataverse_name,
199
+ d.link_name,
200
+ d.bucket_name,
201
+ });
202
+ }
203
+ handler(build_context(resp), datasets);
204
+ });
205
+ }
206
+
207
+ void create_index(const std::string& index_name,
208
+ const std::string& dataset_name,
209
+ const std::map<std::string, std::string>& fields,
210
+ const create_index_analytics_options::built& options,
211
+ create_index_analytics_handler&& handler) const
212
+ {
213
+ return core_.execute(
214
+ core::operations::management::analytics_index_create_request{
215
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
216
+ dataset_name,
217
+ index_name,
218
+ fields,
219
+ options.ignore_if_exists,
220
+ {},
221
+ options.timeout,
222
+ },
223
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
224
+ }
225
+
226
+ void drop_index(const std::string& index_name,
227
+ const std::string& dataset_name,
228
+ const drop_index_analytics_options::built& options,
229
+ drop_index_analytics_handler&& handler) const
230
+ {
231
+ return core_.execute(
232
+ core::operations::management::analytics_index_drop_request{
233
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
234
+ dataset_name,
235
+ index_name,
236
+ options.ignore_if_not_exists,
237
+ {},
238
+ options.timeout,
239
+ },
240
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
241
+ }
242
+
243
+ void get_all_indexes(const get_all_indexes_analytics_options::built& options, get_all_indexes_analytics_handler&& handler) const
244
+ {
245
+ return core_.execute(
246
+ core::operations::management::analytics_index_get_all_request{
247
+ {},
248
+ options.timeout,
249
+ },
250
+ [handler = std::move(handler)](core::operations::management::analytics_index_get_all_response resp) {
251
+ if (resp.ctx.ec) {
252
+ return handler(build_context(resp), {});
253
+ }
254
+ std::vector<management::analytics_index> indexes{};
255
+ indexes.reserve(resp.indexes.size());
256
+ for (const auto& idx : resp.indexes) {
257
+ indexes.push_back(management::analytics_index{
258
+ idx.name,
259
+ idx.dataset_name,
260
+ idx.dataverse_name,
261
+ idx.is_primary,
262
+ });
263
+ }
264
+ handler(build_context(resp), indexes);
265
+ });
266
+ }
267
+
268
+ void connect_link(const connect_link_analytics_options::built& options, connect_link_analytics_handler&& handler) const
269
+ {
270
+ return core_.execute(
271
+ core::operations::management::analytics_link_connect_request{
272
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
273
+ options.link_name.value_or(DEFAULT_LINK_NAME),
274
+ options.force,
275
+ {},
276
+ options.timeout,
277
+ },
278
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
279
+ }
280
+
281
+ void disconnect_link(const disconnect_link_analytics_options::built& options, disconnect_link_analytics_handler&& handler) const
282
+ {
283
+ return core_.execute(
284
+ core::operations::management::analytics_link_disconnect_request{
285
+ options.dataverse_name.value_or(DEFAULT_DATAVERSE_NAME),
286
+ options.link_name.value_or(DEFAULT_LINK_NAME),
287
+ {},
288
+ options.timeout,
289
+ },
290
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
291
+ }
292
+
293
+ void get_pending_mutations(const get_pending_mutations_analytics_options::built& options,
294
+ get_pending_mutations_analytics_handler&& handler) const
295
+ {
296
+ return core_.execute(
297
+ core::operations::management::analytics_get_pending_mutations_request{
298
+ {},
299
+ options.timeout,
300
+ },
301
+ [handler = std::move(handler)](core::operations::management::analytics_get_pending_mutations_response resp) {
302
+ if (resp.ctx.ec) {
303
+ return handler(build_context(resp), {});
304
+ }
305
+ std::map<std::string, std::map<std::string, std::int64_t>> pending_mutations{};
306
+ const std::string separator{ "." };
307
+ for (const auto& [key, mutation_count] : resp.stats) {
308
+ // Keys are encoded as `dataverse.dataset`
309
+ auto separator_pos = key.find(separator);
310
+ auto dataverse_name = key.substr(0, separator_pos);
311
+ auto dataset_name = key.substr(separator_pos + 1, key.size() - separator_pos - 1);
312
+ if (pending_mutations.count(dataverse_name) == 0) {
313
+ pending_mutations.insert({ dataverse_name, {} });
314
+ }
315
+ pending_mutations.at(dataverse_name).insert({ dataset_name, mutation_count });
316
+ }
317
+ handler(build_context(resp), pending_mutations);
318
+ });
319
+ }
320
+
321
+ void create_link(const management::analytics_link& link,
322
+ const create_link_analytics_options::built& options,
323
+ create_link_analytics_handler&& handler) const
324
+ {
325
+ switch (link.link_type()) {
326
+ case management::s3_external:
327
+ return core_.execute(
328
+ core::operations::management::analytics_link_create_request<core::management::analytics::s3_external_link>{
329
+ to_core_s3_external_link(link),
330
+ {},
331
+ options.timeout,
332
+ },
333
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
334
+
335
+ case management::azure_external:
336
+ return core_.execute(
337
+ core::operations::management::analytics_link_create_request<core::management::analytics::azure_blob_external_link>{
338
+ to_core_azure_blob_external_link(link),
339
+ {},
340
+ options.timeout,
341
+ },
342
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
343
+
344
+ case management::couchbase_remote:
345
+ return core_.execute(
346
+ core::operations::management::analytics_link_create_request<core::management::analytics::couchbase_remote_link>{
347
+ to_core_couchbase_remote_link(link),
348
+ {},
349
+ options.timeout,
350
+ },
351
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
352
+ }
353
+ }
354
+
355
+ void replace_link(const management::analytics_link& link,
356
+ const replace_link_analytics_options::built& options,
357
+ replace_link_analytics_handler&& handler) const
358
+ {
359
+ switch (link.link_type()) {
360
+ case management::s3_external:
361
+ return core_.execute(
362
+ core::operations::management::analytics_link_replace_request<core::management::analytics::s3_external_link>{
363
+ to_core_s3_external_link(link),
364
+ {},
365
+ options.timeout,
366
+ },
367
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
368
+
369
+ case management::azure_external:
370
+ return core_.execute(
371
+ core::operations::management::analytics_link_replace_request<core::management::analytics::azure_blob_external_link>{
372
+ to_core_azure_blob_external_link(link),
373
+ {},
374
+ options.timeout,
375
+ },
376
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
377
+
378
+ case management::couchbase_remote:
379
+ return core_.execute(
380
+ core::operations::management::analytics_link_replace_request<core::management::analytics::couchbase_remote_link>{
381
+ to_core_couchbase_remote_link(link),
382
+ {},
383
+ options.timeout,
384
+ },
385
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
386
+ }
387
+ }
388
+
389
+ void drop_link(const std::string& link_name,
390
+ const std::string& dataverse_name,
391
+ const drop_link_analytics_options::built& options,
392
+ drop_link_analytics_handler&& handler) const
393
+ {
394
+ return core_.execute(
395
+ core::operations::management::analytics_link_drop_request{
396
+ link_name,
397
+ dataverse_name,
398
+ {},
399
+ options.timeout,
400
+ },
401
+ [handler = std::move(handler)](auto resp) { handler(build_context(resp)); });
402
+ }
403
+
404
+ void get_links(const get_links_analytics_options::built& options, get_links_analytics_handler&& handler) const
405
+ {
406
+ core::operations::management::analytics_link_get_all_request req{
407
+ {}, {}, {}, {}, options.timeout,
408
+ };
409
+ if (options.name.has_value()) {
410
+ req.link_name = options.name.value();
411
+ }
412
+ if (options.dataverse_name.has_value()) {
413
+ req.dataverse_name = options.dataverse_name.value();
414
+ }
415
+ if (options.link_type.has_value()) {
416
+ switch (options.link_type.value()) {
417
+ case management::s3_external:
418
+ req.link_type = "s3";
419
+ break;
420
+ case management::azure_external:
421
+ req.link_type = "azureblob";
422
+ break;
423
+ case management::couchbase_remote:
424
+ req.link_type = "couchbase";
425
+ break;
426
+ }
427
+ }
428
+ return core_.execute(req, [handler = std::move(handler)](core::operations::management::analytics_link_get_all_response resp) {
429
+ if (resp.ctx.ec) {
430
+ return handler(build_context(resp), {});
431
+ }
432
+ std::vector<std::unique_ptr<management::analytics_link>> links{};
433
+
434
+ for (const auto& link : resp.couchbase) {
435
+ auto cb_link = std::make_unique<management::couchbase_remote_analytics_link>();
436
+ cb_link->name = link.link_name;
437
+ cb_link->dataverse_name = link.dataverse;
438
+ cb_link->hostname = link.hostname;
439
+ switch (link.encryption.level) {
440
+ case core::management::analytics::couchbase_link_encryption_level::none:
441
+ cb_link->encryption.encryption_level = management::analytics_encryption_level::none;
442
+ break;
443
+ case core::management::analytics::couchbase_link_encryption_level::half:
444
+ cb_link->encryption.encryption_level = management::analytics_encryption_level::half;
445
+ break;
446
+ case core::management::analytics::couchbase_link_encryption_level::full:
447
+ cb_link->encryption.encryption_level = management::analytics_encryption_level::full;
448
+ break;
449
+ }
450
+ cb_link->encryption.certificate = link.encryption.certificate;
451
+ cb_link->encryption.client_certificate = link.encryption.client_certificate;
452
+ cb_link->username = link.username;
453
+ links.push_back(std::move(cb_link));
454
+ }
455
+
456
+ for (const auto& link : resp.s3) {
457
+ auto s3_link = std::make_unique<management::s3_external_analytics_link>();
458
+ s3_link->name = link.link_name;
459
+ s3_link->dataverse_name = link.dataverse;
460
+ s3_link->access_key_id = link.access_key_id;
461
+ s3_link->region = link.region;
462
+ s3_link->service_endpoint = link.service_endpoint;
463
+ links.push_back(std::move(s3_link));
464
+ }
465
+
466
+ for (const auto& link : resp.azure_blob) {
467
+ auto azure_link = std::make_unique<management::azure_blob_external_analytics_link>();
468
+ azure_link->name = link.link_name;
469
+ azure_link->dataverse_name = link.dataverse;
470
+ azure_link->account_name = link.account_name;
471
+ azure_link->blob_endpoint = link.blob_endpoint;
472
+ azure_link->endpoint_suffix = link.endpoint_suffix;
473
+ links.push_back(std::move(azure_link));
474
+ }
475
+
476
+ handler(build_context(resp), std::move(links));
477
+ });
478
+ }
479
+
480
+ private:
481
+ static const inline std::string DEFAULT_DATAVERSE_NAME = "Default";
482
+ static const inline std::string DEFAULT_LINK_NAME = "Local";
483
+
484
+ core::cluster core_;
485
+ };
486
+
487
+ analytics_index_manager::analytics_index_manager(core::cluster core)
488
+ : impl_(std::make_shared<analytics_index_manager_impl>(std::move(core)))
489
+ {
490
+ }
491
+
492
+ void
493
+ analytics_index_manager::create_dataverse(std::string dataverse_name,
494
+ const create_dataverse_analytics_options& options,
495
+ create_dataverse_analytics_handler&& handler) const
496
+ {
497
+ return impl_->create_dataverse(dataverse_name, options.build(), std::move(handler));
498
+ }
499
+
500
+ auto
501
+ analytics_index_manager::create_dataverse(std::string dataverse_name, const create_dataverse_analytics_options& options) const
502
+ -> std::future<manager_error_context>
503
+ {
504
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
505
+ auto future = barrier->get_future();
506
+ create_dataverse(std::move(dataverse_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
507
+ return future;
508
+ }
509
+
510
+ void
511
+ analytics_index_manager::drop_dataverse(std::string dataverse_name,
512
+ const drop_dataverse_analytics_options& options,
513
+ drop_dataverse_analytics_handler&& handler) const
514
+ {
515
+ return impl_->drop_dataverse(dataverse_name, options.build(), std::move(handler));
516
+ }
517
+
518
+ auto
519
+ analytics_index_manager::drop_dataverse(std::string dataverse_name, const drop_dataverse_analytics_options& options) const
520
+ -> std::future<manager_error_context>
521
+ {
522
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
523
+ auto future = barrier->get_future();
524
+ drop_dataverse(std::move(dataverse_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
525
+ return future;
526
+ }
527
+
528
+ void
529
+ analytics_index_manager::create_dataset(std::string dataset_name,
530
+ std::string bucket_name,
531
+ const create_dataset_analytics_options& options,
532
+ create_dataset_analytics_handler&& handler) const
533
+ {
534
+ return impl_->create_dataset(dataset_name, bucket_name, options.build(), std::move(handler));
535
+ }
536
+
537
+ auto
538
+ analytics_index_manager::create_dataset(std::string dataset_name,
539
+ std::string bucket_name,
540
+ const create_dataset_analytics_options& options) const -> std::future<manager_error_context>
541
+ {
542
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
543
+ auto future = barrier->get_future();
544
+ create_dataset(
545
+ std::move(dataset_name), std::move(bucket_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
546
+ return future;
547
+ }
548
+
549
+ void
550
+ analytics_index_manager::drop_dataset(std::string dataset_name,
551
+ const drop_dataset_analytics_options& options,
552
+ drop_dataset_analytics_handler&& handler) const
553
+ {
554
+ return impl_->drop_dataset(dataset_name, options.build(), std::move(handler));
555
+ }
556
+
557
+ auto
558
+ analytics_index_manager::drop_dataset(std::string dataset_name, const drop_dataset_analytics_options& options) const
559
+ -> std::future<manager_error_context>
560
+ {
561
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
562
+ auto future = barrier->get_future();
563
+ drop_dataset(std::move(dataset_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
564
+ return future;
565
+ }
566
+
567
+ void
568
+ analytics_index_manager::get_all_datasets(const get_all_datasets_analytics_options& options,
569
+ get_all_datasets_analytics_handler&& handler) const
570
+ {
571
+ return impl_->get_all_datasets(options.build(), std::move(handler));
572
+ }
573
+
574
+ auto
575
+ analytics_index_manager::get_all_datasets(const get_all_datasets_analytics_options& options) const
576
+ -> std::future<std::pair<manager_error_context, std::vector<management::analytics_dataset>>>
577
+ {
578
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<management::analytics_dataset>>>>();
579
+ auto future = barrier->get_future();
580
+ get_all_datasets(options, [barrier](auto ctx, auto resp) mutable { barrier->set_value({ std::move(ctx), std::move(resp) }); });
581
+ return future;
582
+ }
583
+
584
+ void
585
+ analytics_index_manager::create_index(std::string index_name,
586
+ std::string dataset_name,
587
+ std::map<std::string, std::string> fields,
588
+ const create_index_analytics_options& options,
589
+ create_index_analytics_handler&& handler) const
590
+ {
591
+ return impl_->create_index(index_name, dataset_name, fields, options.build(), std::move(handler));
592
+ }
593
+
594
+ auto
595
+ analytics_index_manager::create_index(std::string index_name,
596
+ std::string dataset_name,
597
+ std::map<std::string, std::string> fields,
598
+ const create_index_analytics_options& options) const -> std::future<manager_error_context>
599
+ {
600
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
601
+ auto future = barrier->get_future();
602
+ create_index(std::move(index_name), std::move(dataset_name), std::move(fields), options, [barrier](auto ctx) mutable {
603
+ barrier->set_value({ std::move(ctx) });
604
+ });
605
+ return future;
606
+ }
607
+
608
+ void
609
+ analytics_index_manager::drop_index(std::string index_name,
610
+ std::string dataset_name,
611
+ const drop_index_analytics_options& options,
612
+ drop_index_analytics_handler&& handler) const
613
+ {
614
+ return impl_->drop_index(index_name, dataset_name, options.build(), std::move(handler));
615
+ }
616
+
617
+ auto
618
+ analytics_index_manager::drop_index(std::string index_name, std::string dataset_name, const drop_index_analytics_options& options) const
619
+ -> std::future<manager_error_context>
620
+ {
621
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
622
+ auto future = barrier->get_future();
623
+ drop_index(
624
+ std::move(index_name), std::move(dataset_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
625
+ return future;
626
+ }
627
+
628
+ void
629
+ analytics_index_manager::get_all_indexes(const get_all_indexes_analytics_options& options,
630
+ get_all_indexes_analytics_handler&& handler) const
631
+ {
632
+ return impl_->get_all_indexes(options.build(), std::move(handler));
633
+ }
634
+
635
+ auto
636
+ analytics_index_manager::get_all_indexes(const get_all_indexes_analytics_options& options) const
637
+ -> std::future<std::pair<manager_error_context, std::vector<management::analytics_index>>>
638
+ {
639
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<management::analytics_index>>>>();
640
+ auto future = barrier->get_future();
641
+ get_all_indexes(options, [barrier](auto ctx, auto resp) mutable { barrier->set_value({ std::move(ctx), std::move(resp) }); });
642
+ return future;
643
+ }
644
+
645
+ void
646
+ analytics_index_manager::connect_link(const connect_link_analytics_options& options, connect_link_analytics_handler&& handler) const
647
+ {
648
+ return impl_->connect_link(options.build(), std::move(handler));
649
+ }
650
+
651
+ auto
652
+ analytics_index_manager::connect_link(const connect_link_analytics_options& options) const -> std::future<manager_error_context>
653
+ {
654
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
655
+ auto future = barrier->get_future();
656
+ connect_link(options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
657
+ return future;
658
+ }
659
+
660
+ void
661
+ analytics_index_manager::disconnect_link(const disconnect_link_analytics_options& options,
662
+ disconnect_link_analytics_handler&& handler) const
663
+ {
664
+ return impl_->disconnect_link(options.build(), std::move(handler));
665
+ }
666
+
667
+ auto
668
+ analytics_index_manager::disconnect_link(const disconnect_link_analytics_options& options) const -> std::future<manager_error_context>
669
+ {
670
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
671
+ auto future = barrier->get_future();
672
+ disconnect_link(options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
673
+ return future;
674
+ }
675
+
676
+ void
677
+ analytics_index_manager::get_pending_mutations(const get_pending_mutations_analytics_options& options,
678
+ get_pending_mutations_analytics_handler&& handler) const
679
+ {
680
+ return impl_->get_pending_mutations(options.build(), std::move(handler));
681
+ }
682
+
683
+ auto
684
+ analytics_index_manager::get_pending_mutations(const get_pending_mutations_analytics_options& options) const
685
+ -> std::future<std::pair<couchbase::manager_error_context, std::map<std::string, std::map<std::string, std::int64_t>>>>
686
+ {
687
+ auto barrier = std::make_shared<
688
+ std::promise<std::pair<couchbase::manager_error_context, std::map<std::string, std::map<std::string, std::int64_t>>>>>();
689
+ auto future = barrier->get_future();
690
+ get_pending_mutations(options, [barrier](auto ctx, auto resp) mutable { barrier->set_value({ std::move(ctx), std::move(resp) }); });
691
+ return future;
692
+ }
693
+
694
+ void
695
+ analytics_index_manager::create_link(const management::analytics_link& link,
696
+ const create_link_analytics_options& options,
697
+ create_link_analytics_handler&& handler) const
698
+ {
699
+ return impl_->create_link(link, options.build(), std::move(handler));
700
+ }
701
+
702
+ auto
703
+ analytics_index_manager::create_link(const management::analytics_link& link, const create_link_analytics_options& options) const
704
+ -> std::future<manager_error_context>
705
+ {
706
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
707
+ auto future = barrier->get_future();
708
+ create_link(link, options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
709
+ return future;
710
+ }
711
+
712
+ void
713
+ analytics_index_manager::replace_link(const management::analytics_link& link,
714
+ const replace_link_analytics_options& options,
715
+ replace_link_analytics_handler&& handler) const
716
+ {
717
+ return impl_->replace_link(link, options.build(), std::move(handler));
718
+ }
719
+
720
+ auto
721
+ analytics_index_manager::replace_link(const management::analytics_link& link, const replace_link_analytics_options& options) const
722
+ -> std::future<manager_error_context>
723
+ {
724
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
725
+ auto future = barrier->get_future();
726
+ replace_link(link, options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
727
+ return future;
728
+ }
729
+
730
+ void
731
+ analytics_index_manager::drop_link(std::string link_name,
732
+ std::string dataverse_name,
733
+ const drop_link_analytics_options& options,
734
+ drop_link_analytics_handler&& handler) const
735
+ {
736
+ return impl_->drop_link(link_name, dataverse_name, options.build(), std::move(handler));
737
+ }
738
+
739
+ auto
740
+ analytics_index_manager::drop_link(std::string link_name, std::string dataverse_name, const drop_link_analytics_options& options) const
741
+ -> std::future<manager_error_context>
742
+ {
743
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
744
+ auto future = barrier->get_future();
745
+ drop_link(
746
+ std::move(link_name), std::move(dataverse_name), options, [barrier](auto ctx) mutable { barrier->set_value({ std::move(ctx) }); });
747
+ return future;
748
+ }
749
+
750
+ void
751
+ analytics_index_manager::get_links(const get_links_analytics_options& options, get_links_analytics_handler&& handler) const
752
+ {
753
+ return impl_->get_links(options.build(), std::move(handler));
754
+ }
755
+
756
+ auto
757
+ analytics_index_manager::get_links(const get_links_analytics_options& options) const
758
+ -> std::future<std::pair<manager_error_context, std::vector<std::unique_ptr<management::analytics_link>>>>
759
+ {
760
+ auto barrier =
761
+ std::make_shared<std::promise<std::pair<manager_error_context, std::vector<std::unique_ptr<management::analytics_link>>>>>();
762
+ auto future = barrier->get_future();
763
+ get_links(options, [barrier](auto ctx, auto resp) mutable { barrier->set_value({ std::move(ctx), std::move(resp) }); });
764
+ return future;
765
+ }
766
+
767
+ management::analytics_link::analytics_link(std::string name, std::string dataverse_name)
768
+ : name(std::move(name))
769
+ , dataverse_name(std::move(dataverse_name))
770
+ {
771
+ }
772
+
773
+ management::couchbase_remote_analytics_link::couchbase_remote_analytics_link(std::string name,
774
+ std::string dataverse_name,
775
+ std::string hostname,
776
+ couchbase_analytics_encryption_settings encryption,
777
+ std::optional<std::string> username,
778
+ std::optional<std::string> password)
779
+ : analytics_link(std::move(name), std::move(dataverse_name))
780
+ , hostname(std::move(hostname))
781
+ , encryption(std::move(encryption))
782
+ , username(std::move(username))
783
+ , password(std::move(password))
784
+ {
785
+ }
786
+
787
+ management::s3_external_analytics_link::s3_external_analytics_link(std::string name,
788
+ std::string dataverse_name,
789
+ std::string access_key_id,
790
+ std::string secret_access_key,
791
+ std::string region,
792
+ std::optional<std::string> session_token,
793
+ std::optional<std::string> service_endpoint)
794
+ : analytics_link(std::move(name), std::move(dataverse_name))
795
+ , access_key_id(std::move(access_key_id))
796
+ , secret_access_key(std::move(secret_access_key))
797
+ , region(std::move(region))
798
+ , session_token(std::move(session_token))
799
+ , service_endpoint(std::move(service_endpoint))
800
+ {
801
+ }
802
+
803
+ management::azure_blob_external_analytics_link::azure_blob_external_analytics_link(std::string name,
804
+ std::string dataverse_name,
805
+ std::optional<std::string> connection_string,
806
+ std::optional<std::string> account_name,
807
+ std::optional<std::string> account_key,
808
+ std::optional<std::string> shared_access_signature,
809
+ std::optional<std::string> blob_endpoint,
810
+ std::optional<std::string> endpoint_suffix)
811
+ : analytics_link(std::move(name), std::move(dataverse_name))
812
+ , connection_string(std::move(connection_string))
813
+ , account_name(std::move(account_name))
814
+ , account_key(std::move(account_key))
815
+ , shared_access_signature(std::move(shared_access_signature))
816
+ , blob_endpoint(std::move(blob_endpoint))
817
+ , endpoint_suffix(std::move(endpoint_suffix))
818
+ {
819
+ }
820
+ } // namespace couchbase