couchbase 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/CMakeLists.txt +16 -1
  4. data/ext/cache/cpm/{CPM_0.42.0.cmake → CPM_0.43.1.cmake} +18 -2
  5. data/ext/cache/extconf_include.rb +6 -6
  6. data/ext/cache/mozilla-ca-bundle.crt +214 -155
  7. data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
  8. data/ext/couchbase/CMakeLists.txt +130 -21
  9. data/ext/couchbase/cmake/APKBUILD.in +25 -4
  10. data/ext/couchbase/cmake/Bundler.cmake +143 -34
  11. data/ext/couchbase/cmake/CPM.cmake +126 -12
  12. data/ext/couchbase/cmake/Cache.cmake +7 -1
  13. data/ext/couchbase/cmake/CompilerOptions.cmake +1 -1
  14. data/ext/couchbase/cmake/CompilerWarnings.cmake +17 -6
  15. data/ext/couchbase/cmake/GrpcProtobuf.cmake +481 -0
  16. data/ext/couchbase/cmake/OpenSSL.cmake +10 -3
  17. data/ext/couchbase/cmake/Packaging.cmake +519 -65
  18. data/ext/couchbase/cmake/Protostellar.cmake +250 -0
  19. data/ext/couchbase/cmake/Sanitizers.cmake +61 -50
  20. data/ext/couchbase/cmake/StaticAnalyzers.cmake +16 -5
  21. data/ext/couchbase/cmake/TestFramework.cmake +283 -0
  22. data/ext/couchbase/cmake/TestFrameworkAddTests.cmake +51 -0
  23. data/ext/couchbase/cmake/Testing.cmake +27 -9
  24. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +141 -8
  25. data/ext/couchbase/cmake/VersionInfo.cmake +50 -0
  26. data/ext/couchbase/cmake/build_config.hxx.in +2 -1
  27. data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +101 -23
  28. data/ext/couchbase/cmake/couchbase_cxx_client_static-config.cmake.in +7 -0
  29. data/ext/couchbase/cmake/couchbase_cxx_client_static.pc.in +2 -0
  30. data/ext/couchbase/cmake/gRPC_Generate.cmake +58 -0
  31. data/ext/couchbase/cmake/protobuf_Generate.cmake +69 -0
  32. data/ext/couchbase/cmake/require-git-checkout.cmake +25 -0
  33. data/ext/couchbase/cmake/tarball_glob.txt +49 -0
  34. data/ext/couchbase/core/agent_group.cxx +0 -8
  35. data/ext/couchbase/core/agent_group.hxx +0 -4
  36. data/ext/couchbase/core/analytics_stream.cxx +314 -0
  37. data/ext/couchbase/core/analytics_stream.hxx +129 -0
  38. data/ext/couchbase/core/analytics_stream_component.cxx +245 -0
  39. data/ext/couchbase/core/analytics_stream_component.hxx +67 -0
  40. data/ext/couchbase/core/app_telemetry_meter.cxx +25 -3
  41. data/ext/couchbase/core/app_telemetry_meter.hxx +77 -0
  42. data/ext/couchbase/core/app_telemetry_reporter.cxx +7 -6
  43. data/ext/couchbase/core/bucket.cxx +381 -87
  44. data/ext/couchbase/core/bucket.hxx +105 -25
  45. data/ext/couchbase/core/bucket_unit_test_api.hxx +57 -0
  46. data/ext/couchbase/core/capella.hxx +91 -0
  47. data/ext/couchbase/core/cluster.cxx +1554 -398
  48. data/ext/couchbase/core/cluster.hxx +39 -8
  49. data/ext/couchbase/core/cluster_agent.cxx +0 -8
  50. data/ext/couchbase/core/cluster_agent.hxx +0 -4
  51. data/ext/couchbase/core/cluster_options.hxx +26 -3
  52. data/ext/couchbase/core/collections_component.cxx +39 -15
  53. data/ext/couchbase/core/config_profiles.cxx +1 -1
  54. data/ext/couchbase/core/crud_component.cxx +2 -2
  55. data/ext/couchbase/core/crud_options.hxx +34 -0
  56. data/ext/couchbase/core/crypto/cbcrypto.cc +18 -13
  57. data/ext/couchbase/core/document_id_redaction.hxx +81 -0
  58. data/ext/couchbase/core/error_context/base_error_context.hxx +7 -6
  59. data/ext/couchbase/core/error_context/key_value.cxx +25 -2
  60. data/ext/couchbase/core/error_context/key_value.hxx +60 -33
  61. data/ext/couchbase/core/error_context/key_value_error_context.hxx +16 -15
  62. data/ext/couchbase/core/error_context/search.hxx +5 -0
  63. data/ext/couchbase/core/error_context/search_json.hxx +3 -0
  64. data/ext/couchbase/core/error_context/subdocument_error_context.hxx +19 -18
  65. data/ext/couchbase/core/error_context/view.hxx +5 -0
  66. data/ext/couchbase/core/free_form_http_request.cxx +237 -4
  67. data/ext/couchbase/core/free_form_http_request.hxx +41 -8
  68. data/ext/couchbase/core/http_component.cxx +300 -284
  69. data/ext/couchbase/core/http_component.hxx +0 -4
  70. data/ext/couchbase/core/impl/analytics.cxx +38 -5
  71. data/ext/couchbase/core/impl/analytics.hxx +34 -0
  72. data/ext/couchbase/core/impl/bootstrap_error.hxx +0 -3
  73. data/ext/couchbase/core/impl/collection.cxx +215 -202
  74. data/ext/couchbase/core/impl/collection_manager.cxx +1 -1
  75. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +45 -18
  76. data/ext/couchbase/core/impl/error.cxx +22 -2
  77. data/ext/couchbase/core/impl/internal_analytics_stream_result.hxx +111 -0
  78. data/ext/couchbase/core/impl/internal_query_stream_result.hxx +110 -0
  79. data/ext/couchbase/core/impl/invoke_with_node_id.hxx +15 -7
  80. data/ext/couchbase/core/impl/key_value_error_category.cxx +6 -0
  81. data/ext/couchbase/core/impl/lookup_in_replica.cxx +10 -10
  82. data/ext/couchbase/core/impl/lookup_in_replica.hxx +4 -4
  83. data/ext/couchbase/core/impl/node_id.cxx +49 -13
  84. data/ext/couchbase/core/impl/observability_recorder.cxx +12 -2
  85. data/ext/couchbase/core/impl/observe_poll.cxx +63 -23
  86. data/ext/couchbase/core/impl/public_analytics_stream_result.cxx +372 -0
  87. data/ext/couchbase/core/impl/public_bucket.cxx +48 -2
  88. data/ext/couchbase/core/impl/public_cluster.cxx +325 -25
  89. data/ext/couchbase/core/impl/public_query_stream_result.cxx +380 -0
  90. data/ext/couchbase/core/impl/public_transaction_get_multi_replicas_from_preferred_server_group_result.cxx +42 -0
  91. data/ext/couchbase/core/impl/public_transaction_get_multi_result.cxx +42 -0
  92. data/ext/couchbase/core/impl/query.cxx +76 -7
  93. data/ext/couchbase/core/impl/query.hxx +36 -0
  94. data/ext/couchbase/core/impl/query_index_manager.cxx +54 -1
  95. data/ext/couchbase/core/impl/replica_utils.cxx +101 -0
  96. data/ext/couchbase/core/impl/replica_utils.hxx +64 -0
  97. data/ext/couchbase/core/impl/resolve_node_id.hxx +125 -0
  98. data/ext/couchbase/core/impl/scope.cxx +70 -0
  99. data/ext/couchbase/core/impl/search.cxx +31 -1
  100. data/ext/couchbase/core/impl/transactions.cxx +130 -0
  101. data/ext/couchbase/core/impl/wait_until_ready.cxx +439 -0
  102. data/ext/couchbase/core/impl/wait_until_ready.hxx +110 -0
  103. data/ext/couchbase/core/impl/with_bucket_config_or_timeout.hxx +180 -0
  104. data/ext/couchbase/core/impl/with_cancellation.hxx +11 -3
  105. data/ext/couchbase/core/io/configuration_belongs_to_session.hxx +66 -0
  106. data/ext/couchbase/core/io/dns_client.cxx +122 -45
  107. data/ext/couchbase/core/io/dns_codec.hxx +21 -21
  108. data/ext/couchbase/core/io/dns_config.cxx +21 -6
  109. data/ext/couchbase/core/io/http_command.hxx +149 -121
  110. data/ext/couchbase/core/io/http_error.hxx +107 -0
  111. data/ext/couchbase/core/io/http_parser.cxx +4 -0
  112. data/ext/couchbase/core/io/http_session.cxx +606 -154
  113. data/ext/couchbase/core/io/http_session.hxx +147 -30
  114. data/ext/couchbase/core/io/http_session_manager.hxx +329 -382
  115. data/ext/couchbase/core/io/http_streaming_parser.cxx +4 -0
  116. data/ext/couchbase/core/io/http_streaming_response.cxx +328 -43
  117. data/ext/couchbase/core/io/http_streaming_response.hxx +37 -3
  118. data/ext/couchbase/core/io/mcbp_buffer_pool.hxx +122 -0
  119. data/ext/couchbase/core/io/mcbp_command.hxx +150 -51
  120. data/ext/couchbase/core/io/mcbp_command_id.hxx +45 -0
  121. data/ext/couchbase/core/io/mcbp_message.cxx +9 -1
  122. data/ext/couchbase/core/io/mcbp_message.hxx +19 -0
  123. data/ext/couchbase/core/io/mcbp_output_queue.hxx +150 -0
  124. data/ext/couchbase/core/io/mcbp_parser.cxx +24 -7
  125. data/ext/couchbase/core/io/mcbp_session.cxx +316 -317
  126. data/ext/couchbase/core/io/mcbp_session.hxx +27 -18
  127. data/ext/couchbase/core/io/opaque_ring_table.hxx +145 -0
  128. data/ext/couchbase/core/io/retry_orchestrator.hxx +6 -5
  129. data/ext/couchbase/core/io/stream_deadline.hxx +50 -0
  130. data/ext/couchbase/core/io/streams.cxx +275 -14
  131. data/ext/couchbase/core/io/streams.hxx +53 -0
  132. data/ext/couchbase/core/logger/logger.cxx +36 -0
  133. data/ext/couchbase/core/logger/logger.hxx +46 -6
  134. data/ext/couchbase/core/logger/redaction.hxx +503 -0
  135. data/ext/couchbase/core/management/eventing_status.hxx +10 -0
  136. data/ext/couchbase/core/management/eventing_status_json.hxx +4 -0
  137. data/ext/couchbase/core/mcbp/big_endian.cxx +1 -1
  138. data/ext/couchbase/core/mcbp/codec.cxx +27 -18
  139. data/ext/couchbase/core/mcbp/operation_queue.cxx +2 -2
  140. data/ext/couchbase/core/mcbp/packet.hxx +2 -2
  141. data/ext/couchbase/core/mcbp/queue_request.cxx +23 -6
  142. data/ext/couchbase/core/mcbp/queue_request.hxx +21 -0
  143. data/ext/couchbase/core/meta/features.hxx +13 -0
  144. data/ext/couchbase/core/meta/version.cxx +6 -3
  145. data/ext/couchbase/core/metrics/logging_meter.cxx +5 -10
  146. data/ext/couchbase/core/metrics/meter_wrapper.cxx +63 -33
  147. data/ext/couchbase/core/metrics/meter_wrapper.hxx +55 -3
  148. data/ext/couchbase/core/operations/analytics_response_parsing.cxx +177 -0
  149. data/ext/couchbase/core/operations/analytics_response_parsing.hxx +55 -0
  150. data/ext/couchbase/core/operations/document_analytics.cxx +48 -130
  151. data/ext/couchbase/core/operations/document_analytics.hxx +14 -2
  152. data/ext/couchbase/core/operations/document_get_all_replicas.hxx +15 -7
  153. data/ext/couchbase/core/operations/document_get_any_replica.hxx +19 -8
  154. data/ext/couchbase/core/operations/document_get_projected.cxx +1 -1
  155. data/ext/couchbase/core/{impl/get_replica.cxx → operations/document_get_replica.cxx} +21 -3
  156. data/ext/couchbase/core/{impl/get_replica.hxx → operations/document_get_replica.hxx} +31 -4
  157. data/ext/couchbase/core/operations/document_lookup_in.cxx +10 -10
  158. data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +228 -198
  159. data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +215 -217
  160. data/ext/couchbase/core/operations/document_query.cxx +108 -221
  161. data/ext/couchbase/core/operations/document_query.hxx +18 -4
  162. data/ext/couchbase/core/operations/document_search.cxx +52 -8
  163. data/ext/couchbase/core/operations/document_search.hxx +3 -0
  164. data/ext/couchbase/core/operations/document_view.cxx +3 -3
  165. data/ext/couchbase/core/operations/management/analytics_dataset_create.cxx +15 -8
  166. data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +4 -0
  167. data/ext/couchbase/core/operations/management/analytics_dataset_drop.cxx +11 -6
  168. data/ext/couchbase/core/operations/management/analytics_dataset_get_all.cxx +3 -2
  169. data/ext/couchbase/core/operations/management/analytics_dataverse_create.cxx +10 -5
  170. data/ext/couchbase/core/operations/management/analytics_dataverse_drop.cxx +10 -5
  171. data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.cxx +2 -1
  172. data/ext/couchbase/core/operations/management/analytics_index_create.cxx +33 -8
  173. data/ext/couchbase/core/operations/management/analytics_index_drop.cxx +12 -7
  174. data/ext/couchbase/core/operations/management/analytics_index_get_all.cxx +3 -2
  175. data/ext/couchbase/core/operations/management/analytics_link_connect.cxx +11 -6
  176. data/ext/couchbase/core/operations/management/analytics_link_create.cxx +3 -3
  177. data/ext/couchbase/core/operations/management/analytics_link_disconnect.cxx +10 -4
  178. data/ext/couchbase/core/operations/management/analytics_link_drop.cxx +6 -4
  179. data/ext/couchbase/core/operations/management/analytics_link_get_all.cxx +4 -3
  180. data/ext/couchbase/core/operations/management/analytics_link_replace.cxx +3 -3
  181. data/ext/couchbase/core/operations/management/analytics_link_utils.hxx +1 -1
  182. data/ext/couchbase/core/operations/management/bucket_create.cxx +37 -38
  183. data/ext/couchbase/core/operations/management/bucket_update.cxx +26 -28
  184. data/ext/couchbase/core/operations/management/change_password.cxx +2 -0
  185. data/ext/couchbase/core/operations/management/collection_drop.cxx +5 -1
  186. data/ext/couchbase/core/operations/management/error_utils.cxx +59 -5
  187. data/ext/couchbase/core/operations/management/error_utils.hxx +29 -1
  188. data/ext/couchbase/core/operations/management/eventing_deploy_function.cxx +9 -3
  189. data/ext/couchbase/core/operations/management/eventing_drop_function.cxx +8 -3
  190. data/ext/couchbase/core/operations/management/eventing_get_all_functions.cxx +4 -2
  191. data/ext/couchbase/core/operations/management/eventing_get_function.cxx +5 -3
  192. data/ext/couchbase/core/operations/management/eventing_get_status.cxx +4 -2
  193. data/ext/couchbase/core/operations/management/eventing_pause_function.cxx +9 -3
  194. data/ext/couchbase/core/operations/management/eventing_resume_function.cxx +9 -3
  195. data/ext/couchbase/core/operations/management/eventing_undeploy_function.cxx +9 -3
  196. data/ext/couchbase/core/operations/management/eventing_upsert_function.cxx +9 -3
  197. data/ext/couchbase/core/operations/management/group_drop.cxx +3 -1
  198. data/ext/couchbase/core/operations/management/group_get.cxx +3 -1
  199. data/ext/couchbase/core/operations/management/group_upsert.cxx +11 -8
  200. data/ext/couchbase/core/operations/management/query_index_build.cxx +5 -2
  201. data/ext/couchbase/core/operations/management/query_index_create.cxx +9 -3
  202. data/ext/couchbase/core/operations/management/query_index_drop.cxx +11 -4
  203. data/ext/couchbase/core/operations/management/query_index_get_all.cxx +1 -1
  204. data/ext/couchbase/core/operations/management/query_index_get_all_deferred.cxx +1 -1
  205. data/ext/couchbase/core/operations/management/scope_drop.cxx +5 -1
  206. data/ext/couchbase/core/operations/management/scope_get_all.cxx +6 -1
  207. data/ext/couchbase/core/operations/management/search_get_stats.cxx +10 -0
  208. data/ext/couchbase/core/operations/management/search_index_analyze_document.cxx +3 -2
  209. data/ext/couchbase/core/operations/management/search_index_control_ingest.cxx +4 -3
  210. data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.cxx +4 -3
  211. data/ext/couchbase/core/operations/management/search_index_control_query.cxx +4 -3
  212. data/ext/couchbase/core/operations/management/search_index_drop.cxx +2 -2
  213. data/ext/couchbase/core/operations/management/search_index_get.cxx +2 -2
  214. data/ext/couchbase/core/operations/management/search_index_get_documents_count.cxx +3 -2
  215. data/ext/couchbase/core/operations/management/search_index_get_stats.cxx +3 -1
  216. data/ext/couchbase/core/operations/management/search_index_upsert.cxx +2 -2
  217. data/ext/couchbase/core/operations/management/user_drop.cxx +3 -1
  218. data/ext/couchbase/core/operations/management/user_get.cxx +3 -1
  219. data/ext/couchbase/core/operations/management/user_upsert.cxx +12 -9
  220. data/ext/couchbase/core/operations/management/view_index_drop.cxx +1 -1
  221. data/ext/couchbase/core/operations/management/view_index_get.cxx +1 -1
  222. data/ext/couchbase/core/operations/management/view_index_upsert.cxx +1 -1
  223. data/ext/couchbase/core/operations/operation_traits.hxx +18 -0
  224. data/ext/couchbase/core/operations/query_response_parsing.cxx +211 -0
  225. data/ext/couchbase/core/operations/query_response_parsing.hxx +60 -0
  226. data/ext/couchbase/core/operations_fwd.hxx +3 -3
  227. data/ext/couchbase/core/origin.cxx +54 -26
  228. data/ext/couchbase/core/origin.hxx +12 -0
  229. data/ext/couchbase/core/orphan_reporter.cxx +2 -1
  230. data/ext/couchbase/core/platform/random.cc +7 -7
  231. data/ext/couchbase/core/protocol/client_request.cxx +2 -2
  232. data/ext/couchbase/core/protocol/client_request.hxx +38 -21
  233. data/ext/couchbase/core/protocol/client_response.cxx +11 -3
  234. data/ext/couchbase/core/protocol/client_response.hxx +27 -6
  235. data/ext/couchbase/core/protocol/cmd_append.cxx +2 -2
  236. data/ext/couchbase/core/protocol/cmd_cluster_map_change_notification.cxx +2 -2
  237. data/ext/couchbase/core/protocol/cmd_decrement.cxx +6 -6
  238. data/ext/couchbase/core/protocol/cmd_get.cxx +1 -1
  239. data/ext/couchbase/core/protocol/cmd_get_and_lock.cxx +2 -2
  240. data/ext/couchbase/core/protocol/cmd_get_and_touch.cxx +2 -2
  241. data/ext/couchbase/core/protocol/cmd_get_cluster_config.cxx +6 -4
  242. data/ext/couchbase/core/protocol/cmd_get_collection_id.cxx +2 -2
  243. data/ext/couchbase/core/protocol/cmd_get_error_map.cxx +1 -1
  244. data/ext/couchbase/core/protocol/cmd_get_meta.cxx +4 -4
  245. data/ext/couchbase/core/protocol/cmd_get_replica.cxx +1 -1
  246. data/ext/couchbase/core/protocol/cmd_hello.cxx +1 -1
  247. data/ext/couchbase/core/protocol/cmd_increment.cxx +6 -6
  248. data/ext/couchbase/core/protocol/cmd_insert.cxx +4 -4
  249. data/ext/couchbase/core/protocol/cmd_lookup_in.cxx +4 -3
  250. data/ext/couchbase/core/protocol/cmd_lookup_in_replica.cxx +4 -3
  251. data/ext/couchbase/core/protocol/cmd_mutate_in.cxx +10 -9
  252. data/ext/couchbase/core/protocol/cmd_mutate_in.hxx +10 -10
  253. data/ext/couchbase/core/protocol/cmd_observe_seqno.cxx +7 -7
  254. data/ext/couchbase/core/protocol/cmd_prepend.cxx +2 -2
  255. data/ext/couchbase/core/protocol/cmd_remove.cxx +2 -2
  256. data/ext/couchbase/core/protocol/cmd_replace.cxx +4 -4
  257. data/ext/couchbase/core/protocol/cmd_touch.cxx +1 -1
  258. data/ext/couchbase/core/protocol/cmd_upsert.cxx +4 -4
  259. data/ext/couchbase/core/protocol/datatype.hxx +118 -1
  260. data/ext/couchbase/core/protocol/frame_info_utils.cxx +1 -1
  261. data/ext/couchbase/core/protocol/magic.hxx +4 -0
  262. data/ext/couchbase/core/protocol/magic_fmt.hxx +3 -0
  263. data/ext/couchbase/core/protocol/server_request.hxx +3 -1
  264. data/ext/couchbase/core/protocol/status.cxx +1 -1
  265. data/ext/couchbase/core/protostellar/analytics_converter.hxx +171 -0
  266. data/ext/couchbase/core/protostellar/bucket_admin_converter.hxx +301 -0
  267. data/ext/couchbase/core/protostellar/collection_admin_converter.hxx +92 -0
  268. data/ext/couchbase/core/protostellar/component.cxx +2445 -0
  269. data/ext/couchbase/core/protostellar/component.hxx +391 -0
  270. data/ext/couchbase/core/{columnar/bootstrap_notification_subscriber.hxx → protostellar/compression_settings.hxx} +11 -10
  271. data/ext/couchbase/core/protostellar/credentials.cxx +233 -0
  272. data/ext/couchbase/core/protostellar/credentials.hxx +88 -0
  273. data/ext/couchbase/core/protostellar/dispatcher.cxx +57 -0
  274. data/ext/couchbase/core/protostellar/dispatcher.hxx +482 -0
  275. data/ext/couchbase/core/protostellar/error_utils.cxx +293 -0
  276. data/ext/couchbase/core/protostellar/error_utils.hxx +97 -0
  277. data/ext/couchbase/core/protostellar/json_payload.hxx +49 -0
  278. data/ext/couchbase/core/protostellar/kv_converter.cxx +70 -0
  279. data/ext/couchbase/core/protostellar/kv_converter.hxx +600 -0
  280. data/ext/couchbase/core/protostellar/query_converter.hxx +265 -0
  281. data/ext/couchbase/core/protostellar/query_index_admin_converter.hxx +291 -0
  282. data/ext/couchbase/core/protostellar/query_proto.hxx +73 -0
  283. data/ext/couchbase/core/protostellar/search_converter.hxx +244 -0
  284. data/ext/couchbase/core/protostellar/search_index_admin_converter.hxx +156 -0
  285. data/ext/couchbase/core/protostellar/view_converter.hxx +158 -0
  286. data/ext/couchbase/core/query_stream.cxx +447 -0
  287. data/ext/couchbase/core/query_stream.hxx +141 -0
  288. data/ext/couchbase/core/query_stream_component.cxx +243 -0
  289. data/ext/couchbase/core/query_stream_component.hxx +68 -0
  290. data/ext/couchbase/core/range_scan_load_balancer.cxx +15 -8
  291. data/ext/couchbase/core/range_scan_orchestrator.cxx +15 -3
  292. data/ext/couchbase/core/response_handler.hxx +41 -4
  293. data/ext/couchbase/core/row_streamer.cxx +332 -46
  294. data/ext/couchbase/core/row_streamer.hxx +31 -1
  295. data/ext/couchbase/core/row_streamer_options.hxx +55 -0
  296. data/ext/couchbase/core/sasl/client.h +3 -0
  297. data/ext/couchbase/core/search_scoring.hxx +66 -0
  298. data/ext/couchbase/core/stream_error_details.hxx +69 -0
  299. data/ext/couchbase/core/timeout_defaults.hxx +0 -1
  300. data/ext/couchbase/core/topology/capabilities.hxx +6 -0
  301. data/ext/couchbase/core/topology/capabilities_fmt.hxx +3 -0
  302. data/ext/couchbase/core/topology/configuration.cxx +21 -6
  303. data/ext/couchbase/core/topology/configuration.hxx +29 -8
  304. data/ext/couchbase/core/topology/configuration_json.hxx +3 -0
  305. data/ext/couchbase/core/topology/error_map_json.hxx +3 -1
  306. data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +70 -4
  307. data/ext/couchbase/core/tracing/threshold_logging_tracer.hxx +10 -0
  308. data/ext/couchbase/core/transactions/active_transaction_record.cxx +0 -34
  309. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +362 -241
  310. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +24 -3
  311. data/ext/couchbase/core/transactions/error_list.hxx +2 -2
  312. data/ext/couchbase/core/transactions/get_multi_fetch.hxx +160 -0
  313. data/ext/couchbase/core/transactions/get_multi_orchestrator.cxx +326 -125
  314. data/ext/couchbase/core/transactions/get_multi_transaction_id.hxx +62 -0
  315. data/ext/couchbase/core/transactions/internal/atr_entry.hxx +22 -2
  316. data/ext/couchbase/core/transactions/internal/transaction_context.hxx +2 -2
  317. data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +23 -1
  318. data/ext/couchbase/core/transactions/internal/utils.hxx +50 -14
  319. data/ext/couchbase/core/transactions/staged_mutation.cxx +23 -18
  320. data/ext/couchbase/core/transactions/staged_mutation.hxx +15 -4
  321. data/ext/couchbase/core/transactions/transaction_context.cxx +55 -40
  322. data/ext/couchbase/core/transactions/transaction_get_result.hxx +16 -0
  323. data/ext/couchbase/core/transactions/transactions.cxx +3 -55
  324. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +194 -66
  325. data/ext/couchbase/core/transactions/transactions_config.cxx +0 -11
  326. data/ext/couchbase/core/transactions/utils.cxx +10 -0
  327. data/ext/couchbase/core/transactions/waitable_op_list.hxx +15 -4
  328. data/ext/couchbase/core/transactions.hxx +9 -9
  329. data/ext/couchbase/core/utils/byteswap.hxx +166 -9
  330. data/ext/couchbase/core/utils/connection_string.cxx +50 -85
  331. data/ext/couchbase/core/utils/connection_string.hxx +15 -0
  332. data/ext/couchbase/core/{columnar/backoff_calculator.hxx → utils/deadline.hxx} +13 -13
  333. data/ext/couchbase/core/utils/duration_parser.cxx +1 -1
  334. data/ext/couchbase/core/utils/json_streaming_lexer.cxx +48 -5
  335. data/ext/couchbase/core/utils/json_streaming_lexer.hxx +4 -1
  336. data/ext/couchbase/core/utils/movable_function.hxx +301 -52
  337. data/ext/couchbase/core/utils/name_codec.hxx +154 -11
  338. data/ext/couchbase/core/{columnar/retry_info.hxx → utils/process_id.hxx} +18 -13
  339. data/ext/couchbase/core/utils/url_codec.cxx +12 -51
  340. data/ext/couchbase/core/websocket_codec.cxx +3 -29
  341. data/ext/couchbase/couchbase/analytics_options.hxx +21 -10
  342. data/ext/couchbase/couchbase/analytics_row.hxx +105 -0
  343. data/ext/couchbase/couchbase/analytics_stream_result.hxx +266 -0
  344. data/ext/couchbase/couchbase/boolean_query.hxx +3 -3
  345. data/ext/couchbase/couchbase/bucket.hxx +57 -0
  346. data/ext/couchbase/couchbase/cluster.hxx +216 -5
  347. data/ext/couchbase/{core/columnar/security_options.hxx → couchbase/cluster_state.hxx} +18 -14
  348. data/ext/couchbase/couchbase/codec/lenient_json_transcoder.hxx +69 -0
  349. data/ext/couchbase/couchbase/collection.hxx +234 -14
  350. data/ext/couchbase/couchbase/common_durability_options.hxx +18 -3
  351. data/ext/couchbase/couchbase/conjunction_query.hxx +1 -1
  352. data/ext/couchbase/couchbase/create_dataset_analytics_options.hxx +6 -1
  353. data/ext/couchbase/couchbase/date_range_query.hxx +2 -2
  354. data/ext/couchbase/couchbase/decrement_options.hxx +1 -1
  355. data/ext/couchbase/couchbase/disjunction_query.hxx +1 -1
  356. data/ext/couchbase/couchbase/error.hxx +32 -0
  357. data/ext/couchbase/couchbase/error_codes.hxx +32 -0
  358. data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +1 -1
  359. data/ext/couchbase/couchbase/geo_distance_query.hxx +1 -1
  360. data/ext/couchbase/couchbase/geo_polygon_query.hxx +1 -1
  361. data/ext/couchbase/couchbase/get_replica_options.hxx +68 -0
  362. data/ext/couchbase/couchbase/get_replica_result.hxx +5 -3
  363. data/ext/couchbase/couchbase/get_replica_strategy.hxx +161 -0
  364. data/ext/couchbase/couchbase/get_result.hxx +1 -0
  365. data/ext/couchbase/couchbase/increment_options.hxx +1 -1
  366. data/ext/couchbase/couchbase/insert_options.hxx +1 -1
  367. data/ext/couchbase/couchbase/match_phrase_query.hxx +1 -1
  368. data/ext/couchbase/couchbase/match_query.hxx +1 -1
  369. data/ext/couchbase/couchbase/mutate_in_options.hxx +3 -3
  370. data/ext/couchbase/couchbase/network_options.hxx +1 -1
  371. data/ext/couchbase/couchbase/node_id.hxx +42 -14
  372. data/ext/couchbase/couchbase/node_id_for_options.hxx +7 -1
  373. data/ext/couchbase/couchbase/node_ids_options.hxx +8 -2
  374. data/ext/couchbase/couchbase/numeric_range_query.hxx +1 -1
  375. data/ext/couchbase/couchbase/phrase_query.hxx +1 -1
  376. data/ext/couchbase/couchbase/prefix_query.hxx +1 -1
  377. data/ext/couchbase/couchbase/query_options.hxx +23 -12
  378. data/ext/couchbase/couchbase/query_row.hxx +111 -0
  379. data/ext/couchbase/couchbase/query_stream_result.hxx +302 -0
  380. data/ext/couchbase/couchbase/query_string_query.hxx +3 -3
  381. data/ext/couchbase/couchbase/regexp_query.hxx +1 -1
  382. data/ext/couchbase/couchbase/replace_options.hxx +3 -3
  383. data/ext/couchbase/couchbase/result.hxx +14 -3
  384. data/ext/couchbase/couchbase/scan_result_item.hxx +1 -0
  385. data/ext/couchbase/couchbase/scope.hxx +85 -2
  386. data/ext/couchbase/couchbase/search_options.hxx +58 -8
  387. data/ext/couchbase/couchbase/search_scoring.hxx +94 -0
  388. data/ext/couchbase/couchbase/search_scoring_none.hxx +51 -0
  389. data/ext/couchbase/couchbase/search_scoring_reciprocal_rank_fusion.hxx +88 -0
  390. data/ext/couchbase/couchbase/search_scoring_relative_score_fusion.hxx +70 -0
  391. data/ext/couchbase/couchbase/term_range_query.hxx +1 -1
  392. data/ext/couchbase/couchbase/tracing/request_span.hxx +46 -0
  393. data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_result.hxx +23 -21
  394. data/ext/couchbase/couchbase/transactions/transaction_get_multi_result.hxx +24 -19
  395. data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +17 -3
  396. data/ext/couchbase/couchbase/transactions/transactions_config.hxx +4 -2
  397. data/ext/couchbase/couchbase/transactions.hxx +27 -18
  398. data/ext/couchbase/couchbase/upsert_options.hxx +3 -3
  399. data/ext/couchbase/couchbase/vector_query.hxx +1 -1
  400. data/ext/couchbase/couchbase/wait_until_ready_options.hxx +111 -0
  401. data/ext/couchbase/couchbase/wildcard_query.hxx +1 -1
  402. data/ext/extconf.rb +15 -10
  403. data/ext/rcb_analytics.cxx +82 -102
  404. data/ext/rcb_backend.cxx +42 -36
  405. data/ext/rcb_backend.hxx +2 -0
  406. data/ext/rcb_buckets.cxx +47 -59
  407. data/ext/rcb_collections.cxx +42 -52
  408. data/ext/rcb_crud.cxx +345 -224
  409. data/ext/rcb_diagnostics.cxx +117 -27
  410. data/ext/rcb_exceptions.cxx +152 -99
  411. data/ext/rcb_exceptions.hxx +25 -0
  412. data/ext/rcb_extras.cxx +18 -19
  413. data/ext/rcb_hdr_histogram.cxx +19 -4
  414. data/ext/rcb_logger.cxx +202 -27
  415. data/ext/rcb_logger.hxx +12 -0
  416. data/ext/rcb_multi.cxx +40 -40
  417. data/ext/rcb_observability.cxx +7 -5
  418. data/ext/rcb_query.cxx +99 -142
  419. data/ext/rcb_range_scan.cxx +41 -35
  420. data/ext/rcb_search.cxx +98 -99
  421. data/ext/rcb_users.cxx +36 -56
  422. data/ext/rcb_utils.cxx +100 -37
  423. data/ext/rcb_utils.hxx +287 -33
  424. data/ext/rcb_version.cxx +1 -1
  425. data/ext/rcb_views.cxx +55 -51
  426. data/lib/active_support/cache/couchbase_store.rb +77 -12
  427. data/lib/couchbase/bucket.rb +20 -0
  428. data/lib/couchbase/cluster.rb +33 -14
  429. data/lib/couchbase/collection.rb +36 -1
  430. data/lib/couchbase/errors.rb +18 -0
  431. data/lib/couchbase/fork_hooks.rb +16 -7
  432. data/lib/couchbase/get_replica_strategy.rb +89 -0
  433. data/lib/couchbase/logger.rb +1 -1
  434. data/lib/couchbase/management/analytics_index_manager.rb +15 -15
  435. data/lib/couchbase/management/bucket_manager.rb +6 -6
  436. data/lib/couchbase/management/collection_manager.rb +6 -6
  437. data/lib/couchbase/management/query_index_manager.rb +7 -7
  438. data/lib/couchbase/management/search_index_manager.rb +13 -13
  439. data/lib/couchbase/management/user_manager.rb +10 -10
  440. data/lib/couchbase/management/view_index_manager.rb +5 -5
  441. data/lib/couchbase/options.rb +181 -44
  442. data/lib/couchbase/protostellar/bucket.rb +4 -0
  443. data/lib/couchbase/protostellar/cluster.rb +4 -0
  444. data/lib/couchbase/protostellar/collection.rb +4 -0
  445. data/lib/couchbase/protostellar/error_handling.rb +2 -1
  446. data/lib/couchbase/protostellar/request.rb +1 -0
  447. data/lib/couchbase/protostellar/request_generator/kv.rb +16 -2
  448. data/lib/couchbase/protostellar/request_generator/search.rb +17 -1
  449. data/lib/couchbase/protostellar/retry/orchestrator.rb +3 -2
  450. data/lib/couchbase/protostellar/retry/strategies/fail_fast.rb +33 -0
  451. data/lib/couchbase/protostellar/retry/strategies.rb +1 -0
  452. data/lib/couchbase/search_options.rb +95 -6
  453. data/lib/couchbase/version.rb +1 -1
  454. metadata +92 -33
  455. data/ext/0001-fix-build-for-mingw-w64-ucrt-x86_64-toolchain.patch +0 -40
  456. data/ext/couchbase/core/columnar/agent.hxx +0 -71
  457. data/ext/couchbase/core/columnar/agent_config.hxx +0 -59
  458. data/ext/couchbase/core/columnar/background_bootstrap_listener.hxx +0 -42
  459. data/ext/couchbase/core/columnar/backoff_calculator.cxx +0 -62
  460. data/ext/couchbase/core/columnar/columnar_agent.cxx +0 -147
  461. data/ext/couchbase/core/columnar/columnar_agent_config.cxx +0 -48
  462. data/ext/couchbase/core/columnar/columnar_error.cxx +0 -51
  463. data/ext/couchbase/core/columnar/database_management_options.hxx +0 -56
  464. data/ext/couchbase/core/columnar/error.hxx +0 -51
  465. data/ext/couchbase/core/columnar/error_codes.cxx +0 -107
  466. data/ext/couchbase/core/columnar/error_codes.hxx +0 -75
  467. data/ext/couchbase/core/columnar/management_component.cxx +0 -300
  468. data/ext/couchbase/core/columnar/management_component.hxx +0 -56
  469. data/ext/couchbase/core/columnar/query_component.cxx +0 -523
  470. data/ext/couchbase/core/columnar/query_component.hxx +0 -57
  471. data/ext/couchbase/core/columnar/query_options.hxx +0 -59
  472. data/ext/couchbase/core/columnar/query_result.cxx +0 -130
  473. data/ext/couchbase/core/columnar/query_result.hxx +0 -78
  474. data/ext/couchbase/core/io/config_tracker.cxx +0 -687
  475. data/ext/couchbase/core/io/config_tracker.hxx +0 -123
@@ -28,6 +28,8 @@
28
28
  #include <couchbase/get_and_touch_options.hxx>
29
29
  #include <couchbase/get_any_replica_options.hxx>
30
30
  #include <couchbase/get_options.hxx>
31
+ #include <couchbase/get_replica_options.hxx>
32
+ #include <couchbase/get_replica_strategy.hxx>
31
33
  #include <couchbase/insert_options.hxx>
32
34
  #include <couchbase/lookup_in_all_replicas_options.hxx>
33
35
  #include <couchbase/lookup_in_any_replica_options.hxx>
@@ -340,8 +342,13 @@ public:
340
342
  * @exception errc::common::ambiguous_timeout
341
343
  * @exception errc::common::unambiguous_timeout
342
344
  *
345
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
346
+ * @ref errc::common::feature_not_available for replica reads.
347
+ *
343
348
  * @since 1.0.0
344
349
  * @committed
350
+ * @cng_since{1.4.0}
351
+ * @cng_uncommitted
345
352
  */
346
353
  void get_any_replica(std::string document_id,
347
354
  const get_any_replica_options& options,
@@ -368,19 +375,98 @@ public:
368
375
  * @exception errc::common::ambiguous_timeout
369
376
  * @exception errc::common::unambiguous_timeout
370
377
  *
378
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
379
+ * @ref errc::common::feature_not_available for replica reads.
380
+ *
371
381
  * @since 1.0.0
372
382
  * @committed
383
+ * @cng_since{1.4.0}
384
+ * @cng_uncommitted
373
385
  */
374
386
  [[nodiscard]] auto get_any_replica(std::string document_id,
375
387
  const get_any_replica_options& options = {}) const
376
388
  -> std::future<std::pair<error, get_replica_result>>;
377
389
 
390
+ /**
391
+ * Reads from the replica the strategy selects.
392
+ *
393
+ * @param document_id the document id which is used to uniquely identify it.
394
+ * @param strategy selects the replica to read from
395
+ * @param options the custom options
396
+ * @param handler the handler that implements @ref get_replica_handler
397
+ *
398
+ * @exception errc::key_value::document_not_found_on_replica
399
+ * the replica responded, but does not hold the document. The @ref error::cause() is
400
+ * @ref errc::key_value::document_not_found.
401
+ *
402
+ * @exception errc::key_value::replica_index_out_of_bounds
403
+ * the requested index is at or beyond the bucket's configured replica count, or that count is
404
+ * zero. Reported without a network round trip.
405
+ *
406
+ * @exception errc::key_value::replica_index_currently_unavailable
407
+ * the index exists for this bucket, but the copy cannot be read now: the vbucket map's row is
408
+ * shorter than the configured count, or it does not place that replica on a node the topology
409
+ * lists.
410
+ *
411
+ * @exception errc::common::unambiguous_timeout
412
+ *
413
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
414
+ * @ref errc::common::feature_not_available for replica reads.
415
+ *
416
+ * @since 1.5.0
417
+ * @committed
418
+ */
419
+ void get_replica(std::string document_id,
420
+ const get_replica_strategy& strategy,
421
+ const get_replica_options& options,
422
+ get_replica_handler&& handler) const;
423
+
424
+ /**
425
+ * Reads from the replica the strategy selects.
426
+ *
427
+ * @snippet{trimleft} test_integration_read_replica.cxx get_replica-from_index
428
+ *
429
+ * @param document_id the document id which is used to uniquely identify it.
430
+ * @param strategy selects the replica to read from
431
+ * @param options the custom options
432
+ * @return the future object with the result of the selected replica.
433
+ *
434
+ * @exception errc::key_value::document_not_found_on_replica
435
+ * the replica responded, but does not hold the document. The @ref error::cause() is
436
+ * @ref errc::key_value::document_not_found.
437
+ *
438
+ * @exception errc::key_value::replica_index_out_of_bounds
439
+ * the requested index is at or beyond the bucket's configured replica count, or that count is
440
+ * zero. Reported without a network round trip.
441
+ *
442
+ * @exception errc::key_value::replica_index_currently_unavailable
443
+ * the index exists for this bucket, but the copy cannot be read now: the vbucket map's row is
444
+ * shorter than the configured count, or it does not place that replica on a node the topology
445
+ * lists.
446
+ *
447
+ * @exception errc::common::unambiguous_timeout
448
+ *
449
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
450
+ * @ref errc::common::feature_not_available for replica reads.
451
+ *
452
+ * @since 1.5.0
453
+ * @committed
454
+ */
455
+ [[nodiscard]] auto get_replica(std::string document_id,
456
+ const get_replica_strategy& strategy,
457
+ const get_replica_options& options = {}) const
458
+ -> std::future<std::pair<error, get_replica_result>>;
459
+
378
460
  /**
379
461
  * Reads from all available replicas and the active node and returns the results as a vector.
380
462
  *
381
463
  * @note Individual errors are ignored, so you can think of this API as a best effort
382
464
  * approach which explicitly emphasises availability over consistency.
383
465
  *
466
+ * @note Entries appear in response-arrival order, not vBucket map order.
467
+ * Use @c get_replica_result::is_replica() to distinguish the active node's
468
+ * entry; do not rely on positional indexing to identify it.
469
+ *
384
470
  * @param document_id the document id which is used to uniquely identify it.
385
471
  * @param options the custom options
386
472
  * @param handler the handler that implements @ref get_all_replicas_handler
@@ -388,8 +474,13 @@ public:
388
474
  * @exception errc::common::ambiguous_timeout
389
475
  * @exception errc::common::unambiguous_timeout
390
476
  *
477
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
478
+ * @ref errc::common::feature_not_available for replica reads.
479
+ *
391
480
  * @since 1.0.0
392
481
  * @committed
482
+ * @cng_since{1.4.0}
483
+ * @cng_uncommitted
393
484
  */
394
485
  void get_all_replicas(std::string document_id,
395
486
  const get_all_replicas_options& options,
@@ -401,6 +492,10 @@ public:
401
492
  * @note Individual errors are ignored, so you can think of this API as a best effort
402
493
  * approach which explicitly emphasises availability over consistency.
403
494
  *
495
+ * @note Entries appear in response-arrival order, not vBucket map order.
496
+ * Use @c get_replica_result::is_replica() to distinguish the active node's
497
+ * entry; do not rely on positional indexing to identify it.
498
+ *
404
499
  * Select preferred server group in connection options:
405
500
  * @snippet{trimleft} test_integration_read_replica.cxx select-preferred_server_group
406
501
  *
@@ -415,8 +510,13 @@ public:
415
510
  * @exception errc::common::ambiguous_timeout
416
511
  * @exception errc::common::unambiguous_timeout
417
512
  *
513
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
514
+ * @ref errc::common::feature_not_available for replica reads.
515
+ *
418
516
  * @since 1.0.0
419
517
  * @committed
518
+ * @cng_since{1.4.0}
519
+ * @cng_uncommitted
420
520
  */
421
521
  [[nodiscard]] auto get_all_replicas(std::string document_id,
422
522
  const get_all_replicas_options& options = {}) const
@@ -784,8 +884,13 @@ public:
784
884
  * @exception errc::common::ambiguous_timeout
785
885
  * @exception errc::common::unambiguous_timeout
786
886
  *
887
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
888
+ * @ref errc::common::feature_not_available for subdocument mutations.
889
+ *
787
890
  * @since 1.0.0
788
891
  * @committed
892
+ * @cng_since{1.4.0}
893
+ * @cng_uncommitted
789
894
  */
790
895
  void mutate_in(std::string document_id,
791
896
  const mutate_in_specs& specs,
@@ -809,8 +914,13 @@ public:
809
914
  * @exception errc::common::ambiguous_timeout
810
915
  * @exception errc::common::unambiguous_timeout
811
916
  *
917
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
918
+ * @ref errc::common::feature_not_available for subdocument mutations.
919
+ *
812
920
  * @since 1.0.0
813
921
  * @committed
922
+ * @cng_since{1.4.0}
923
+ * @cng_uncommitted
814
924
  */
815
925
  [[nodiscard]] auto mutate_in(std::string document_id,
816
926
  const mutate_in_specs& specs,
@@ -830,8 +940,13 @@ public:
830
940
  * @exception errc::common::ambiguous_timeout
831
941
  * @exception errc::common::unambiguous_timeout
832
942
  *
943
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
944
+ * @ref errc::common::feature_not_available for subdocument lookups.
945
+ *
833
946
  * @since 1.0.0
834
947
  * @committed
948
+ * @cng_since{1.4.0}
949
+ * @cng_uncommitted
835
950
  */
836
951
  void lookup_in(std::string document_id,
837
952
  const lookup_in_specs& specs,
@@ -851,8 +966,13 @@ public:
851
966
  * @exception errc::common::ambiguous_timeout
852
967
  * @exception errc::common::unambiguous_timeout
853
968
  *
969
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
970
+ * @ref errc::common::feature_not_available for subdocument lookups.
971
+ *
854
972
  * @since 1.0.0
855
973
  * @committed
974
+ * @cng_since{1.4.0}
975
+ * @cng_uncommitted
856
976
  */
857
977
  [[nodiscard]] auto lookup_in(std::string document_id,
858
978
  const lookup_in_specs& specs,
@@ -863,6 +983,10 @@ public:
863
983
  * Performs lookups to document fragments with default options from all replicas and the active
864
984
  * node and returns the result as a vector.
865
985
  *
986
+ * @note Entries appear in response-arrival order, not vBucket map order.
987
+ * Use @c lookup_in_replica_result::is_replica() to distinguish the active
988
+ * node's entry; do not rely on positional indexing to identify it.
989
+ *
866
990
  * @param document_id the outer document ID
867
991
  * @param specs an object that specifies the types of lookups to perform
868
992
  * @param options custom options to modify the lookup options
@@ -873,8 +997,13 @@ public:
873
997
  * @exception errc::common::ambiguous_timeout
874
998
  * @exception errc::common::unambiguous_timeout
875
999
  *
1000
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
1001
+ * @ref errc::common::feature_not_available for replica lookups.
1002
+ *
876
1003
  * @since 1.0.0
877
1004
  * @committed
1005
+ * @cng_since{1.4.0}
1006
+ * @cng_uncommitted
878
1007
  */
879
1008
  void lookup_in_all_replicas(std::string document_id,
880
1009
  const lookup_in_specs& specs,
@@ -885,6 +1014,10 @@ public:
885
1014
  * Performs lookups to document fragments with default options from all replicas and the active
886
1015
  * node and returns the result as a vector.
887
1016
  *
1017
+ * @note Entries appear in response-arrival order, not vBucket map order.
1018
+ * Use @c lookup_in_replica_result::is_replica() to distinguish the active
1019
+ * node's entry; do not rely on positional indexing to identify it.
1020
+ *
888
1021
  * @param document_id the outer document ID
889
1022
  * @param specs an object that specifies the types of lookups to perform
890
1023
  * @param options custom options to modify the lookup options
@@ -895,8 +1028,13 @@ public:
895
1028
  * @exception errc::common::ambiguous_timeout
896
1029
  * @exception errc::common::unambiguous_timeout
897
1030
  *
1031
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
1032
+ * @ref errc::common::feature_not_available for replica lookups.
1033
+ *
898
1034
  * @since 1.0.0
899
1035
  * @committed
1036
+ * @cng_since{1.4.0}
1037
+ * @cng_uncommitted
900
1038
  */
901
1039
  [[nodiscard]] auto lookup_in_all_replicas(std::string document_id,
902
1040
  const lookup_in_specs& specs,
@@ -917,8 +1055,13 @@ public:
917
1055
  * @exception errc::common::ambiguous_timeout
918
1056
  * @exception errc::common::unambiguous_timeout
919
1057
  *
1058
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
1059
+ * @ref errc::common::feature_not_available for replica lookups.
1060
+ *
920
1061
  * @since 1.0.0
921
1062
  * @committed
1063
+ * @cng_since{1.4.0}
1064
+ * @cng_uncommitted
922
1065
  */
923
1066
  void lookup_in_any_replica(std::string document_id,
924
1067
  const lookup_in_specs& specs,
@@ -939,8 +1082,13 @@ public:
939
1082
  * @exception errc::common::ambiguous_timeout
940
1083
  * @exception errc::common::unambiguous_timeout
941
1084
  *
1085
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, which reports
1086
+ * @ref errc::common::feature_not_available for replica lookups.
1087
+ *
942
1088
  * @since 1.0.0
943
1089
  * @committed
1090
+ * @cng_since{1.4.0}
1091
+ * @cng_uncommitted
944
1092
  */
945
1093
  [[nodiscard]] auto lookup_in_any_replica(std::string document_id,
946
1094
  const lookup_in_specs& specs,
@@ -1069,8 +1217,15 @@ public:
1069
1217
  * system may have to scan a lot of documents to find the matching documents. For low latency
1070
1218
  * range queries, it is recommended that you use SQL++ with the necessary indexes.
1071
1219
  *
1220
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, and not refused up front: the
1221
+ * scan needs the bucket configuration and the per-node connections that transport does not open,
1222
+ * so it fails on that path rather than reporting
1223
+ * @ref errc::common::feature_not_available.
1224
+ *
1072
1225
  * @since 1.0.0
1073
1226
  * @volatile
1227
+ * @cng_since{1.4.0}
1228
+ * @cng_uncommitted
1074
1229
  */
1075
1230
  void scan(const scan_type& scan_type, const scan_options& options, scan_handler&& handler) const;
1076
1231
 
@@ -1086,8 +1241,15 @@ public:
1086
1241
  * system may have to scan a lot of documents to find the matching documents. For low latency
1087
1242
  * range queries, it is recommended that you use SQL++ with the necessary indexes.
1088
1243
  *
1244
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, and not refused up front: the
1245
+ * scan needs the bucket configuration and the per-node connections that transport does not open,
1246
+ * so it fails on that path rather than reporting
1247
+ * @ref errc::common::feature_not_available.
1248
+ *
1089
1249
  * @since 1.0.0
1090
1250
  * @volatile
1251
+ * @cng_since{1.4.0}
1252
+ * @cng_uncommitted
1091
1253
  */
1092
1254
  [[nodiscard]] auto scan(const scan_type& scan_type, const scan_options& options = {}) const
1093
1255
  -> std::future<std::pair<error, scan_result>>;
@@ -1096,10 +1258,29 @@ public:
1096
1258
  * Resolves a document key to the identity of the cluster node that currently
1097
1259
  * owns it, using the client-side vBucket map (no network round-trip).
1098
1260
  *
1261
+ * The handler is guaranteed to be invoked exactly once even if no bucket
1262
+ * configuration ever arrives — the request timeout drives a fall-through to
1263
+ * @c errc::common::unambiguous_timeout. On success the @c node_id is
1264
+ * truthy and byte-for-byte equal to the @c node_id surfaced on results and
1265
+ * errors of KV operations against the same key for the current topology.
1266
+ *
1267
+ * @note The returned identity reflects the topology snapshot at call
1268
+ * time. During a rebalance, the @c node_id returned here may transiently
1269
+ * not appear in a subsequent call to @ref node_ids (and vice versa); the
1270
+ * two APIs are consistent only against a stable topology.
1271
+ *
1099
1272
  * @param document_id the document id to resolve
1100
- * @param options options to customize the request
1273
+ * @param options options to customize the request (e.g. timeout)
1101
1274
  * @param handler the handler that receives the result
1102
1275
  *
1276
+ * @exception errc::common::invalid_argument if @p document_id is empty.
1277
+ * @exception errc::common::bucket_not_found if the bucket does not exist.
1278
+ * @exception errc::network::configuration_not_available if the bucket
1279
+ * configuration is present but the vBucket map does not resolve
1280
+ * the key to a known node.
1281
+ * @exception errc::common::unambiguous_timeout if the bucket configuration
1282
+ * did not arrive within the request timeout.
1283
+ *
1103
1284
  * @since 1.3.2
1104
1285
  * @uncommitted
1105
1286
  */
@@ -1115,6 +1296,14 @@ public:
1115
1296
  * @param options options to customize the request
1116
1297
  * @return future carrying the error (if any) and node_id
1117
1298
  *
1299
+ * @exception errc::common::invalid_argument if @p document_id is empty.
1300
+ * @exception errc::common::bucket_not_found if the bucket does not exist.
1301
+ * @exception errc::network::configuration_not_available if the bucket
1302
+ * configuration is present but the vBucket map does not resolve
1303
+ * the key to a known node.
1304
+ * @exception errc::common::unambiguous_timeout if the bucket configuration
1305
+ * did not arrive within the request timeout.
1306
+ *
1118
1307
  * @since 1.3.2
1119
1308
  * @uncommitted
1120
1309
  */
@@ -1123,39 +1312,70 @@ public:
1123
1312
  -> std::future<std::pair<error, node_id>>;
1124
1313
 
1125
1314
  /**
1126
- * Returns the set of cluster nodes that currently serve key-value
1127
- * traffic for this collection's bucket, drawn from the client-side
1128
- * topology snapshot (no network round-trip).
1315
+ * Returns the cluster nodes that currently serve key-value traffic for
1316
+ * this collection's bucket, drawn from the client-side topology snapshot
1317
+ * (no network round-trip).
1129
1318
  *
1130
1319
  * Each entry corresponds to one cluster node and is the same node_id
1131
1320
  * the SDK reports on KV results and errors that touched that node, so
1132
- * the returned set is directly comparable to the keys of any
1321
+ * the returned vector is directly comparable to the keys of any
1133
1322
  * application-side state that is keyed by node_id (e.g. a per-node
1134
1323
  * circuit breaker registry). A periodic sweep that diffs the
1135
1324
  * registry's keys against this set is the canonical way to retire
1136
1325
  * tracker state for a node that has been removed from the cluster
1137
1326
  * topology.
1138
1327
  *
1139
- * Nodes that do not expose a key-value port for the configured
1140
- * transport (TLS or plain) are excluded from the returned set, since
1141
- * they do not serve KV operations and therefore have no meaningful
1142
- * identity from the SDK's point of view.
1328
+ * Entries are returned in topology order; no deduplication is
1329
+ * performed (topology nodes are unique by construction). Callers that
1330
+ * want a set semantic can hash the entries themselves —
1331
+ * @c std::hash<couchbase::node_id> is specialised for this purpose.
1143
1332
  *
1144
- * @param options options to customize the request
1333
+ * Nodes that do not expose a key-value port for the configured
1334
+ * transport (TLS or plain) are excluded from the result, since they do
1335
+ * not serve KV operations and therefore have no meaningful identity
1336
+ * from the SDK's point of view.
1337
+ *
1338
+ * @note The returned vector is a snapshot of the topology at call time.
1339
+ * During a rebalance, a @c node_id previously returned by @ref
1340
+ * node_id_for may transiently not appear here (and vice versa); the
1341
+ * two APIs are consistent only against a stable topology. Application
1342
+ * sweep loops should tolerate transient differences (e.g. require a
1343
+ * node to be absent across two consecutive sweeps before retiring
1344
+ * tracker state) rather than acting on a single snapshot.
1345
+ *
1346
+ * @param options options to customize the request (e.g. timeout)
1145
1347
  * @param handler the handler that receives the result
1146
1348
  *
1349
+ * @exception errc::common::bucket_not_found if the bucket does not exist.
1350
+ * @exception errc::network::configuration_not_available if the bucket
1351
+ * configuration is absent or its set of KV-serving nodes is
1352
+ * momentarily empty (e.g. mid-rebalance).
1353
+ * @exception errc::common::unambiguous_timeout if the bucket
1354
+ * configuration did not arrive within the request timeout.
1355
+ *
1147
1356
  * @since 1.3.2
1148
1357
  * @uncommitted
1149
1358
  */
1150
1359
  void node_ids(const node_ids_options& options, node_ids_handler&& handler) const;
1151
1360
 
1152
1361
  /**
1153
- * Returns the set of cluster nodes that currently serve key-value
1154
- * traffic for this collection's bucket, drawn from the client-side
1155
- * topology snapshot (no network round-trip).
1362
+ * Returns the cluster nodes that currently serve key-value traffic for
1363
+ * this collection's bucket, drawn from the client-side topology snapshot
1364
+ * (no network round-trip).
1365
+ *
1366
+ * See the handler overload for the full contract, including topology-
1367
+ * snapshot semantics and the exception set.
1156
1368
  *
1157
1369
  * @param options options to customize the request
1158
- * @return future carrying the error (if any) and the set of node_ids
1370
+ * @return future carrying the error (if any) and the vector of
1371
+ * @c node_id entries in topology order
1372
+ *
1373
+ * @exception errc::common::bucket_not_found if the bucket does not exist.
1374
+ * @exception errc::network::configuration_not_available if the bucket
1375
+ * configuration is absent or its set of KV-serving nodes is
1376
+ * momentarily empty (e.g. mid-rebalance).
1377
+ * @exception errc::common::unambiguous_timeout if the bucket
1378
+ * configuration did not arrive within the request timeout.
1159
1379
  *
1160
1380
  * @since 1.3.2
1161
1381
  * @uncommitted
@@ -53,8 +53,8 @@ public:
53
53
  /**
54
54
  * Allows to customize the enhanced durability requirements for this operation.
55
55
  *
56
- * @note if a {@link #durability(persist_to, replicate_to)} has been set beforehand it will be set
57
- * back to {@link persist_to::none} and
56
+ * @note if a {@link #durability durability(persist_to, replicate_to)} has been set beforehand it
57
+ * will be set back to {@link persist_to::none} and
58
58
  * {@link replicate_to::none}, since it is not allowed to use both mechanisms at the same
59
59
  * time.</p>
60
60
  *
@@ -75,13 +75,28 @@ public:
75
75
  /**
76
76
  * Allows to customize the poll-based durability requirements for this operation.
77
77
  *
78
- * @note if a {@link #durability(durability_level)} has been set beforehand it will be set back to
78
+ * @note if a {@link #durability durability(durability_level)} has been set beforehand it will be
79
+ * set back to
79
80
  * {@link durability_level::none}, since it is not allowed to use both mechanisms at the same
80
81
  * time.
81
82
  *
83
+ * @note Not served over the @ref couchbase2 "couchbase2" transport, and not refused before the
84
+ * mutation is applied: observing persistence and replication needs per-node connections that
85
+ * transport does not open, so the mutation is sent to the gateway and applied and only the
86
+ * polling that follows fails. The document is already written when the error arrives, and that
87
+ * error comes from the failed poll rather than being
88
+ * @ref errc::common::feature_not_available. Level-based durability, set by
89
+ * @c durability(durability_level), is served normally and is the durability to use over that
90
+ * transport.
91
+ *
82
92
  * @param persist_to_nodes the durability persistence requirement.
83
93
  * @param replicate_to_nodes the durability replication requirement.
84
94
  * @return this options builder for chaining purposes.
95
+ *
96
+ * @since 1.0.0
97
+ * @committed
98
+ * @cng_since{1.4.0}
99
+ * @cng_uncommitted
85
100
  */
86
101
  auto durability(persist_to persist_to_nodes, replicate_to replicate_to_nodes) -> derived_class&
87
102
  {
@@ -32,7 +32,7 @@ namespace couchbase
32
32
  *
33
33
  * Match documents with `"location"` in the field `reviews.content` and `true` in the field
34
34
  * `free_breakfast`.
35
- * @snippet{trimleft} test_unit_search.cxx search-conjunction
35
+ * @snippet{trimleft} unit/management/search.cxx search-conjunction
36
36
  *
37
37
  * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-conjuncts-disjuncts.html
38
38
  * server documentation
@@ -49,7 +49,12 @@ public:
49
49
  /**
50
50
  * WHERE clause to use for creating the dataset
51
51
  *
52
- * @param condition
52
+ * The value is an arbitrary SQL++ predicate and is embedded in the generated statement verbatim.
53
+ * Unlike the dataverse, dataset and bucket names, it is not quoted or escaped, because there is
54
+ * no encoding that would leave a predicate meaningful. Pass only expressions the application
55
+ * itself controls; interpolating unvalidated input here allows arbitrary SQL++ to be injected.
56
+ *
57
+ * @param condition SQL++ predicate expression, e.g. `type = "airline"`
53
58
  * @return reference to this object, for use in chaining
54
59
  *
55
60
  * @since 1.0.0
@@ -34,10 +34,10 @@ namespace couchbase
34
34
  *
35
35
  * Match documents where field `review_date` falls within the range ("2001-10-09T10:20:30-08:00",
36
36
  * "2016-10-31")
37
- * @snippet{trimleft} test_unit_search.cxx search-date-range
37
+ * @snippet{trimleft} unit/management/search.cxx search-date-range
38
38
  *
39
39
  * It also works with `std::tm` and `std::chrono::system_clock::time_point`.
40
- * @snippet{trimleft} test_unit_search.cxx search-date-range-tm
40
+ * @snippet{trimleft} unit/management/search.cxx search-date-range-tm
41
41
  *
42
42
  * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-date-range.html server
43
43
  * documentation.
@@ -68,7 +68,7 @@ struct decrement_options : public common_durability_options<decrement_options> {
68
68
  * Sets the expiry for the document. By default the document will never expire.
69
69
  *
70
70
  * The duration must be less than 50 years. For expiry further in the future, use
71
- * {@link #expiry(std::chrono::system_clock::time_point)}.
71
+ * {@link #expiry expiry(std::chrono::system_clock::time_point)}.
72
72
  *
73
73
  * @param duration the duration after which the document will expire (zero duration means never
74
74
  * expire).
@@ -35,7 +35,7 @@ namespace couchbase
35
35
  * * `"location"` in the field `reviews.content`
36
36
  * * `true` in the field `free_breakfast`.
37
37
  *
38
- * @snippet{trimleft} test_unit_search.cxx search-disjunction
38
+ * @snippet{trimleft} unit/management/search.cxx search-disjunction
39
39
  *
40
40
  * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-conjuncts-disjuncts.html
41
41
  * server documentation
@@ -32,9 +32,41 @@ class error
32
32
  public:
33
33
  error() = default;
34
34
  error(std::error_code ec, std::string message = {}, error_context ctx = {});
35
+
36
+ /**
37
+ * Constructs an error that wraps another error as its underlying cause.
38
+ *
39
+ * @since 1.0.0
40
+ * @committed
41
+ */
35
42
  error(std::error_code ec, std::string message, error_context ctx, error cause);
43
+
44
+ /**
45
+ * Constructs an error carrying the identity of the cluster node that
46
+ * returned it. Used by the KV path to attach the @c node_id from the
47
+ * session that handled the request.
48
+ *
49
+ * @since 1.3.2
50
+ * @uncommitted
51
+ */
36
52
  error(std::error_code ec, std::string message, error_context ctx, couchbase::node_id node_id);
37
53
 
54
+ /**
55
+ * Constructs an error that both wraps an underlying cause and carries the
56
+ * identity of the cluster node where the failure originated. Used when a
57
+ * higher-level path (e.g. transactions) wraps a KV failure — without this
58
+ * overload the outer error would silently lose @c node_id() attribution
59
+ * even though the inner @c cause()->node_id() is populated.
60
+ *
61
+ * @since 1.3.2
62
+ * @uncommitted
63
+ */
64
+ error(std::error_code ec,
65
+ std::string message,
66
+ error_context ctx,
67
+ error cause,
68
+ couchbase::node_id node_id);
69
+
38
70
  [[nodiscard]] auto ec() const -> std::error_code;
39
71
  [[nodiscard]] auto message() const -> const std::string&;
40
72
  [[nodiscard]] auto ctx() const -> const error_context&;
@@ -646,6 +646,38 @@ enum class key_value {
646
646
  */
647
647
  // KV Code: 0xa7
648
648
  range_scan_completed = 134,
649
+
650
+ /**
651
+ * The document was not found on the replica that @ref collection#get_replica() read from. This is
652
+ * the code @ref error::ec() reports; a caller that wants to treat the general condition uniformly
653
+ * reads @ref error::cause(), which carries @ref errc::key_value::document_not_found.
654
+ *
655
+ * @since 1.5.0
656
+ * @committed
657
+ */
658
+ document_not_found_on_replica = 135,
659
+
660
+ /**
661
+ * The bucket has no replica at the requested index: the index is at or beyond its configured
662
+ * replica count, or that count is zero. Reported without a network round trip, and retrying
663
+ * cannot help. Use @ref get_replica_strategy_from_index_options::wrap() to read a different
664
+ * replica instead.
665
+ *
666
+ * @since 1.5.0
667
+ * @committed
668
+ */
669
+ replica_index_out_of_bounds = 136,
670
+
671
+ /**
672
+ * The replica exists for this bucket, but cannot be read now. Either the vbucket map's row for
673
+ * this document is shorter than the configured replica count, or it does not place that replica
674
+ * on a node the topology lists. A rebalance resolves both. Use
675
+ * @ref get_replica_strategy_from_index_options::wrap() to read another replica instead.
676
+ *
677
+ * @since 1.5.0
678
+ * @committed
679
+ */
680
+ replica_index_currently_unavailable = 137,
649
681
  };
650
682
 
651
683
  /**
@@ -35,7 +35,7 @@ namespace couchbase
35
35
  * identical to the initial, thus explicitly closing the box. However, specifying an explicit
36
36
  * closure in this way is optional: the closure will be inferred by the Couchbase Server if not
37
37
  * explicitly specified.
38
- * @snippet{trimleft} test_unit_search.cxx search-geo-bounding-box
38
+ * @snippet{trimleft} unit/management/search.cxx search-geo-bounding-box
39
39
  *
40
40
  * @see
41
41
  * https://docs.couchbase.com/server/current/fts/fts-supported-queries-geo-bounded-rectangle.html
@@ -32,7 +32,7 @@ namespace couchbase
32
32
  * The following query specifies a longitude of `-2.235143` and a latitude of `53.482358`. The
33
33
  * target-field `geo` is specified, as is a distance of `100 miles`: this is the radius within which
34
34
  * target-locations must reside for their documents to be returned.
35
- * @snippet{trimleft} test_unit_search.cxx search-geo-distance
35
+ * @snippet{trimleft} unit/management/search.cxx search-geo-distance
36
36
  *
37
37
  * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-geo-point-distance.html
38
38
  * server documentation
@@ -31,7 +31,7 @@ namespace couchbase
31
31
  *
32
32
  * If a target data-location falls within the box, its document is returned.
33
33
  *
34
- * @snippet{trimleft} test_unit_search.cxx search-geo-polygon
34
+ * @snippet{trimleft} unit/management/search.cxx search-geo-polygon
35
35
  *
36
36
  * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-geo-bounded-polygon.html
37
37
  * server documentation