couchbase 4.2.9 → 4.2.11-rc.1
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.
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +67 -2
- package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +65 -1
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
- package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
- package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
- package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
- package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
- package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +7 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +10 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -0
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +26 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +8 -3
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +7 -6
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +24 -13
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +14 -0
- package/deps/couchbase-cxx-client/core/origin.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +70 -1
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
- package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +1 -34
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +43 -20
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +5 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +4 -0
- package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
- package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
- package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
- package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
- package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
- package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
- package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
- package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
- package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
- package/dist/binding.d.ts +33 -2
- package/dist/binding.js +4 -1
- package/dist/bindingutilities.d.ts +16 -3
- package/dist/bindingutilities.js +47 -7
- package/dist/cluster.d.ts +12 -1
- package/dist/cluster.js +22 -0
- package/dist/couchbase.d.ts +2 -0
- package/dist/couchbase.js +2 -0
- package/dist/queryindexmanager.d.ts +4 -4
- package/dist/queryindexmanager.js +7 -7
- package/dist/scope.d.ts +21 -0
- package/dist/scope.js +34 -0
- package/dist/scopesearchindexmanager.d.ts +116 -0
- package/dist/scopesearchindexmanager.js +406 -0
- package/dist/sdspecs.js +10 -9
- package/dist/sdutils.d.ts +1 -0
- package/dist/sdutils.js +4 -0
- package/dist/searchexecutor.d.ts +5 -3
- package/dist/searchexecutor.js +27 -4
- package/dist/searchindexmanager.d.ts +58 -3
- package/dist/searchindexmanager.js +188 -104
- package/dist/searchtypes.d.ts +46 -0
- package/dist/searchtypes.js +81 -1
- package/dist/vectorsearch.d.ts +99 -0
- package/dist/vectorsearch.js +132 -0
- package/dist/viewexecutor.js +13 -9
- package/dist/viewindexmanager.d.ts +70 -7
- package/dist/viewindexmanager.js +236 -103
- package/dist/viewtypes.d.ts +26 -0
- package/dist/viewtypes.js +17 -1
- package/package.json +7 -7
- package/src/constants.cpp +12 -0
- package/src/jstocbpp_autogen.hpp +113 -13
- package/tools/gen-bindings-json.py +2 -0
|
@@ -121,6 +121,7 @@ set(couchbase_cxx_client_FILES
|
|
|
121
121
|
core/impl/date_range_facet.cxx
|
|
122
122
|
core/impl/date_range_facet_result.cxx
|
|
123
123
|
core/impl/date_range_query.cxx
|
|
124
|
+
core/impl/diagnostics.cxx
|
|
124
125
|
core/impl/disjunction_query.cxx
|
|
125
126
|
core/impl/dns_srv_tracker.cxx
|
|
126
127
|
core/impl/doc_id_query.cxx
|
|
@@ -173,6 +174,7 @@ set(couchbase_cxx_client_FILES
|
|
|
173
174
|
core/impl/search_index_manager.cxx
|
|
174
175
|
core/impl/search_meta_data.cxx
|
|
175
176
|
core/impl/search_result.cxx
|
|
177
|
+
core/impl/search_request.cxx
|
|
176
178
|
core/impl/search_row.cxx
|
|
177
179
|
core/impl/search_row_location.cxx
|
|
178
180
|
core/impl/search_row_locations.cxx
|
|
@@ -205,6 +207,8 @@ set(couchbase_cxx_client_FILES
|
|
|
205
207
|
core/impl/transaction_error_category.cxx
|
|
206
208
|
core/impl/transaction_get_result.cxx
|
|
207
209
|
core/impl/transaction_op_error_category.cxx
|
|
210
|
+
core/impl/vector_query.cxx
|
|
211
|
+
core/impl/vector_search.cxx
|
|
208
212
|
core/impl/view_error_category.cxx
|
|
209
213
|
core/impl/wildcard_query.cxx
|
|
210
214
|
core/io/dns_client.cxx
|
|
@@ -67,9 +67,13 @@ function(set_project_warnings project_name)
|
|
|
67
67
|
-Wuseless-cast # warn if you perform a cast to the same type
|
|
68
68
|
-Wdeprecated-declarations # warn if [[deprecated]] elements being used
|
|
69
69
|
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
70
|
+
|
|
71
|
+
set(CLANG_WARNINGS ${COMMON_WARNINGS})
|
|
72
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL "17.0.0")
|
|
73
|
+
set(CLANG_WARNINGS ${CLANG_WARNINGS} -Wshadow # warn the user if a variable declaration shadows one from a parent
|
|
74
|
+
# context
|
|
75
|
+
)
|
|
76
|
+
endif()
|
|
73
77
|
|
|
74
78
|
if(MSVC)
|
|
75
79
|
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
#include "mcbp/queue_response.hxx"
|
|
29
29
|
#include "origin.hxx"
|
|
30
30
|
#include "ping_collector.hxx"
|
|
31
|
+
#include "protocol/cmd_get_cluster_config.hxx"
|
|
31
32
|
#include "retry_orchestrator.hxx"
|
|
32
33
|
|
|
33
34
|
#include <couchbase/metrics/meter.hxx>
|
|
@@ -67,6 +68,10 @@ class bucket_impl
|
|
|
67
68
|
, codec_{ { known_features_.begin(), known_features_.end() } }
|
|
68
69
|
, ctx_{ ctx }
|
|
69
70
|
, tls_{ tls }
|
|
71
|
+
, heartbeat_timer_(ctx_)
|
|
72
|
+
, heartbeat_interval_{ origin_.options().config_poll_floor > origin_.options().config_poll_interval
|
|
73
|
+
? origin_.options().config_poll_floor
|
|
74
|
+
: origin_.options().config_poll_interval }
|
|
70
75
|
{
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -421,6 +426,7 @@ class bucket_impl
|
|
|
421
426
|
}
|
|
422
427
|
self->update_config(cfg);
|
|
423
428
|
self->drain_deferred_queue();
|
|
429
|
+
self->poll_config({});
|
|
424
430
|
}
|
|
425
431
|
asio::post(asio::bind_executor(self->ctx_, [h = std::move(h), ec, cfg = std::move(cfg)]() mutable { h(ec, cfg); }));
|
|
426
432
|
});
|
|
@@ -476,12 +482,61 @@ class bucket_impl
|
|
|
476
482
|
}
|
|
477
483
|
}
|
|
478
484
|
|
|
479
|
-
void
|
|
485
|
+
void fetch_config()
|
|
480
486
|
{
|
|
481
487
|
if (closed_) {
|
|
482
488
|
return;
|
|
483
489
|
}
|
|
484
|
-
|
|
490
|
+
std::optional<io::mcbp_session> session{};
|
|
491
|
+
{
|
|
492
|
+
std::scoped_lock lock(sessions_mutex_);
|
|
493
|
+
|
|
494
|
+
std::size_t start = heartbeat_next_index_.fetch_add(1);
|
|
495
|
+
std::size_t i = start;
|
|
496
|
+
do {
|
|
497
|
+
auto ptr = sessions_.find(i % sessions_.size());
|
|
498
|
+
if (ptr != sessions_.end() && ptr->second.supports_gcccp()) {
|
|
499
|
+
session = ptr->second;
|
|
500
|
+
}
|
|
501
|
+
i = heartbeat_next_index_.fetch_add(1);
|
|
502
|
+
} while (start % sessions_.size() != i % sessions_.size());
|
|
503
|
+
}
|
|
504
|
+
if (session) {
|
|
505
|
+
protocol::client_request<protocol::get_cluster_config_request_body> req;
|
|
506
|
+
req.opaque(session->next_opaque());
|
|
507
|
+
session->write_and_flush(req.data());
|
|
508
|
+
} else {
|
|
509
|
+
CB_LOG_WARNING(R"({} unable to find session with GCCCP support, retry in {})", log_prefix_, heartbeat_interval_);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
void poll_config(std::error_code ec)
|
|
514
|
+
{
|
|
515
|
+
if (ec == asio::error::operation_aborted || closed_) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
if (heartbeat_timer_.expiry() > std::chrono::steady_clock::now()) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
fetch_config();
|
|
523
|
+
|
|
524
|
+
heartbeat_timer_.expires_after(heartbeat_interval_);
|
|
525
|
+
return heartbeat_timer_.async_wait([self = shared_from_this()](std::error_code e) {
|
|
526
|
+
if (e == asio::error::operation_aborted) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
self->poll_config(e);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
void close()
|
|
534
|
+
{
|
|
535
|
+
if (bool expected_state{ false }; !closed_.compare_exchange_strong(expected_state, true)) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
heartbeat_timer_.cancel();
|
|
485
540
|
|
|
486
541
|
drain_deferred_queue();
|
|
487
542
|
|
|
@@ -773,6 +828,10 @@ class bucket_impl
|
|
|
773
828
|
asio::io_context& ctx_;
|
|
774
829
|
asio::ssl::context& tls_;
|
|
775
830
|
|
|
831
|
+
asio::steady_timer heartbeat_timer_;
|
|
832
|
+
std::chrono::milliseconds heartbeat_interval_;
|
|
833
|
+
std::atomic_size_t heartbeat_next_index_{ 0 };
|
|
834
|
+
|
|
776
835
|
std::atomic_bool closed_{ false };
|
|
777
836
|
std::atomic_bool configured_{ false };
|
|
778
837
|
|
|
@@ -830,6 +889,12 @@ bucket::ping(std::shared_ptr<diag::ping_collector> collector, std::optional<std:
|
|
|
830
889
|
return impl_->ping(std::move(collector), std::move(timeout));
|
|
831
890
|
}
|
|
832
891
|
|
|
892
|
+
void
|
|
893
|
+
bucket::fetch_config()
|
|
894
|
+
{
|
|
895
|
+
return impl_->fetch_config();
|
|
896
|
+
}
|
|
897
|
+
|
|
833
898
|
void
|
|
834
899
|
bucket::update_config(topology::configuration config)
|
|
835
900
|
{
|
|
@@ -151,7 +151,7 @@ class bucket
|
|
|
151
151
|
}
|
|
152
152
|
cmd->last_dispatched_from_ = session->local_address();
|
|
153
153
|
cmd->last_dispatched_to_ = session->bootstrap_address();
|
|
154
|
-
CB_LOG_TRACE(R"(
|
|
154
|
+
CB_LOG_TRACE(R"({} send operation id="{}", key="{}", partition={}, index={}, address="{}", rev={})",
|
|
155
155
|
session->log_prefix(),
|
|
156
156
|
cmd->id_,
|
|
157
157
|
cmd->request.id,
|
|
@@ -177,6 +177,7 @@ class bucket
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
void fetch_config();
|
|
180
181
|
void update_config(topology::configuration config) override;
|
|
181
182
|
void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& handler);
|
|
182
183
|
void with_configuration(utils::movable_function<void(std::error_code, topology::configuration)>&& handler);
|
|
@@ -114,6 +114,26 @@ class ping_collector_impl
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
template<typename Request>
|
|
118
|
+
constexpr bool
|
|
119
|
+
is_feature_supported(const Request& /* request */, const configuration_capabilities& /* capabilities */)
|
|
120
|
+
{
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
constexpr bool
|
|
125
|
+
is_feature_supported(const operations::search_request& request, const configuration_capabilities& capabilities)
|
|
126
|
+
{
|
|
127
|
+
if (request.scope_name && !capabilities.supports_scoped_search_indexes()) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (request.vector_search && !capabilities.supports_vector_search()) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
117
137
|
class cluster_impl : public std::enable_shared_from_this<cluster_impl>
|
|
118
138
|
{
|
|
119
139
|
public:
|
|
@@ -238,10 +258,14 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl>
|
|
|
238
258
|
auto ptr = buckets_.find(bucket_name);
|
|
239
259
|
if (ptr == buckets_.end()) {
|
|
240
260
|
std::vector<protocol::hello_feature> known_features;
|
|
261
|
+
|
|
262
|
+
auto origin = origin_;
|
|
241
263
|
if (session_ && session_->has_config()) {
|
|
242
264
|
known_features = session_->supported_features();
|
|
265
|
+
origin = { origin_, session_->config().value() };
|
|
243
266
|
}
|
|
244
|
-
|
|
267
|
+
|
|
268
|
+
b = std::make_shared<bucket>(id_, ctx_, tls_, tracer_, meter_, bucket_name, origin, known_features, dns_srv_tracker_);
|
|
245
269
|
buckets_.try_emplace(bucket_name, b);
|
|
246
270
|
}
|
|
247
271
|
}
|
|
@@ -326,6 +350,9 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl>
|
|
|
326
350
|
if (stopped_) {
|
|
327
351
|
return handler(request.make_response({ errc::network::cluster_closed }, response_type{}));
|
|
328
352
|
}
|
|
353
|
+
if (!is_feature_supported(request, session_manager_->configuration_capabilities())) {
|
|
354
|
+
return handler(request.make_response({ errc::common::feature_not_available }, response_type{}));
|
|
355
|
+
}
|
|
329
356
|
if constexpr (operations::is_compound_operation_v<Request>) {
|
|
330
357
|
return request.execute(shared_from_this(), std::forward<Handler>(handler));
|
|
331
358
|
} else {
|
|
@@ -333,6 +360,37 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl>
|
|
|
333
360
|
}
|
|
334
361
|
}
|
|
335
362
|
|
|
363
|
+
template<class Request,
|
|
364
|
+
class Handler,
|
|
365
|
+
typename std::enable_if_t<std::is_same_v<typename Request::encoded_request_type, io::http_request>, int> = 0>
|
|
366
|
+
void execute_with_bucket_capability_check(Request request, bucket_capability cap, Handler&& handler)
|
|
367
|
+
{
|
|
368
|
+
auto bucket_name = request.bucket_name;
|
|
369
|
+
return open_bucket(
|
|
370
|
+
bucket_name,
|
|
371
|
+
[self = shared_from_this(), bucket_name, cap, request = std::move(request), handler = std::forward<Handler>(handler)](
|
|
372
|
+
std::error_code ec) mutable {
|
|
373
|
+
if (ec) {
|
|
374
|
+
handler(request.make_response({ ec }, {}));
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
return self->with_bucket_configuration(
|
|
378
|
+
bucket_name,
|
|
379
|
+
[self = std::move(self), cap, request = std::move(request), handler = std::forward<Handler>(handler)](
|
|
380
|
+
std::error_code ec, topology::configuration config) mutable {
|
|
381
|
+
if (ec) {
|
|
382
|
+
handler(request.make_response({ ec }, {}));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (!config.capabilities.has_bucket_capability(cap)) {
|
|
386
|
+
handler(request.make_response({ errc::common::feature_not_available }, {}));
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
return self->execute(std::move(request), std::forward<Handler>(handler));
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
336
394
|
std::shared_ptr<bucket> find_bucket_by_name(const std::string& name)
|
|
337
395
|
{
|
|
338
396
|
std::scoped_lock lock(buckets_mutex_);
|
|
@@ -1074,6 +1132,9 @@ void
|
|
|
1074
1132
|
cluster::execute(operations::management::collection_create_request request,
|
|
1075
1133
|
utils::movable_function<void(operations::management::collection_create_response)>&& handler) const
|
|
1076
1134
|
{
|
|
1135
|
+
if (request.history.has_value()) {
|
|
1136
|
+
return impl_->execute_with_bucket_capability_check(std::move(request), bucket_capability::non_deduped_history, std::move(handler));
|
|
1137
|
+
}
|
|
1077
1138
|
return impl_->execute(std::move(request), std::move(handler));
|
|
1078
1139
|
}
|
|
1079
1140
|
|
|
@@ -1081,6 +1142,9 @@ void
|
|
|
1081
1142
|
cluster::execute(operations::management::collection_update_request request,
|
|
1082
1143
|
utils::movable_function<void(operations::management::collection_update_response)>&& handler) const
|
|
1083
1144
|
{
|
|
1145
|
+
if (request.history.has_value()) {
|
|
1146
|
+
return impl_->execute_with_bucket_capability_check(std::move(request), bucket_capability::non_deduped_history, std::move(handler));
|
|
1147
|
+
}
|
|
1084
1148
|
return impl_->execute(std::move(request), std::move(handler));
|
|
1085
1149
|
}
|
|
1086
1150
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
#include "core/cluster.hxx"
|
|
19
|
+
#include "diagnostics.hxx"
|
|
19
20
|
|
|
20
21
|
#include <couchbase/bucket.hxx>
|
|
21
22
|
|
|
@@ -42,6 +43,15 @@ class bucket_impl : public std::enable_shared_from_this<bucket_impl>
|
|
|
42
43
|
return core_;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
void ping(const ping_options::built& options, ping_handler&& handler) const
|
|
47
|
+
{
|
|
48
|
+
return core_.ping(options.report_id,
|
|
49
|
+
name_,
|
|
50
|
+
core::impl::to_core_service_types(options.service_types),
|
|
51
|
+
options.timeout,
|
|
52
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(core::impl::build_result(resp)); });
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
private:
|
|
46
56
|
core::cluster core_;
|
|
47
57
|
std::string name_;
|
|
@@ -70,6 +80,20 @@ bucket::scope(std::string_view scope_name) const -> couchbase::scope
|
|
|
70
80
|
return { impl_->core(), impl_->name(), scope_name };
|
|
71
81
|
}
|
|
72
82
|
|
|
83
|
+
void
|
|
84
|
+
bucket::ping(const couchbase::ping_options& options, couchbase::ping_handler&& handler) const
|
|
85
|
+
{
|
|
86
|
+
return impl_->ping(options.build(), std::move(handler));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
auto
|
|
90
|
+
bucket::ping(const couchbase::ping_options& options) const -> std::future<ping_result>
|
|
91
|
+
{
|
|
92
|
+
auto barrier = std::make_shared<std::promise<ping_result>>();
|
|
93
|
+
ping(options, [barrier](auto result) mutable { barrier->set_value(std::move(result)); });
|
|
94
|
+
return barrier->get_future();
|
|
95
|
+
}
|
|
96
|
+
|
|
73
97
|
auto
|
|
74
98
|
bucket::collections() const -> collection_manager
|
|
75
99
|
{
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#include "core/agent_group.hxx"
|
|
22
22
|
#include "core/transactions.hxx"
|
|
23
23
|
#include "core/utils/connection_string.hxx"
|
|
24
|
+
#include "diagnostics.hxx"
|
|
24
25
|
#include "internal_search_error_context.hxx"
|
|
25
26
|
#include "internal_search_meta_data.hxx"
|
|
26
27
|
#include "internal_search_result.hxx"
|
|
@@ -186,6 +187,33 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl>
|
|
|
186
187
|
});
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
void ping(const ping_options::built& options, ping_handler&& handler) const
|
|
191
|
+
{
|
|
192
|
+
return core_.ping(options.report_id,
|
|
193
|
+
{},
|
|
194
|
+
core::impl::to_core_service_types(options.service_types),
|
|
195
|
+
options.timeout,
|
|
196
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(core::impl::build_result(resp)); });
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
void diagnostics(const diagnostics_options::built& options, diagnostics_handler&& handler) const
|
|
200
|
+
{
|
|
201
|
+
return core_.diagnostics(options.report_id,
|
|
202
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(core::impl::build_result(resp)); });
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
void search(std::string index_name,
|
|
206
|
+
couchbase::search_request request,
|
|
207
|
+
const search_options::built& options,
|
|
208
|
+
search_handler&& handler) const
|
|
209
|
+
{
|
|
210
|
+
return core_.execute(core::impl::build_search_request(std::move(index_name), std::move(request), options, {}, {}),
|
|
211
|
+
[handler = std::move(handler)](auto resp) mutable {
|
|
212
|
+
return handler(search_error_context{ internal_search_error_context{ resp } },
|
|
213
|
+
search_result{ internal_search_result{ resp } });
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
189
217
|
void close(core::utils::movable_function<void()> handler)
|
|
190
218
|
{
|
|
191
219
|
if (transactions_) {
|
|
@@ -283,6 +311,51 @@ cluster::search_query(std::string index_name, const class search_query& query, c
|
|
|
283
311
|
return barrier->get_future();
|
|
284
312
|
}
|
|
285
313
|
|
|
314
|
+
void
|
|
315
|
+
cluster::ping(const couchbase::ping_options& options, couchbase::ping_handler&& handler) const
|
|
316
|
+
{
|
|
317
|
+
return impl_->ping(options.build(), std::move(handler));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
auto
|
|
321
|
+
cluster::ping(const couchbase::ping_options& options) const -> std::future<ping_result>
|
|
322
|
+
{
|
|
323
|
+
auto barrier = std::make_shared<std::promise<ping_result>>();
|
|
324
|
+
ping(options, [barrier](auto result) mutable { barrier->set_value(std::move(result)); });
|
|
325
|
+
return barrier->get_future();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
void
|
|
329
|
+
cluster::diagnostics(const couchbase::diagnostics_options& options, couchbase::diagnostics_handler&& handler) const
|
|
330
|
+
{
|
|
331
|
+
return impl_->diagnostics(options.build(), std::move(handler));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
auto
|
|
335
|
+
cluster::diagnostics(const couchbase::diagnostics_options& options) const -> std::future<diagnostics_result>
|
|
336
|
+
{
|
|
337
|
+
auto barrier = std::make_shared<std::promise<diagnostics_result>>();
|
|
338
|
+
diagnostics(options, [barrier](auto result) mutable { barrier->set_value(std::move(result)); });
|
|
339
|
+
return barrier->get_future();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
void
|
|
343
|
+
cluster::search(std::string index_name, search_request request, const search_options& options, search_handler&& handler) const
|
|
344
|
+
{
|
|
345
|
+
return impl_->search(std::move(index_name), std::move(request), options.build(), std::move(handler));
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
auto
|
|
349
|
+
cluster::search(std::string index_name, search_request request, const search_options& options) const
|
|
350
|
+
-> std::future<std::pair<search_error_context, search_result>>
|
|
351
|
+
{
|
|
352
|
+
auto barrier = std::make_shared<std::promise<std::pair<search_error_context, search_result>>>();
|
|
353
|
+
search(std::move(index_name), std::move(request), options, [barrier](auto ctx, auto result) mutable {
|
|
354
|
+
barrier->set_value(std::make_pair(std::move(ctx), std::move(result)));
|
|
355
|
+
});
|
|
356
|
+
return barrier->get_future();
|
|
357
|
+
}
|
|
358
|
+
|
|
286
359
|
auto
|
|
287
360
|
cluster::connect(asio::io_context& io, const std::string& connection_string, const cluster_options& options)
|
|
288
361
|
-> std::future<std::pair<cluster, std::error_code>>
|
|
@@ -479,7 +479,7 @@ class collection_impl : public std::enable_shared_from_this<collection_impl>
|
|
|
479
479
|
bucket_name_,
|
|
480
480
|
[core = core_, r = std::move(request), h = std::move(handler)](std::error_code ec,
|
|
481
481
|
const core::topology::configuration& config) mutable {
|
|
482
|
-
if (!config.supports_subdoc_read_replica()) {
|
|
482
|
+
if (!config.capabilities.supports_subdoc_read_replica()) {
|
|
483
483
|
ec = errc::common::feature_not_available;
|
|
484
484
|
}
|
|
485
485
|
|
|
@@ -601,7 +601,7 @@ class collection_impl : public std::enable_shared_from_this<collection_impl>
|
|
|
601
601
|
bucket_name_,
|
|
602
602
|
[core = core_, r = std::move(request), h = std::move(handler)](std::error_code ec,
|
|
603
603
|
const core::topology::configuration& config) mutable {
|
|
604
|
-
if (!config.supports_subdoc_read_replica()) {
|
|
604
|
+
if (!config.capabilities.supports_subdoc_read_replica()) {
|
|
605
605
|
ec = errc::common::feature_not_available;
|
|
606
606
|
}
|
|
607
607
|
if (r->specs().size() > 16) {
|