couchbase 4.2.11 → 4.3.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 (62) hide show
  1. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +49 -2
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  3. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +51 -5
  4. package/deps/couchbase-cxx-client/core/impl/collection.cxx +224 -209
  5. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +2 -2
  6. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +1 -0
  7. package/deps/couchbase-cxx-client/core/io/dns_client.cxx +4 -0
  8. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +15 -4
  9. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +1 -1
  10. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +84 -53
  11. package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +1 -0
  12. package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
  13. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +116 -105
  14. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +116 -108
  15. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +97 -81
  16. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +5 -0
  17. package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +2 -1
  18. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +16 -7
  19. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +578 -483
  20. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +51 -50
  21. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +4 -2
  22. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +6 -6
  23. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +3 -2
  24. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +2 -0
  25. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +5 -1
  26. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +222 -179
  27. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +23 -12
  28. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +61 -24
  29. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +36 -16
  30. package/deps/couchbase-cxx-client/core/transactions/utils.cxx +9 -0
  31. package/deps/couchbase-cxx-client/core/transactions.hxx +40 -7
  32. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +19 -0
  33. package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +39 -0
  34. package/dist/binding.d.ts +8 -0
  35. package/dist/bindingutilities.d.ts +6 -1
  36. package/dist/bindingutilities.js +15 -1
  37. package/dist/bucketmanager.d.ts +0 -12
  38. package/dist/cluster.d.ts +0 -2
  39. package/dist/cluster.js +0 -2
  40. package/dist/collection.d.ts +3 -3
  41. package/dist/collection.js +3 -1
  42. package/dist/querytypes.d.ts +0 -2
  43. package/dist/rangeScan.d.ts +0 -8
  44. package/dist/rangeScan.js +0 -8
  45. package/dist/scope.d.ts +0 -5
  46. package/dist/scope.js +0 -5
  47. package/dist/scopesearchindexmanager.d.ts +0 -2
  48. package/dist/scopesearchindexmanager.js +0 -2
  49. package/dist/searchexecutor.js +3 -1
  50. package/dist/searchtypes.d.ts +16 -6
  51. package/dist/searchtypes.js +2 -6
  52. package/dist/transactions.d.ts +23 -0
  53. package/dist/transactions.js +16 -10
  54. package/dist/vectorsearch.d.ts +8 -8
  55. package/dist/vectorsearch.js +7 -7
  56. package/package.json +7 -7
  57. package/src/instance.cpp +11 -1
  58. package/src/instance.hpp +1 -0
  59. package/src/jstocbpp_autogen.hpp +8 -0
  60. package/src/jstocbpp_transactions.hpp +40 -3
  61. package/src/transactions.cpp +12 -1
  62. package/tools/gen-bindings-json.py +0 -1
@@ -15,79 +15,80 @@
15
15
  */
16
16
 
17
17
  #include "attempt_context_testing_hooks.hxx"
18
+ #include "core/utils/movable_function.hxx"
18
19
 
19
20
  namespace couchbase::core::transactions
20
21
  {
21
22
  namespace
22
23
  {
23
- inline std::optional<error_class>
24
- noop_1(attempt_context*)
24
+ inline void
25
+ noop1(attempt_context*, utils::movable_function<void(std::optional<error_class>)>&& handler)
25
26
  {
26
- return {};
27
+ return handler({});
27
28
  }
28
29
 
29
- inline std::optional<error_class>
30
- noop_2(attempt_context*, const std::string&)
30
+ inline void
31
+ noop2(attempt_context*, const std::string&, utils::movable_function<void(std::optional<error_class>)>&& handler)
31
32
  {
32
- return {};
33
+ return handler({});
33
34
  }
34
35
 
35
36
  inline std::optional<const std::string>
36
- noop_3(attempt_context*)
37
+ noop3(attempt_context*)
37
38
  {
38
39
  return {};
39
40
  }
40
41
 
41
42
  inline bool
42
- noop_4(attempt_context*, const std::string&, std::optional<const std::string>)
43
+ noop4(attempt_context*, const std::string&, std::optional<const std::string>)
43
44
  {
44
45
  return false;
45
46
  }
46
47
  } // namespace
47
48
 
48
49
  attempt_context_testing_hooks::attempt_context_testing_hooks()
49
- : before_atr_commit{ noop_1 }
50
- , before_atr_commit_ambiguity_resolution{ noop_1 }
51
- , after_atr_commit{ noop_1 }
52
- , before_doc_committed{ noop_2 }
53
- , before_removing_doc_during_staged_insert{ noop_2 }
54
- , before_rollback_delete_inserted{ noop_2 }
55
- , after_doc_committed_before_saving_cas{ noop_2 }
56
- , after_doc_committed{ noop_2 }
57
- , before_staged_insert{ noop_2 }
58
- , before_staged_remove{ noop_2 }
59
- , before_staged_replace{ noop_2 }
60
- , before_doc_removed{ noop_2 }
61
- , before_doc_rolled_back{ noop_2 }
62
- , after_doc_removed_pre_retry{ noop_2 }
63
- , after_doc_removed_post_retry{ noop_2 }
64
- , after_get_complete{ noop_2 }
65
- , after_staged_replace_complete_before_cas_saved{ noop_2 }
66
- , after_staged_replace_complete{ noop_2 }
67
- , after_staged_remove_complete{ noop_2 }
68
- , after_staged_insert_complete{ noop_2 }
69
- , after_rollback_replace_or_remove{ noop_2 }
70
- , after_rollback_delete_inserted{ noop_2 }
71
- , before_check_atr_entry_for_blocking_doc{ noop_2 }
72
- , before_doc_get{ noop_2 }
73
- , before_get_doc_in_exists_during_staged_insert{ noop_2 }
74
- , before_query{ noop_2 }
75
- , after_query{ noop_2 }
76
- , before_remove_staged_insert{ noop_2 }
77
- , after_remove_staged_insert{ noop_2 }
78
- , after_docs_committed{ noop_1 }
79
- , after_docs_removed{ noop_1 }
80
- , after_atr_pending{ noop_1 }
81
- , before_atr_pending{ noop_1 }
82
- , before_atr_complete{ noop_1 }
83
- , before_atr_rolled_back{ noop_1 }
84
- , after_atr_complete{ noop_1 }
85
- , before_get_atr_for_abort{ noop_1 }
86
- , before_atr_aborted{ noop_1 }
87
- , after_atr_aborted{ noop_1 }
88
- , after_atr_rolled_back{ noop_1 }
89
- , random_atr_id_for_vbucket{ noop_3 }
90
- , has_expired_client_side{ noop_4 }
50
+ : before_atr_commit{ noop1 }
51
+ , before_atr_commit_ambiguity_resolution{ noop1 }
52
+ , after_atr_commit{ noop1 }
53
+ , before_doc_committed{ noop2 }
54
+ , before_removing_doc_during_staged_insert{ noop2 }
55
+ , before_rollback_delete_inserted{ noop2 }
56
+ , after_doc_committed_before_saving_cas{ noop2 }
57
+ , after_doc_committed{ noop2 }
58
+ , before_staged_insert{ noop2 }
59
+ , before_staged_remove{ noop2 }
60
+ , before_staged_replace{ noop2 }
61
+ , before_doc_removed{ noop2 }
62
+ , before_doc_rolled_back{ noop2 }
63
+ , after_doc_removed_pre_retry{ noop2 }
64
+ , after_doc_removed_post_retry{ noop2 }
65
+ , after_get_complete{ noop2 }
66
+ , after_staged_replace_complete_before_cas_saved{ noop2 }
67
+ , after_staged_replace_complete{ noop2 }
68
+ , after_staged_remove_complete{ noop2 }
69
+ , after_staged_insert_complete{ noop2 }
70
+ , after_rollback_replace_or_remove{ noop2 }
71
+ , after_rollback_delete_inserted{ noop2 }
72
+ , before_check_atr_entry_for_blocking_doc{ noop2 }
73
+ , before_doc_get{ noop2 }
74
+ , before_get_doc_in_exists_during_staged_insert{ noop2 }
75
+ , before_query{ noop2 }
76
+ , after_query{ noop2 }
77
+ , before_remove_staged_insert{ noop2 }
78
+ , after_remove_staged_insert{ noop2 }
79
+ , after_docs_committed{ noop1 }
80
+ , after_docs_removed{ noop1 }
81
+ , after_atr_pending{ noop1 }
82
+ , before_atr_pending{ noop1 }
83
+ , before_atr_complete{ noop1 }
84
+ , before_atr_rolled_back{ noop1 }
85
+ , after_atr_complete{ noop1 }
86
+ , before_get_atr_for_abort{ noop1 }
87
+ , before_atr_aborted{ noop1 }
88
+ , after_atr_aborted{ noop1 }
89
+ , after_atr_rolled_back{ noop1 }
90
+ , random_atr_id_for_vbucket{ noop3 }
91
+ , has_expired_client_side{ noop4 }
91
92
  {
92
93
  }
93
94
  } // namespace couchbase::core::transactions
@@ -16,6 +16,7 @@
16
16
  #pragma once
17
17
 
18
18
  #include "core/transactions/error_class.hxx"
19
+ #include "core/utils/movable_function.hxx"
19
20
 
20
21
  #include <functional>
21
22
  #include <optional>
@@ -25,8 +26,9 @@ namespace couchbase::core::transactions
25
26
  {
26
27
  class attempt_context;
27
28
 
28
- using error_func1 = std::function<std::optional<error_class>(attempt_context*)>;
29
- using error_func2 = std::function<std::optional<error_class>(attempt_context*, const std::string&)>;
29
+ using error_func1 = std::function<void(attempt_context*, core::utils::movable_function<void(std::optional<error_class>)>&&)>;
30
+ using error_func2 =
31
+ std::function<void(attempt_context*, const std::string&, core::utils::movable_function<void(std::optional<error_class>)>&&)>;
30
32
 
31
33
  static const std::string STAGE_ROLLBACK = "rollback";
32
34
  static const std::string STAGE_GET = "get";
@@ -20,16 +20,16 @@ namespace couchbase::core::transactions
20
20
  {
21
21
  namespace
22
22
  {
23
- inline std::optional<couchbase::core::transactions::error_class>
24
- noop1(const std::string&)
23
+ inline void
24
+ noop1(const std::string&, utils::movable_function<void(std::optional<error_class>)>&& handler)
25
25
  {
26
- return {};
26
+ return handler({});
27
27
  }
28
28
 
29
- inline std::optional<couchbase::core::transactions::error_class>
30
- noop2()
29
+ inline void
30
+ noop2(utils::movable_function<void(std::optional<error_class>)>&& handler)
31
31
  {
32
- return {};
32
+ return handler({});
33
33
  }
34
34
  } // namespace
35
35
 
@@ -16,6 +16,7 @@
16
16
  #pragma once
17
17
 
18
18
  #include "core/transactions/error_class.hxx"
19
+ #include "core/utils/movable_function.hxx"
19
20
 
20
21
  #include <functional>
21
22
  #include <optional>
@@ -23,8 +24,8 @@
23
24
 
24
25
  namespace couchbase::core::transactions
25
26
  {
26
- using error_func3 = std::function<std::optional<error_class>(const std::string&)>;
27
- using error_func4 = std::function<std::optional<error_class>(void)>;
27
+ using error_func3 = std::function<void(const std::string&, core::utils::movable_function<void(std::optional<error_class>)>&&)>;
28
+ using error_func4 = std::function<void(core::utils::movable_function<void(std::optional<error_class>)>&&)>;
28
29
 
29
30
  /**
30
31
  * Hooks purely for testing purposes. If you're an end-user looking at these for any reason, then please contact us first
@@ -127,6 +127,8 @@ class transactions_cleanup
127
127
  const atr_cleanup_stats force_cleanup_atr(const core::document_id& atr_id, std::vector<transactions_cleanup_attempt>& results);
128
128
  const client_record_details get_active_clients(const couchbase::transactions::transaction_keyspace& keyspace, const std::string& uuid);
129
129
  void remove_client_record_from_all_buckets(const std::string& uuid);
130
+ void start();
131
+ void stop();
130
132
  void close();
131
133
 
132
134
  private:
@@ -26,6 +26,7 @@
26
26
  #include <functional>
27
27
  #include <future>
28
28
  #include <limits>
29
+ #include <optional>
29
30
  #include <random>
30
31
  #include <string>
31
32
  #include <thread>
@@ -79,6 +80,9 @@ validate_operation_result(result& res, bool ignore_subdoc_errors = true);
79
80
  result
80
81
  wrap_operation_future(std::future<result>& fut, bool ignore_subdoc_errors = true);
81
82
 
83
+ std::optional<error_class>
84
+ wait_for_hook(std::function<void(utils::movable_function<void(std::optional<error_class>)>)> hook);
85
+
82
86
  inline void
83
87
  wrap_collection_call(result& res, std::function<void(result&)> call);
84
88
 
@@ -326,7 +330,7 @@ struct async_exp_delay {
326
330
 
327
331
  void operator()(utils::movable_function<void(std::exception_ptr)> callback) const
328
332
  {
329
- if (retries >= max_retries) {
333
+ if (retries++ >= max_retries) {
330
334
  callback(std::make_exception_ptr(retry_operation_retries_exhausted("retries exhausted")));
331
335
  return;
332
336
  }