couchbase 4.2.11-rc.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) 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/CMakeLists.txt +1 -0
  4. package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -0
  5. package/deps/couchbase-cxx-client/core/bucket.cxx +2 -2
  6. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +51 -5
  7. package/deps/couchbase-cxx-client/core/impl/collection.cxx +224 -209
  8. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +2 -2
  9. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +1 -0
  10. package/deps/couchbase-cxx-client/core/io/dns_client.cxx +4 -0
  11. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +15 -4
  12. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +1 -1
  13. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +95 -53
  14. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
  15. package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +1 -0
  16. package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
  17. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +116 -105
  18. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +116 -108
  19. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +97 -81
  20. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +5 -0
  21. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +141 -0
  22. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +64 -0
  23. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +224 -336
  24. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +5 -6
  25. package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +8 -5
  26. package/deps/couchbase-cxx-client/core/scan_result.hxx +1 -11
  27. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +16 -7
  28. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +578 -483
  29. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +51 -50
  30. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +4 -2
  31. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +6 -6
  32. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +3 -2
  33. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +2 -0
  34. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +5 -1
  35. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +222 -179
  36. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +23 -12
  37. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +61 -24
  38. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +36 -16
  39. package/deps/couchbase-cxx-client/core/transactions/utils.cxx +9 -0
  40. package/deps/couchbase-cxx-client/core/transactions.hxx +40 -7
  41. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +2 -2
  42. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +20 -1
  43. package/deps/couchbase-cxx-client/couchbase/collection.hxx +1 -0
  44. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +1 -1
  45. package/deps/couchbase-cxx-client/couchbase/error_context.hxx +1 -0
  46. package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +39 -0
  47. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +2 -2
  48. package/deps/couchbase-cxx-client/couchbase/scope.hxx +1 -1
  49. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +2 -2
  50. package/deps/couchbase-cxx-client/couchbase/search_result.hxx +1 -1
  51. package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +1 -0
  52. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
  53. package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -0
  54. package/dist/binding.d.ts +8 -0
  55. package/dist/bindingutilities.d.ts +6 -1
  56. package/dist/bindingutilities.js +15 -1
  57. package/dist/bucketmanager.d.ts +0 -12
  58. package/dist/cluster.d.ts +0 -2
  59. package/dist/cluster.js +0 -2
  60. package/dist/collection.d.ts +3 -3
  61. package/dist/collection.js +3 -1
  62. package/dist/querytypes.d.ts +0 -2
  63. package/dist/rangeScan.d.ts +0 -8
  64. package/dist/rangeScan.js +0 -8
  65. package/dist/scope.d.ts +0 -5
  66. package/dist/scope.js +0 -5
  67. package/dist/scopesearchindexmanager.d.ts +0 -2
  68. package/dist/scopesearchindexmanager.js +0 -2
  69. package/dist/searchexecutor.js +3 -1
  70. package/dist/searchtypes.d.ts +16 -6
  71. package/dist/searchtypes.js +2 -6
  72. package/dist/transactions.d.ts +23 -0
  73. package/dist/transactions.js +16 -10
  74. package/dist/vectorsearch.d.ts +8 -8
  75. package/dist/vectorsearch.js +7 -7
  76. package/package.json +7 -7
  77. package/src/instance.cpp +11 -1
  78. package/src/instance.hpp +1 -0
  79. package/src/jstocbpp_autogen.hpp +8 -1
  80. package/src/jstocbpp_transactions.hpp +40 -3
  81. package/src/transactions.cpp +12 -1
  82. package/tools/gen-bindings-json.py +0 -1
  83. package/deps/couchbase-cxx-client/core/scan_options.hxx +0 -44
@@ -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
  }