couchbase 4.2.8-dev.1 → 4.2.9

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 (317) hide show
  1. package/CMakeLists.txt +1 -1
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +139 -56
  3. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  4. package/deps/couchbase-cxx-client/CMakeLists.txt +397 -424
  5. package/deps/couchbase-cxx-client/core/agent_config.hxx +1 -1
  6. package/deps/couchbase-cxx-client/core/agent_group.cxx +0 -1
  7. package/deps/couchbase-cxx-client/core/agent_group.hxx +9 -0
  8. package/deps/couchbase-cxx-client/core/agent_group_config.hxx +1 -1
  9. package/deps/couchbase-cxx-client/core/bucket.cxx +22 -8
  10. package/deps/couchbase-cxx-client/core/bucket.hxx +3 -1
  11. package/deps/couchbase-cxx-client/core/cluster.cxx +1453 -108
  12. package/deps/couchbase-cxx-client/core/cluster.hxx +183 -473
  13. package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +1 -1
  14. package/deps/couchbase-cxx-client/core/cluster_options.cxx +12 -2
  15. package/deps/couchbase-cxx-client/core/cluster_options.hxx +9 -8
  16. package/deps/couchbase-cxx-client/core/config_profiles.cxx +2 -2
  17. package/deps/couchbase-cxx-client/core/config_profiles.hxx +1 -1
  18. package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +1 -2
  19. package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +3 -2
  20. package/deps/couchbase-cxx-client/core/diagnostics.hxx +0 -1
  21. package/deps/couchbase-cxx-client/core/dispatcher.cxx +2 -2
  22. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +38 -76
  23. package/deps/couchbase-cxx-client/core/impl/analytics.hxx +40 -0
  24. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +820 -0
  25. package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +403 -0
  26. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +78 -0
  27. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +433 -0
  28. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +226 -44
  29. package/deps/couchbase-cxx-client/core/impl/collection.cxx +1384 -0
  30. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +306 -0
  31. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +3 -1
  32. package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +2 -0
  33. package/deps/couchbase-cxx-client/core/{operations/mcbp_noop.cxx → impl/doc_id_query.cxx} +19 -15
  34. package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +4 -2
  35. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +0 -10
  36. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +0 -10
  37. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +24 -17
  38. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
  39. package/deps/couchbase-cxx-client/core/impl/query.cxx +45 -68
  40. package/deps/couchbase-cxx-client/core/impl/query.hxx +34 -0
  41. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +628 -0
  42. package/deps/couchbase-cxx-client/core/impl/scope.cxx +172 -0
  43. package/deps/couchbase-cxx-client/core/impl/search.cxx +12 -61
  44. package/deps/couchbase-cxx-client/core/impl/search.hxx +37 -0
  45. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +469 -0
  46. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +12 -0
  47. package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +87 -0
  48. package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +23 -25
  49. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +28 -0
  50. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +6 -25
  51. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +9 -1
  52. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
  53. package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +3 -2
  54. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +51 -21
  55. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -1
  56. package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -4
  57. package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +1 -1
  58. package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +1 -1
  59. package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +1 -1
  60. package/deps/couchbase-cxx-client/core/meta/features.hxx +28 -0
  61. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +17 -1
  62. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -1
  63. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +2 -0
  64. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +2 -0
  65. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +2 -0
  66. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +2 -0
  67. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +2 -0
  68. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +2 -0
  69. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +2 -0
  70. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +2 -0
  71. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +2 -0
  72. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +2 -0
  73. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +1 -1
  74. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -0
  75. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +2 -0
  76. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +2 -0
  77. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +2 -0
  78. package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +3 -1
  79. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +2 -0
  80. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +2 -0
  81. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +2 -0
  82. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +6 -5
  83. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +2 -0
  84. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +2 -0
  85. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +2 -0
  86. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +2 -0
  87. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +2 -0
  88. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +2 -0
  89. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +2 -0
  90. package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +2 -0
  91. package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +2 -0
  92. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +1 -1
  93. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +2 -2
  94. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +4 -1
  95. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +4 -1
  96. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +1 -1
  97. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +1 -1
  98. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -0
  99. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +2 -0
  100. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +2 -0
  101. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +4 -4
  102. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +4 -4
  103. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +2 -0
  104. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +2 -0
  105. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +2 -0
  106. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +2 -0
  107. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +2 -0
  108. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +2 -0
  109. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +1 -1
  110. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +2 -0
  111. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +2 -0
  112. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +2 -0
  113. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -0
  114. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -0
  115. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +2 -0
  116. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -0
  117. package/deps/couchbase-cxx-client/core/operations.hxx +0 -1
  118. package/deps/couchbase-cxx-client/core/operations_fwd.hxx +260 -0
  119. package/deps/couchbase-cxx-client/core/origin.cxx +146 -5
  120. package/deps/couchbase-cxx-client/core/origin.hxx +30 -140
  121. package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +3 -3
  122. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -0
  123. package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +4 -4
  124. package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
  125. package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
  126. package/deps/couchbase-cxx-client/core/protocol/status.cxx +6 -0
  127. package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
  128. package/deps/couchbase-cxx-client/core/query_context.hxx +11 -7
  129. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +1 -1
  130. package/deps/couchbase-cxx-client/core/topology/configuration.cxx +23 -0
  131. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +8 -12
  132. package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +3 -3
  133. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -0
  134. package/deps/couchbase-cxx-client/core/topology/error_map.hxx +2 -2
  135. package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +4 -0
  136. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +58 -0
  137. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +5 -40
  138. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +30 -0
  139. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +18 -18
  140. package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +36 -0
  141. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +39 -41
  142. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +2 -2
  143. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +3 -1
  144. package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +2 -0
  145. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +32 -0
  146. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +4 -30
  147. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +41 -0
  148. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +17 -15
  149. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +1 -1
  150. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +4 -4
  151. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +1 -13
  152. package/deps/couchbase-cxx-client/core/transactions/result.hxx +0 -26
  153. package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +46 -0
  154. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +16 -14
  155. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +6 -6
  156. package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +48 -0
  157. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +1 -0
  158. package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +61 -4
  159. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +9 -8
  160. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +9 -16
  161. package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +7 -6
  162. package/deps/couchbase-cxx-client/core/transactions.hxx +6 -5
  163. package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +4 -3
  164. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +4 -4
  165. package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +44 -0
  166. package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +463 -0
  167. package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +44 -0
  168. package/deps/couchbase-cxx-client/couchbase/append_options.hxx +0 -24
  169. package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +1 -1
  170. package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +19 -115
  171. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +13 -30
  172. package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +8 -7
  173. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +0 -1
  174. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +41 -73
  175. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +1 -27
  176. package/deps/couchbase-cxx-client/couchbase/collection.hxx +176 -386
  177. package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +8 -9
  178. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +21 -24
  179. package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +116 -0
  180. package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +3 -3
  181. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +3 -2
  182. package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +120 -0
  183. package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +85 -0
  184. package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +103 -0
  185. package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +63 -0
  186. package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +0 -23
  187. package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +43 -0
  188. package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +105 -0
  189. package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +103 -0
  190. package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +84 -0
  191. package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +103 -0
  192. package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +63 -0
  193. package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +43 -0
  194. package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +22 -1
  195. package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +0 -23
  196. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +6 -0
  197. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -0
  198. package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +37 -0
  199. package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +43 -0
  200. package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +66 -0
  201. package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +65 -0
  202. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +1 -4
  203. package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +0 -23
  204. package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +45 -0
  205. package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +0 -24
  206. package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +0 -24
  207. package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +0 -23
  208. package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +43 -0
  209. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +121 -0
  210. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +0 -23
  211. package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +67 -0
  212. package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +44 -0
  213. package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +0 -23
  214. package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +0 -24
  215. package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +12 -0
  216. package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
  217. package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +0 -24
  218. package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +48 -0
  219. package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +48 -0
  220. package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +239 -0
  221. package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +3 -3
  222. package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +40 -0
  223. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -1
  224. package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +0 -24
  225. package/deps/couchbase-cxx-client/couchbase/network_options.hxx +1 -1
  226. package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +43 -0
  227. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +19 -0
  228. package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +0 -24
  229. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +99 -20
  230. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +0 -21
  231. package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +0 -23
  232. package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +63 -0
  233. package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +0 -24
  234. package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +43 -0
  235. package/deps/couchbase-cxx-client/couchbase/scope.hxx +13 -45
  236. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +1 -7
  237. package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +26 -0
  238. package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +292 -0
  239. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +10 -0
  240. package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +84 -0
  241. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +1 -1
  242. package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +0 -24
  243. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +1 -1
  244. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +10 -7
  245. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +10 -10
  246. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +8 -58
  247. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +28 -70
  248. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +7 -2
  249. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +2 -1
  250. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +11 -38
  251. package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +43 -0
  252. package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +0 -24
  253. package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +0 -24
  254. package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +41 -0
  255. package/dist/binding.d.ts +7 -9
  256. package/dist/bindingutilities.js +2 -0
  257. package/dist/collection.js +3 -3
  258. package/dist/errors.d.ts +9 -0
  259. package/dist/errors.js +14 -2
  260. package/dist/transactions.d.ts +2 -0
  261. package/dist/transactions.js +2 -3
  262. package/dist/usermanager.js +1 -1
  263. package/package.json +7 -7
  264. package/src/binding.cpp +1 -0
  265. package/src/connection.cpp +12 -9
  266. package/src/connection.hpp +3 -3
  267. package/src/connection_autogen.cpp +7 -5
  268. package/src/constants.cpp +3 -0
  269. package/src/instance.cpp +2 -2
  270. package/src/instance.hpp +1 -1
  271. package/src/jstocbpp_autogen.hpp +21 -38
  272. package/src/jstocbpp_basic.hpp +2 -0
  273. package/src/jstocbpp_errors.hpp +1 -0
  274. package/src/jstocbpp_transactions.hpp +6 -22
  275. package/src/mutationtoken.hpp +1 -0
  276. package/tools/gen-bindings-json.py +39 -16
  277. package/deps/couchbase-cxx-cache/spdlog/66ab2619a0014319471759c03e2de1af6bda14de/spdlog/example/CMakeLists.txt +0 -23
  278. package/deps/couchbase-cxx-cache/spdlog/66ab2619a0014319471759c03e2de1af6bda14de/spdlog/example/example.cpp +0 -398
  279. package/deps/couchbase-cxx-client/core/impl/append.cxx +0 -87
  280. package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +0 -157
  281. package/deps/couchbase-cxx-client/core/impl/create_bucket.cxx +0 -158
  282. package/deps/couchbase-cxx-client/core/impl/create_collection.cxx +0 -83
  283. package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +0 -232
  284. package/deps/couchbase-cxx-client/core/impl/create_scope.cxx +0 -69
  285. package/deps/couchbase-cxx-client/core/impl/decrement.cxx +0 -96
  286. package/deps/couchbase-cxx-client/core/impl/drop_bucket.cxx +0 -66
  287. package/deps/couchbase-cxx-client/core/impl/drop_collection.cxx +0 -76
  288. package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +0 -187
  289. package/deps/couchbase-cxx-client/core/impl/drop_scope.cxx +0 -68
  290. package/deps/couchbase-cxx-client/core/impl/exists.cxx +0 -47
  291. package/deps/couchbase-cxx-client/core/impl/flush_bucket.cxx +0 -66
  292. package/deps/couchbase-cxx-client/core/impl/get.cxx +0 -68
  293. package/deps/couchbase-cxx-client/core/impl/get_all_buckets.cxx +0 -178
  294. package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +0 -106
  295. package/deps/couchbase-cxx-client/core/impl/get_all_replicas.cxx +0 -145
  296. package/deps/couchbase-cxx-client/core/impl/get_all_scopes.cxx +0 -94
  297. package/deps/couchbase-cxx-client/core/impl/get_and_lock.cxx +0 -49
  298. package/deps/couchbase-cxx-client/core/impl/get_and_touch.cxx +0 -49
  299. package/deps/couchbase-cxx-client/core/impl/get_any_replica.cxx +0 -134
  300. package/deps/couchbase-cxx-client/core/impl/get_bucket.cxx +0 -168
  301. package/deps/couchbase-cxx-client/core/impl/increment.cxx +0 -96
  302. package/deps/couchbase-cxx-client/core/impl/insert.cxx +0 -90
  303. package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +0 -69
  304. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +0 -178
  305. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +0 -169
  306. package/deps/couchbase-cxx-client/core/impl/mutate_in.cxx +0 -125
  307. package/deps/couchbase-cxx-client/core/impl/prepend.cxx +0 -87
  308. package/deps/couchbase-cxx-client/core/impl/remove.cxx +0 -86
  309. package/deps/couchbase-cxx-client/core/impl/replace.cxx +0 -102
  310. package/deps/couchbase-cxx-client/core/impl/touch.cxx +0 -49
  311. package/deps/couchbase-cxx-client/core/impl/unlock.cxx +0 -47
  312. package/deps/couchbase-cxx-client/core/impl/update_bucket.cxx +0 -133
  313. package/deps/couchbase-cxx-client/core/impl/update_collection.cxx +0 -83
  314. package/deps/couchbase-cxx-client/core/impl/upsert.cxx +0 -100
  315. package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +0 -196
  316. package/deps/couchbase-cxx-client/core/operations/mcbp_noop.hxx +0 -49
  317. /package/deps/couchbase-cxx-client/core/impl/{streaming_json_lexter_error_category.cxx → streaming_json_lexer_error_category.cxx} +0 -0
@@ -41,21 +41,20 @@
41
41
  #include <couchbase/unlock_options.hxx>
42
42
  #include <couchbase/upsert_options.hxx>
43
43
 
44
- #include <fmt/format.h>
45
44
  #include <future>
46
45
  #include <memory>
47
46
 
47
+ namespace couchbase
48
+ {
48
49
  #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
49
- namespace couchbase::core
50
+ namespace core
50
51
  {
51
52
  class cluster;
52
- } // namespace couchbase::core
53
- #endif
54
-
55
- namespace couchbase
56
- {
53
+ } // namespace core
57
54
  class bucket;
58
55
  class scope;
56
+ class collection_impl;
57
+ #endif
59
58
 
60
59
  /**
61
60
  * The {@link collection} provides access to all collection APIs.
@@ -82,10 +81,7 @@ class collection
82
81
  * @since 1.0.0
83
82
  * @committed
84
83
  */
85
- [[nodiscard]] auto bucket_name() const noexcept -> const std::string&
86
- {
87
- return bucket_name_;
88
- }
84
+ [[nodiscard]] auto bucket_name() const -> const std::string&;
89
85
 
90
86
  /**
91
87
  * Returns name of the scope where the collection is defined.
@@ -95,10 +91,7 @@ class collection
95
91
  * @since 1.0.0
96
92
  * @committed
97
93
  */
98
- [[nodiscard]] auto scope_name() const noexcept -> const std::string&
99
- {
100
- return scope_name_;
101
- }
94
+ [[nodiscard]] auto scope_name() const -> const std::string&;
102
95
 
103
96
  /**
104
97
  * Returns name of the collection.
@@ -108,10 +101,7 @@ class collection
108
101
  * @since 1.0.0
109
102
  * @committed
110
103
  */
111
- [[nodiscard]] auto name() const noexcept -> const std::string&
112
- {
113
- return name_;
114
- }
104
+ [[nodiscard]] auto name() const -> const std::string&;
115
105
 
116
106
  /**
117
107
  * Provides access to the binary APIs, not used for JSON documents.
@@ -121,16 +111,11 @@ class collection
121
111
  * @since 1.0.0
122
112
  * @committed
123
113
  */
124
- [[nodiscard]] auto binary() const -> binary_collection
125
- {
126
- return { core_, bucket_name_, scope_name_, name_ };
127
- }
114
+ [[nodiscard]] auto binary() const -> binary_collection;
128
115
 
129
116
  /**
130
117
  * Fetches the full document from this collection.
131
118
  *
132
- * @tparam Handler callable type that implements @ref get_handler signature
133
- *
134
119
  * @param document_id the document id which is used to uniquely identify it.
135
120
  * @param options options to customize the get request.
136
121
  * @param handler the handler that implements @ref get_handler
@@ -142,12 +127,7 @@ class collection
142
127
  * @since 1.0.0
143
128
  * @committed
144
129
  */
145
- template<typename Handler>
146
- void get(std::string document_id, const get_options& options, Handler&& handler) const
147
- {
148
- return core::impl::initiate_get_operation(
149
- core_, bucket_name_, scope_name_, name_, std::move(document_id), options.build(), std::forward<Handler>(handler));
150
- }
130
+ void get(std::string document_id, const get_options& options, get_handler&& handler) const;
151
131
 
152
132
  /**
153
133
  * Fetches the full document from this collection.
@@ -164,21 +144,11 @@ class collection
164
144
  * @committed
165
145
  */
166
146
  [[nodiscard]] auto get(std::string document_id, const get_options& options = {}) const
167
- -> std::future<std::pair<key_value_error_context, get_result>>
168
- {
169
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
170
- auto future = barrier->get_future();
171
- get(std::move(document_id), options, [barrier](auto ctx, auto result) {
172
- barrier->set_value({ std::move(ctx), std::move(result) });
173
- });
174
- return future;
175
- }
147
+ -> std::future<std::pair<key_value_error_context, get_result>>;
176
148
 
177
149
  /**
178
150
  * Fetches a full document and resets its expiration time to the value provided.
179
151
  *
180
- * @tparam Handler callable type that implements @ref get_and_touch_handler signature
181
- *
182
152
  * @param document_id the document id which is used to uniquely identify it.
183
153
  * @param duration the new expiration time for the document.
184
154
  * @param options custom options to change the default behavior.
@@ -191,21 +161,10 @@ class collection
191
161
  * @since 1.0.0
192
162
  * @committed
193
163
  */
194
- template<typename Handler>
195
164
  void get_and_touch(std::string document_id,
196
165
  std::chrono::seconds duration,
197
166
  const get_and_touch_options& options,
198
- Handler&& handler) const
199
- {
200
- return core::impl::initiate_get_and_touch_operation(core_,
201
- bucket_name_,
202
- scope_name_,
203
- name_,
204
- std::move(document_id),
205
- core::impl::expiry_relative(duration),
206
- options.build(),
207
- std::forward<Handler>(handler));
208
- }
167
+ get_and_touch_handler&& handler) const;
209
168
 
210
169
  /**
211
170
  * Fetches a full document and resets its expiration time to the value provided.
@@ -225,21 +184,11 @@ class collection
225
184
  [[nodiscard]] auto get_and_touch(std::string document_id,
226
185
  std::chrono::seconds duration,
227
186
  const get_and_touch_options& options = {}) const
228
- -> std::future<std::pair<key_value_error_context, get_result>>
229
- {
230
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
231
- auto future = barrier->get_future();
232
- get_and_touch(std::move(document_id), duration, options, [barrier](auto ctx, auto result) {
233
- barrier->set_value({ std::move(ctx), std::move(result) });
234
- });
235
- return future;
236
- }
187
+ -> std::future<std::pair<key_value_error_context, get_result>>;
237
188
 
238
189
  /**
239
190
  * Fetches a full document and resets its expiration time to the absolute value provided.
240
191
  *
241
- * @tparam Handler callable type that implements @ref get_and_touch_handler signature
242
- *
243
192
  * @param document_id the document id which is used to uniquely identify it.
244
193
  * @param time_point the new expiration time point for the document.
245
194
  * @param options custom options to change the default behavior.
@@ -252,21 +201,10 @@ class collection
252
201
  * @since 1.0.0
253
202
  * @committed
254
203
  */
255
- template<typename Handler>
256
204
  void get_and_touch(std::string document_id,
257
205
  std::chrono::system_clock::time_point time_point,
258
206
  const get_and_touch_options& options,
259
- Handler&& handler) const
260
- {
261
- return core::impl::initiate_get_and_touch_operation(core_,
262
- bucket_name_,
263
- scope_name_,
264
- name_,
265
- std::move(document_id),
266
- core::impl::expiry_absolute(time_point),
267
- options.build(),
268
- std::forward<Handler>(handler));
269
- }
207
+ get_and_touch_handler&& handler) const;
270
208
 
271
209
  /**
272
210
  * Fetches a full document and resets its expiration time to the absolute value provided.
@@ -286,21 +224,11 @@ class collection
286
224
  [[nodiscard]] auto get_and_touch(std::string document_id,
287
225
  std::chrono::system_clock::time_point time_point,
288
226
  const get_and_touch_options& options = {}) const
289
- -> std::future<std::pair<key_value_error_context, get_result>>
290
- {
291
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
292
- auto future = barrier->get_future();
293
- get_and_touch(std::move(document_id), time_point, options, [barrier](auto ctx, auto result) {
294
- barrier->set_value({ std::move(ctx), std::move(result) });
295
- });
296
- return future;
297
- }
227
+ -> std::future<std::pair<key_value_error_context, get_result>>;
298
228
 
299
229
  /**
300
230
  * Updates the expiration a document given an id, without modifying or returning its value.
301
231
  *
302
- * @tparam Handler callable type that implements @ref touch_handler signature
303
- *
304
232
  * @param document_id the document id which is used to uniquely identify it.
305
233
  * @param duration the new expiration time for the document.
306
234
  * @param options custom options to change the default behavior.
@@ -313,18 +241,7 @@ class collection
313
241
  * @since 1.0.0
314
242
  * @committed
315
243
  */
316
- template<typename Handler>
317
- void touch(std::string document_id, std::chrono::seconds duration, const touch_options& options, Handler&& handler) const
318
- {
319
- return core::impl::initiate_touch_operation(core_,
320
- bucket_name_,
321
- scope_name_,
322
- name_,
323
- std::move(document_id),
324
- core::impl::expiry_relative(duration),
325
- options.build(),
326
- std::forward<Handler>(handler));
327
- }
244
+ void touch(std::string document_id, std::chrono::seconds duration, const touch_options& options, touch_handler&& handler) const;
328
245
 
329
246
  /**
330
247
  * Updates the expiration a document given an id, without modifying or returning its value.
@@ -342,21 +259,11 @@ class collection
342
259
  * @committed
343
260
  */
344
261
  [[nodiscard]] auto touch(std::string document_id, std::chrono::seconds duration, const touch_options& options = {}) const
345
- -> std::future<std::pair<key_value_error_context, result>>
346
- {
347
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, result>>>();
348
- auto future = barrier->get_future();
349
- touch(std::move(document_id), duration, options, [barrier](auto ctx, auto result) {
350
- barrier->set_value({ std::move(ctx), std::move(result) });
351
- });
352
- return future;
353
- }
262
+ -> std::future<std::pair<key_value_error_context, result>>;
354
263
 
355
264
  /**
356
265
  * Updates the expiration a document given an id, without modifying or returning its value.
357
266
  *
358
- * @tparam Handler callable type that implements @ref touch_handler signature
359
- *
360
267
  * @param document_id the document id which is used to uniquely identify it.
361
268
  * @param time_point the new expiration time point for the document.
362
269
  * @param options custom options to change the default behavior.
@@ -369,21 +276,10 @@ class collection
369
276
  * @since 1.0.0
370
277
  * @committed
371
278
  */
372
- template<typename Handler>
373
279
  void touch(std::string document_id,
374
280
  std::chrono::system_clock::time_point time_point,
375
281
  const touch_options& options,
376
- Handler&& handler) const
377
- {
378
- return core::impl::initiate_touch_operation(core_,
379
- bucket_name_,
380
- scope_name_,
381
- name_,
382
- std::move(document_id),
383
- core::impl::expiry_absolute(time_point),
384
- options.build(),
385
- std::forward<Handler>(handler));
386
- }
282
+ touch_handler&& handler) const;
387
283
 
388
284
  /**
389
285
  * Updates the expiration a document given an id, without modifying or returning its value.
@@ -402,21 +298,11 @@ class collection
402
298
  */
403
299
  [[nodiscard]] auto touch(std::string document_id,
404
300
  std::chrono::system_clock::time_point time_point,
405
- const touch_options& options = {}) const -> std::future<std::pair<key_value_error_context, result>>
406
- {
407
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, result>>>();
408
- auto future = barrier->get_future();
409
- touch(std::move(document_id), time_point, options, [barrier](auto ctx, auto result) {
410
- barrier->set_value({ std::move(ctx), std::move(result) });
411
- });
412
- return future;
413
- }
301
+ const touch_options& options = {}) const -> std::future<std::pair<key_value_error_context, result>>;
414
302
 
415
303
  /**
416
304
  * Reads all available replicas, and returns the first found.
417
305
  *
418
- * @tparam Handler callable type that implements @ref get_any_replica_handler signature
419
- *
420
306
  * @param document_id the document id which is used to uniquely identify it.
421
307
  * @param options the custom options
422
308
  * @param handler the handler that implements @ref get_any_replica_handler
@@ -431,12 +317,7 @@ class collection
431
317
  * @since 1.0.0
432
318
  * @committed
433
319
  */
434
- template<typename Handler>
435
- void get_any_replica(std::string document_id, const get_any_replica_options& options, Handler&& handler) const
436
- {
437
- return core::impl::initiate_get_any_replica_operation(
438
- core_, bucket_name_, scope_name_, name_, std::move(document_id), options.build(), std::forward<Handler>(handler));
439
- }
320
+ void get_any_replica(std::string document_id, const get_any_replica_options& options, get_any_replica_handler&& handler) const;
440
321
 
441
322
  /**
442
323
  * Reads all available replicas, and returns the first found.
@@ -456,15 +337,7 @@ class collection
456
337
  * @committed
457
338
  */
458
339
  [[nodiscard]] auto get_any_replica(std::string document_id, const get_any_replica_options& options = {}) const
459
- -> std::future<std::pair<key_value_error_context, get_replica_result>>
460
- {
461
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_replica_result>>>();
462
- auto future = barrier->get_future();
463
- get_any_replica(std::move(document_id), options, [barrier](auto ctx, auto result) {
464
- barrier->set_value({ std::move(ctx), std::move(result) });
465
- });
466
- return future;
467
- }
340
+ -> std::future<std::pair<key_value_error_context, get_replica_result>>;
468
341
 
469
342
  /**
470
343
  * Reads from all available replicas and the active node and returns the results as a vector.
@@ -472,8 +345,6 @@ class collection
472
345
  * @note Individual errors are ignored, so you can think of this API as a best effort
473
346
  * approach which explicitly emphasises availability over consistency.
474
347
  *
475
- * @tparam Handler callable type that implements @ref get_all_replicas_handler signature
476
- *
477
348
  * @param document_id the document id which is used to uniquely identify it.
478
349
  * @param options the custom options
479
350
  * @param handler the handler that implements @ref get_all_replicas_handler
@@ -484,12 +355,7 @@ class collection
484
355
  * @since 1.0.0
485
356
  * @committed
486
357
  */
487
- template<typename Handler>
488
- void get_all_replicas(std::string document_id, const get_all_replicas_options& options, Handler&& handler) const
489
- {
490
- return core::impl::initiate_get_all_replicas_operation(
491
- core_, bucket_name_, scope_name_, name_, std::move(document_id), options.build(), std::forward<Handler>(handler));
492
- }
358
+ void get_all_replicas(std::string document_id, const get_all_replicas_options& options, get_all_replicas_handler&& handler) const;
493
359
 
494
360
  /**
495
361
  * Reads from all available replicas and the active node and returns the results as a vector.
@@ -508,22 +374,29 @@ class collection
508
374
  * @committed
509
375
  */
510
376
  [[nodiscard]] auto get_all_replicas(std::string document_id, const get_all_replicas_options& options = {}) const
511
- -> std::future<std::pair<key_value_error_context, get_all_replicas_result>>
512
- {
513
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_all_replicas_result>>>();
514
- auto future = barrier->get_future();
515
- get_all_replicas(std::move(document_id), options, [barrier](auto ctx, auto result) {
516
- barrier->set_value({ std::move(ctx), std::move(result) });
517
- });
518
- return future;
519
- }
377
+ -> std::future<std::pair<key_value_error_context, get_all_replicas_result>>;
378
+
379
+ /**
380
+ * Upserts an encoded body of the document which might or might not exist yet, with custom options.
381
+ *
382
+ * @param document_id the document id which is used to uniquely identify it.
383
+ * @param document the encoded content of the document to upsert.
384
+ * @param options custom options to customize the upsert behavior.
385
+ * @param handler callable that implements @ref upsert_handler
386
+ *
387
+ * @exception errc::common::ambiguous_timeout
388
+ * @exception errc::common::unambiguous_timeout
389
+ *
390
+ * @since 1.0.0
391
+ * @uncommitted
392
+ */
393
+ void upsert(std::string document_id, codec::encoded_value document, const upsert_options& options, upsert_handler&& handler) const;
520
394
 
521
395
  /**
522
396
  * Upserts a full document which might or might not exist yet with custom options.
523
397
  *
524
398
  * @tparam Transcoder type of the transcoder that will be used to encode the document
525
399
  * @tparam Document type of the document
526
- * @tparam Handler type of the handler that implements @ref upsert_handler
527
400
  *
528
401
  * @param document_id the document id which is used to uniquely identify it.
529
402
  * @param document the document content to upsert.
@@ -536,19 +409,29 @@ class collection
536
409
  * @since 1.0.0
537
410
  * @committed
538
411
  */
539
- template<typename Transcoder = codec::default_json_transcoder, typename Document, typename Handler>
540
- void upsert(std::string document_id, Document document, const upsert_options& options, Handler&& handler) const
412
+ template<typename Transcoder = codec::default_json_transcoder, typename Document>
413
+ void upsert(std::string document_id, Document document, const upsert_options& options, upsert_handler&& handler) const
541
414
  {
542
- return core::impl::initiate_upsert_operation(core_,
543
- bucket_name_,
544
- scope_name_,
545
- name_,
546
- std::move(document_id),
547
- Transcoder::encode(document),
548
- options.build(),
549
- std::forward<Handler>(handler));
415
+ return upsert(std::move(document_id), Transcoder::encode(document), options, std::move(handler));
550
416
  }
551
417
 
418
+ /**
419
+ * Upserts an encoded body of the document which might or might not exist yet, with custom options.
420
+ *
421
+ * @param document_id the document id which is used to uniquely identify it.
422
+ * @param document the encoded content of the document to upsert.
423
+ * @param options custom options to customize the upsert behavior.
424
+ * @return future object that carries result of the operation
425
+ *
426
+ * @exception errc::common::ambiguous_timeout
427
+ * @exception errc::common::unambiguous_timeout
428
+ *
429
+ * @since 1.0.0
430
+ * @uncommitted
431
+ */
432
+ [[nodiscard]] auto upsert(std::string document_id, codec::encoded_value document, const upsert_options& options) const
433
+ -> std::future<std::pair<key_value_error_context, mutation_result>>;
434
+
552
435
  /**
553
436
  * Upserts a full document which might or might not exist yet with custom options.
554
437
  *
@@ -570,20 +453,30 @@ class collection
570
453
  [[nodiscard]] auto upsert(std::string document_id, const Document& document, const upsert_options& options = {}) const
571
454
  -> std::future<std::pair<key_value_error_context, mutation_result>>
572
455
  {
573
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
574
- auto future = barrier->get_future();
575
- upsert<Transcoder>(std::move(document_id), document, options, [barrier](auto ctx, auto result) {
576
- barrier->set_value({ std::move(ctx), std::move(result) });
577
- });
578
- return future;
456
+ return upsert(std::move(document_id), Transcoder::encode(document), options);
579
457
  }
580
458
 
459
+ /**
460
+ * Inserts an encoded body of the document which does not exist yet with custom options.
461
+ *
462
+ * @param document_id the document id which is used to uniquely identify it.
463
+ * @param document the encoded content of the document to upsert.
464
+ * @param options custom options to customize the upsert behavior.
465
+ * @param handler callable that implements @ref upsert_handler
466
+ *
467
+ * @exception errc::common::ambiguous_timeout
468
+ * @exception errc::common::unambiguous_timeout
469
+ *
470
+ * @since 1.0.0
471
+ * @uncommitted
472
+ */
473
+ void insert(std::string document_id, codec::encoded_value document, const insert_options& options, insert_handler&& handler) const;
474
+
581
475
  /**
582
476
  * Inserts a full document which does not exist yet with custom options.
583
477
  *
584
478
  * @tparam Transcoder type of the transcoder that will be used to encode the document
585
479
  * @tparam Document type of the document
586
- * @tparam Handler type of the handler that implements @ref insert_handler
587
480
  *
588
481
  * @param document_id the document id which is used to uniquely identify it.
589
482
  * @param document the document content to insert.
@@ -597,19 +490,31 @@ class collection
597
490
  * @since 1.0.0
598
491
  * @committed
599
492
  */
600
- template<typename Transcoder = codec::default_json_transcoder, typename Document, typename Handler>
601
- void insert(std::string document_id, Document document, const insert_options& options, Handler&& handler) const
493
+ template<typename Transcoder = codec::default_json_transcoder,
494
+ typename Document,
495
+ std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>, bool> = true>
496
+ void insert(std::string document_id, Document document, const insert_options& options, insert_handler&& handler) const
602
497
  {
603
- return core::impl::initiate_insert_operation(core_,
604
- bucket_name_,
605
- scope_name_,
606
- name_,
607
- std::move(document_id),
608
- Transcoder::encode(document),
609
- options.build(),
610
- std::forward<Handler>(handler));
498
+ return insert(std::move(document_id), Transcoder::encode(document), options, std::move(handler));
611
499
  }
612
500
 
501
+ /**
502
+ * Inserts an encoded body of the document which does not exist yet with custom options.
503
+ *
504
+ * @param document_id the document id which is used to uniquely identify it.
505
+ * @param document the encoded content of the document to upsert.
506
+ * @param options custom options to customize the upsert behavior.
507
+ * @return future object that carries result of the operation
508
+ *
509
+ * @exception errc::common::ambiguous_timeout
510
+ * @exception errc::common::unambiguous_timeout
511
+ *
512
+ * @since 1.0.0
513
+ * @uncommitted
514
+ */
515
+ [[nodiscard]] auto insert(std::string document_id, codec::encoded_value document, const insert_options& options) const
516
+ -> std::future<std::pair<key_value_error_context, mutation_result>>;
517
+
613
518
  /**
614
519
  * Inserts a full document which does not exist yet with custom options.
615
520
  *
@@ -628,24 +533,36 @@ class collection
628
533
  * @since 1.0.0
629
534
  * @committed
630
535
  */
631
- template<typename Transcoder = codec::default_json_transcoder, typename Document>
536
+ template<typename Transcoder = codec::default_json_transcoder,
537
+ typename Document,
538
+ std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>, bool> = true>
632
539
  [[nodiscard]] auto insert(std::string document_id, const Document& document, const insert_options& options = {}) const
633
540
  -> std::future<std::pair<key_value_error_context, mutation_result>>
634
541
  {
635
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
636
- auto future = barrier->get_future();
637
- insert<Transcoder>(std::move(document_id), document, options, [barrier](auto ctx, auto result) {
638
- barrier->set_value({ std::move(ctx), std::move(result) });
639
- });
640
- return future;
542
+ return insert(std::move(document_id), Transcoder::encode(document), options);
641
543
  }
642
544
 
545
+ /**
546
+ * Replaces a body of the document which already exists with specified encoded body.
547
+ *
548
+ * @param document_id the document id which is used to uniquely identify it.
549
+ * @param document the encoded content of the document to upsert.
550
+ * @param options custom options to customize the upsert behavior.
551
+ * @param handler callable that implements @ref upsert_handler
552
+ *
553
+ * @exception errc::common::ambiguous_timeout
554
+ * @exception errc::common::unambiguous_timeout
555
+ *
556
+ * @since 1.0.0
557
+ * @uncommitted
558
+ */
559
+ void replace(std::string document_id, codec::encoded_value document, const replace_options& options, replace_handler&& handler) const;
560
+
643
561
  /**
644
562
  * Replaces a full document which already exists.
645
563
  *
646
564
  * @tparam Transcoder type of the transcoder that will be used to encode the document
647
565
  * @tparam Document type of the document
648
- * @tparam Handler type of the handler that implements @ref replace_handler
649
566
  *
650
567
  * @param document_id the document id which is used to uniquely identify it.
651
568
  * @param document the document content to replace.
@@ -660,19 +577,31 @@ class collection
660
577
  * @since 1.0.0
661
578
  * @committed
662
579
  */
663
- template<typename Transcoder = codec::default_json_transcoder, typename Document, typename Handler>
664
- void replace(std::string document_id, Document document, const replace_options& options, Handler&& handler) const
580
+ template<typename Transcoder = codec::default_json_transcoder,
581
+ typename Document,
582
+ std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>, bool> = true>
583
+ void replace(std::string document_id, Document document, const replace_options& options, replace_handler&& handler) const
665
584
  {
666
- return core::impl::initiate_replace_operation(core_,
667
- bucket_name_,
668
- scope_name_,
669
- name_,
670
- std::move(document_id),
671
- Transcoder::encode(document),
672
- options.build(),
673
- std::forward<Handler>(handler));
585
+ return replace(std::move(document_id), Transcoder::encode(document), options, std::move(handler));
674
586
  }
675
587
 
588
+ /**
589
+ * Replaces a body of the document which already exists with specified encoded body.
590
+ *
591
+ * @param document_id the document id which is used to uniquely identify it.
592
+ * @param document the encoded content of the document to upsert.
593
+ * @param options custom options to customize the upsert behavior.
594
+ * @return future object that carries result of the operation
595
+ *
596
+ * @exception errc::common::ambiguous_timeout
597
+ * @exception errc::common::unambiguous_timeout
598
+ *
599
+ * @since 1.0.0
600
+ * @uncommitted
601
+ */
602
+ [[nodiscard]] auto replace(std::string document_id, codec::encoded_value document, const replace_options& options) const
603
+ -> std::future<std::pair<key_value_error_context, mutation_result>>;
604
+
676
605
  /**
677
606
  * Replaces a full document which already exists.
678
607
  *
@@ -692,23 +621,18 @@ class collection
692
621
  * @since 1.0.0
693
622
  * @committed
694
623
  */
695
- template<typename Transcoder = codec::default_json_transcoder, typename Document>
624
+ template<typename Transcoder = codec::default_json_transcoder,
625
+ typename Document,
626
+ std::enable_if_t<!std::is_same_v<codec::encoded_value, Document>, bool> = true>
696
627
  [[nodiscard]] auto replace(std::string document_id, const Document& document, const replace_options& options = {}) const
697
628
  -> std::future<std::pair<key_value_error_context, mutation_result>>
698
629
  {
699
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
700
- auto future = barrier->get_future();
701
- replace<Transcoder>(std::move(document_id), document, options, [barrier](auto ctx, auto result) {
702
- barrier->set_value({ std::move(ctx), std::move(result) });
703
- });
704
- return future;
630
+ return replace(std::move(document_id), Transcoder::encode(document), options);
705
631
  }
706
632
 
707
633
  /**
708
634
  * Removes a Document from a collection.
709
635
  *
710
- * @tparam Handler type of the handler that implements @ref remove_handler
711
- *
712
636
  * @param document_id the document id which is used to uniquely identify it.
713
637
  * @param options custom options to customize the remove behavior.
714
638
  * @param handler callable that implements @ref remove_handler
@@ -721,12 +645,7 @@ class collection
721
645
  * @since 1.0.0
722
646
  * @committed
723
647
  */
724
- template<typename Handler>
725
- void remove(std::string document_id, const remove_options& options, Handler&& handler) const
726
- {
727
- return core::impl::initiate_remove_operation(
728
- core_, bucket_name_, scope_name_, name_, std::move(document_id), options.build(), std::forward<Handler>(handler));
729
- }
648
+ void remove(std::string document_id, const remove_options& options, remove_handler&& handler) const;
730
649
 
731
650
  /**
732
651
  * Removes a Document from a collection.
@@ -744,21 +663,11 @@ class collection
744
663
  * @committed
745
664
  */
746
665
  [[nodiscard]] auto remove(std::string document_id, const remove_options& options = {}) const
747
- -> std::future<std::pair<key_value_error_context, mutation_result>>
748
- {
749
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
750
- auto future = barrier->get_future();
751
- remove(std::move(document_id), options, [barrier](auto ctx, auto result) {
752
- barrier->set_value({ std::move(ctx), std::move(result) });
753
- });
754
- return future;
755
- }
666
+ -> std::future<std::pair<key_value_error_context, mutation_result>>;
756
667
 
757
668
  /**
758
669
  * Performs mutations to document fragments
759
670
  *
760
- * @tparam Handler type of the handler that implements @ref mutate_in_handler
761
- *
762
671
  * @param document_id the document id which is used to uniquely identify it.
763
672
  * @param specs the spec which specifies the type of mutations to perform.
764
673
  * @param options custom options to customize the mutate_in behavior.
@@ -773,12 +682,10 @@ class collection
773
682
  * @since 1.0.0
774
683
  * @committed
775
684
  */
776
- template<typename Handler>
777
- void mutate_in(std::string document_id, mutate_in_specs specs, const mutate_in_options& options, Handler&& handler) const
778
- {
779
- return core::impl::initiate_mutate_in_operation(
780
- core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
781
- }
685
+ void mutate_in(std::string document_id,
686
+ const mutate_in_specs& specs,
687
+ const mutate_in_options& options,
688
+ mutate_in_handler&& handler) const;
782
689
 
783
690
  /**
784
691
  * Performs mutations to document fragments
@@ -797,22 +704,12 @@ class collection
797
704
  * @since 1.0.0
798
705
  * @committed
799
706
  */
800
- [[nodiscard]] auto mutate_in(std::string document_id, mutate_in_specs specs, const mutate_in_options& options = {}) const
801
- -> std::future<std::pair<subdocument_error_context, mutate_in_result>>
802
- {
803
- auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, mutate_in_result>>>();
804
- auto future = barrier->get_future();
805
- mutate_in(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
806
- barrier->set_value({ std::move(ctx), std::move(result) });
807
- });
808
- return future;
809
- }
707
+ [[nodiscard]] auto mutate_in(std::string document_id, const mutate_in_specs& specs, const mutate_in_options& options = {}) const
708
+ -> std::future<std::pair<subdocument_error_context, mutate_in_result>>;
810
709
 
811
710
  /**
812
711
  * Performs lookups to document fragments with default options.
813
712
  *
814
- * @tparam Handler type of the handler that implements @ref lookup_in_handler
815
- *
816
713
  * @param document_id the outer document ID
817
714
  * @param specs an object that specifies the types of lookups to perform
818
715
  * @param options custom options to modify the lookup options
@@ -825,12 +722,10 @@ class collection
825
722
  * @since 1.0.0
826
723
  * @committed
827
724
  */
828
- template<typename Handler>
829
- void lookup_in(std::string document_id, lookup_in_specs specs, const lookup_in_options& options, Handler&& handler) const
830
- {
831
- return core::impl::initiate_lookup_in_operation(
832
- core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
833
- }
725
+ void lookup_in(std::string document_id,
726
+ const lookup_in_specs& specs,
727
+ const lookup_in_options& options,
728
+ lookup_in_handler&& handler) const;
834
729
 
835
730
  /**
836
731
  * Performs lookups to document fragments with default options.
@@ -847,22 +742,12 @@ class collection
847
742
  * @since 1.0.0
848
743
  * @committed
849
744
  */
850
- [[nodiscard]] auto lookup_in(std::string document_id, lookup_in_specs specs, const lookup_in_options& options = {}) const
851
- -> std::future<std::pair<subdocument_error_context, lookup_in_result>>
852
- {
853
- auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_result>>>();
854
- auto future = barrier->get_future();
855
- lookup_in(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
856
- barrier->set_value({ std::move(ctx), std::move(result) });
857
- });
858
- return future;
859
- }
745
+ [[nodiscard]] auto lookup_in(std::string document_id, const lookup_in_specs& specs, const lookup_in_options& options = {}) const
746
+ -> std::future<std::pair<subdocument_error_context, lookup_in_result>>;
860
747
 
861
748
  /**
862
749
  * Performs lookups to document fragments with default options from all replicas and the active node and returns the result as a vector.
863
750
  *
864
- * @tparam Handler type of the handler that implements @ref lookup_in_all_replicas_handler
865
- *
866
751
  * @param document_id the outer document ID
867
752
  * @param specs an object that specifies the types of lookups to perform
868
753
  * @param options custom options to modify the lookup options
@@ -875,15 +760,10 @@ class collection
875
760
  * @since 1.0.0
876
761
  * @committed
877
762
  */
878
- template<typename Handler>
879
763
  void lookup_in_all_replicas(std::string document_id,
880
- lookup_in_specs specs,
764
+ const lookup_in_specs& specs,
881
765
  const lookup_in_all_replicas_options& options,
882
- Handler&& handler) const
883
- {
884
- return core::impl::initiate_lookup_in_all_replicas_operation(
885
- core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
886
- }
766
+ lookup_in_all_replicas_handler&& handler) const;
887
767
 
888
768
  /**
889
769
  * Performs lookups to document fragments with default options from all replicas and the active node and returns the result as a vector.
@@ -901,23 +781,13 @@ class collection
901
781
  * @committed
902
782
  */
903
783
  [[nodiscard]] auto lookup_in_all_replicas(std::string document_id,
904
- lookup_in_specs specs,
784
+ const lookup_in_specs& specs,
905
785
  const lookup_in_all_replicas_options& options = {}) const
906
- -> std::future<std::pair<subdocument_error_context, lookup_in_all_replicas_result>>
907
- {
908
- auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_all_replicas_result>>>();
909
- auto future = barrier->get_future();
910
- lookup_in_all_replicas(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
911
- barrier->set_value({ std::move(ctx), std::move(result) });
912
- });
913
- return future;
914
- }
786
+ -> std::future<std::pair<subdocument_error_context, lookup_in_all_replicas_result>>;
915
787
 
916
788
  /**
917
789
  * Performs lookups to document fragments with default options from all replicas and returns the first found.
918
790
  *
919
- * @tparam Handler type of the handler that implements @ref lookup_in_any_replica_handler
920
- *
921
791
  * @param document_id the outer document ID
922
792
  * @param specs an object that specifies the types of lookups to perform
923
793
  * @param options custom options to modify the lookup options
@@ -929,15 +799,10 @@ class collection
929
799
  * @since 1.0.0
930
800
  * @committed
931
801
  */
932
- template<typename Handler>
933
802
  void lookup_in_any_replica(std::string document_id,
934
- lookup_in_specs specs,
803
+ const lookup_in_specs& specs,
935
804
  const lookup_in_any_replica_options& options,
936
- Handler&& handler) const
937
- {
938
- return core::impl::initiate_lookup_in_any_replica_operation(
939
- core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
940
- }
805
+ lookup_in_any_replica_handler&& handler) const;
941
806
 
942
807
  /**
943
808
  * Performs lookups to document fragments with default options from all replicas and returns the first found.
@@ -955,23 +820,13 @@ class collection
955
820
  * @committed
956
821
  */
957
822
  [[nodiscard]] auto lookup_in_any_replica(std::string document_id,
958
- lookup_in_specs specs,
823
+ const lookup_in_specs& specs,
959
824
  const lookup_in_any_replica_options& options = {}) const
960
- -> std::future<std::pair<subdocument_error_context, lookup_in_replica_result>>
961
- {
962
- auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_replica_result>>>();
963
- auto future = barrier->get_future();
964
- lookup_in_any_replica(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
965
- barrier->set_value({ std::move(ctx), std::move(result) });
966
- });
967
- return future;
968
- }
825
+ -> std::future<std::pair<subdocument_error_context, lookup_in_replica_result>>;
969
826
 
970
827
  /**
971
828
  * Gets a document for a given id and places a pessimistic lock on it for mutations
972
829
  *
973
- * @tparam Handler type of the handler that implements @ref get_and_lock_handler
974
- *
975
830
  * @param document_id the id of the document
976
831
  * @param lock_duration the length of time the lock will be held on the document
977
832
  * @param options the options to customize
@@ -980,15 +835,10 @@ class collection
980
835
  * @since 1.0.0
981
836
  * @committed
982
837
  */
983
- template<typename Handler>
984
838
  void get_and_lock(std::string document_id,
985
839
  std::chrono::seconds lock_duration,
986
840
  const get_and_lock_options& options,
987
- Handler&& handler) const
988
- {
989
- return core::impl::initiate_get_and_lock_operation(
990
- core_, bucket_name_, scope_name_, name_, std::move(document_id), lock_duration, options.build(), std::forward<Handler>(handler));
991
- }
841
+ get_and_lock_handler&& handler) const;
992
842
 
993
843
  /**
994
844
  * Gets a document for a given id and places a pessimistic lock on it for mutations
@@ -1004,21 +854,11 @@ class collection
1004
854
  [[nodiscard]] auto get_and_lock(std::string document_id,
1005
855
  std::chrono::seconds lock_duration,
1006
856
  const get_and_lock_options& options = {}) const
1007
- -> std::future<std::pair<key_value_error_context, get_result>>
1008
- {
1009
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
1010
- auto future = barrier->get_future();
1011
- get_and_lock(std::move(document_id), lock_duration, options, [barrier](auto ctx, auto result) {
1012
- barrier->set_value({ std::move(ctx), std::move(result) });
1013
- });
1014
- return future;
1015
- }
857
+ -> std::future<std::pair<key_value_error_context, get_result>>;
1016
858
 
1017
859
  /**
1018
860
  * Unlocks a document if it has been locked previously, with default options.
1019
861
  *
1020
- * @tparam Handler type of the handler that implements @ref unlock_handler
1021
- *
1022
862
  * @param document_id the id of the document
1023
863
  * @param cas the CAS value which is needed to unlock it
1024
864
  * @param options the options to customize
@@ -1032,12 +872,7 @@ class collection
1032
872
  * @since 1.0.0
1033
873
  * @committed
1034
874
  */
1035
- template<typename Handler>
1036
- void unlock(std::string document_id, couchbase::cas cas, const unlock_options& options, Handler&& handler) const
1037
- {
1038
- return core::impl::initiate_unlock_operation(
1039
- core_, bucket_name_, scope_name_, name_, std::move(document_id), cas, options.build(), std::forward<Handler>(handler));
1040
- }
875
+ void unlock(std::string document_id, couchbase::cas cas, const unlock_options& options, unlock_handler&& handler) const;
1041
876
 
1042
877
  /**
1043
878
  * Unlocks a document if it has been locked previously, with default options.
@@ -1056,19 +891,11 @@ class collection
1056
891
  * @committed
1057
892
  */
1058
893
  [[nodiscard]] auto unlock(std::string document_id, couchbase::cas cas, const unlock_options& options = {}) const
1059
- -> std::future<key_value_error_context>
1060
- {
1061
- auto barrier = std::make_shared<std::promise<key_value_error_context>>();
1062
- auto future = barrier->get_future();
1063
- unlock(std::move(document_id), cas, options, [barrier](auto ctx) { barrier->set_value({ std::move(ctx) }); });
1064
- return future;
1065
- }
894
+ -> std::future<key_value_error_context>;
1066
895
 
1067
896
  /**
1068
897
  * Checks if the document exists on the server.
1069
898
  *
1070
- * @tparam Handler type of the handler that implements @ref exists_handler
1071
- *
1072
899
  * @param document_id the id of the document
1073
900
  * @param options the options to customize
1074
901
  * @param handler callable that implements @ref exists_handler
@@ -1079,12 +906,7 @@ class collection
1079
906
  * @since 1.0.0
1080
907
  * @committed
1081
908
  */
1082
- template<typename Handler>
1083
- void exists(std::string document_id, const exists_options& options, Handler&& handler) const
1084
- {
1085
- return core::impl::initiate_exists_operation(
1086
- core_, bucket_name_, scope_name_, name_, std::move(document_id), options.build(), std::forward<Handler>(handler));
1087
- }
909
+ void exists(std::string document_id, const exists_options& options, exists_handler&& handler) const;
1088
910
 
1089
911
  /**
1090
912
  * Checks if the document exists on the server.
@@ -1100,48 +922,16 @@ class collection
1100
922
  * @committed
1101
923
  */
1102
924
  [[nodiscard]] auto exists(std::string document_id, const exists_options& options = {}) const
1103
- -> std::future<std::pair<key_value_error_context, exists_result>>
1104
- {
1105
- auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, exists_result>>>();
1106
- auto future = barrier->get_future();
1107
- exists(std::move(document_id), options, [barrier](auto ctx, auto result) {
1108
- barrier->set_value({ std::move(ctx), std::move(result) });
1109
- });
1110
- return future;
1111
- }
925
+ -> std::future<std::pair<key_value_error_context, exists_result>>;
1112
926
 
1113
- [[nodiscard]] auto query_indexes() const -> collection_query_index_manager
1114
- {
1115
- return collection_query_index_manager(core_, bucket_name_, scope_name_, name_);
1116
- }
927
+ [[nodiscard]] auto query_indexes() const -> collection_query_index_manager;
1117
928
 
1118
929
  private:
1119
930
  friend class bucket;
1120
931
  friend class scope;
1121
932
 
1122
- /**
1123
- * @param core
1124
- * @param bucket_name
1125
- * @param scope_name
1126
- * @param name
1127
- *
1128
- * @since 1.0.0
1129
- * @internal
1130
- */
1131
- collection(std::shared_ptr<couchbase::core::cluster> core,
1132
- std::string_view bucket_name,
1133
- std::string_view scope_name,
1134
- std::string_view name)
1135
- : core_(std::move(core))
1136
- , bucket_name_(bucket_name)
1137
- , scope_name_(scope_name)
1138
- , name_(name)
1139
- {
1140
- }
933
+ collection(core::cluster core, std::string_view bucket_name, std::string_view scope_name, std::string_view name);
1141
934
 
1142
- std::shared_ptr<couchbase::core::cluster> core_;
1143
- std::string bucket_name_;
1144
- std::string scope_name_;
1145
- std::string name_;
935
+ std::shared_ptr<collection_impl> impl_;
1146
936
  };
1147
937
  } // namespace couchbase