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
@@ -0,0 +1,64 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2024. Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #include "core/logger/logger.hxx"
19
+ #include "core/topology/configuration.hxx"
20
+
21
+ #include <mutex>
22
+ #include <queue>
23
+
24
+ namespace couchbase::core
25
+ {
26
+ class range_scan_node_state
27
+ {
28
+ public:
29
+ range_scan_node_state(std::queue<std::uint16_t> vbuckets);
30
+
31
+ auto fetch_vbucket_id() -> std::optional<std::uint16_t>;
32
+ void notify_stream_ended();
33
+ void enqueue_vbucket(std::uint16_t vbucket_id);
34
+ auto active_stream_count() -> std::uint16_t;
35
+ auto pending_vbucket_count() -> std::size_t;
36
+
37
+ private:
38
+ std::uint16_t active_stream_count_{ 0 };
39
+ std::queue<std::uint16_t> pending_vbuckets_{};
40
+ std::mutex mutex_{};
41
+ };
42
+
43
+ class range_scan_load_balancer
44
+ {
45
+ public:
46
+ range_scan_load_balancer(const topology::configuration::vbucket_map& vbucket_map, std::optional<std::uint64_t> seed = {});
47
+
48
+ void seed(std::uint64_t seed);
49
+
50
+ /**
51
+ * Returns the ID of a vbucket that corresponds to the node with the lowest number of active streams.
52
+ * Returns "std::nullopt" if there are no pending vbuckets
53
+ */
54
+ auto select_vbucket() -> std::optional<std::uint16_t>;
55
+
56
+ void notify_stream_ended(std::int16_t node_id);
57
+ void enqueue_vbucket(std::int16_t node_id, std::uint16_t vbucket_id);
58
+
59
+ private:
60
+ std::map<std::int16_t, range_scan_node_state> nodes_{};
61
+ std::mutex select_vbucket_mutex_{};
62
+ std::optional<std::uint64_t> seed_{};
63
+ };
64
+ } // namespace couchbase::core