couchbase 4.2.9 → 4.2.11-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -160,7 +160,7 @@ struct fmt::formatter<couchbase::core::topology::configuration> {
|
|
160
160
|
config.vbmap.has_value() ? fmt::format(", partitions={}", config.vbmap->size()) : "",
|
161
161
|
config.nodes.size(),
|
162
162
|
couchbase::core::utils::join_strings_fmt(config.nodes, ", "),
|
163
|
-
couchbase::core::utils::join_strings_fmt(config.
|
164
|
-
couchbase::core::utils::join_strings_fmt(config.
|
163
|
+
couchbase::core::utils::join_strings_fmt(config.capabilities.bucket, ", "),
|
164
|
+
couchbase::core::utils::join_strings_fmt(config.capabilities.cluster, ", "));
|
165
165
|
}
|
166
166
|
};
|
@@ -213,33 +213,47 @@ struct traits<couchbase::core::topology::configuration> {
|
|
213
213
|
for (const auto& entry : m->get_array()) {
|
214
214
|
const auto& name = entry.get_string();
|
215
215
|
if (name == "couchapi") {
|
216
|
-
result.
|
216
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::couchapi);
|
217
217
|
} else if (name == "collections") {
|
218
|
-
result.
|
218
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::collections);
|
219
219
|
} else if (name == "durableWrite") {
|
220
|
-
result.
|
220
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::durable_write);
|
221
221
|
} else if (name == "tombstonedUserXAttrs") {
|
222
|
-
result.
|
222
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::tombstoned_user_xattrs);
|
223
223
|
} else if (name == "dcp") {
|
224
|
-
result.
|
224
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::dcp);
|
225
225
|
} else if (name == "cbhello") {
|
226
|
-
result.
|
226
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::cbhello);
|
227
227
|
} else if (name == "touch") {
|
228
|
-
result.
|
228
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::touch);
|
229
229
|
} else if (name == "cccp") {
|
230
|
-
result.
|
230
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::cccp);
|
231
231
|
} else if (name == "xdcrCheckpointing") {
|
232
|
-
result.
|
232
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::xdcr_checkpointing);
|
233
233
|
} else if (name == "nodesExt") {
|
234
|
-
result.
|
234
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::nodes_ext);
|
235
235
|
} else if (name == "xattr") {
|
236
|
-
result.
|
236
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::xattr);
|
237
237
|
} else if (name == "rangeScan") {
|
238
|
-
result.
|
238
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::range_scan);
|
239
239
|
} else if (name == "subdoc.ReplicaRead") {
|
240
|
-
result.
|
240
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::subdoc_replica_read);
|
241
241
|
} else if (name == "nonDedupedHistory") {
|
242
|
-
result.
|
242
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::non_deduped_history);
|
243
|
+
} else if (name == "subdoc.ReplaceBodyWithXattr") {
|
244
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::subdoc_replace_body_with_xattr);
|
245
|
+
} else if (name == "subdoc.DocumentMacroSupport") {
|
246
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::subdoc_document_macro_support);
|
247
|
+
} else if (name == "subdoc.ReviveDocument") {
|
248
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::subdoc_revive_document);
|
249
|
+
} else if (name == "dcp.IgnorePurgedTombstones") {
|
250
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::dcp_ignore_purged_tombstones);
|
251
|
+
} else if (name == "preserve_expiry") {
|
252
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::preserve_expiry);
|
253
|
+
} else if (name == "querySystemCollection") {
|
254
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::query_system_collection);
|
255
|
+
} else if (name == "mobileSystemCollection") {
|
256
|
+
result.capabilities.bucket.insert(couchbase::core::bucket_capability::mobile_system_collection);
|
243
257
|
}
|
244
258
|
}
|
245
259
|
}
|
@@ -247,17 +261,26 @@ struct traits<couchbase::core::topology::configuration> {
|
|
247
261
|
if (const auto nc = m->find("n1ql"); nc != nullptr && nc->is_array()) {
|
248
262
|
for (const auto& entry : nc->get_array()) {
|
249
263
|
if (const auto& name = entry.get_string(); name == "costBasedOptimizer") {
|
250
|
-
result.
|
264
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_cost_based_optimizer);
|
251
265
|
} else if (name == "indexAdvisor") {
|
252
|
-
result.
|
266
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_index_advisor);
|
253
267
|
} else if (name == "javaScriptFunctions") {
|
254
|
-
result.
|
268
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_javascript_functions);
|
255
269
|
} else if (name == "inlineFunctions") {
|
256
|
-
result.
|
270
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_inline_functions);
|
257
271
|
} else if (name == "enhancedPreparedStatements") {
|
258
|
-
result.
|
272
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_enhanced_prepared_statements);
|
259
273
|
} else if (name == "readFromReplica") {
|
260
|
-
result.
|
274
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::n1ql_read_from_replica);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
}
|
278
|
+
if (const auto sc = m->find("search"); sc != nullptr && sc->is_array()) {
|
279
|
+
for (const auto& entry : sc->get_array()) {
|
280
|
+
if (const auto& name = entry.get_string(); name == "vectorSearch") {
|
281
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::search_vector_search);
|
282
|
+
} else if (name == "scopedSearchIndex") {
|
283
|
+
result.capabilities.cluster.insert(couchbase::core::cluster_capability::search_scoped_search_index);
|
261
284
|
}
|
262
285
|
}
|
263
286
|
}
|
@@ -230,6 +230,11 @@ class transaction_operation_failed : public std::runtime_error
|
|
230
230
|
return cause_;
|
231
231
|
}
|
232
232
|
|
233
|
+
final_error to_raise() const
|
234
|
+
{
|
235
|
+
return to_raise_;
|
236
|
+
}
|
237
|
+
|
233
238
|
void do_throw(const transaction_context& context) const
|
234
239
|
{
|
235
240
|
if (to_raise_ == FAILED_POST_COMMIT) {
|
@@ -242,6 +242,7 @@ struct exp_delay {
|
|
242
242
|
std::chrono::nanoseconds timeout;
|
243
243
|
mutable std::uint32_t retries;
|
244
244
|
mutable std::optional<std::chrono::time_point<std::chrono::steady_clock>> end_time;
|
245
|
+
std::size_t max_retries{ 100 };
|
245
246
|
|
246
247
|
template<typename R1, typename P1, typename R2, typename P2, typename R3, typename P3>
|
247
248
|
exp_delay(std::chrono::duration<R1, P1> initial, std::chrono::duration<R2, P2> max, std::chrono::duration<R3, P3> limit)
|
@@ -255,6 +256,9 @@ struct exp_delay {
|
|
255
256
|
void operator()() const
|
256
257
|
{
|
257
258
|
auto now = std::chrono::steady_clock::now();
|
259
|
+
if (retries >= max_retries) {
|
260
|
+
throw retry_operation_retries_exhausted("retries exhausted");
|
261
|
+
}
|
258
262
|
if (!end_time) {
|
259
263
|
end_time = std::chrono::steady_clock::now() + timeout;
|
260
264
|
return;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-2021 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
|
+
#pragma once
|
19
|
+
|
20
|
+
namespace couchbase::core
|
21
|
+
{
|
22
|
+
enum class vector_query_combination { combination_and, combination_or };
|
23
|
+
} // namespace couchbase::core
|
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
#include <couchbase/collection.hxx>
|
21
21
|
#include <couchbase/collection_manager.hxx>
|
22
|
+
#include <couchbase/ping_options.hxx>
|
22
23
|
#include <couchbase/scope.hxx>
|
23
24
|
|
24
25
|
#include <memory>
|
@@ -74,6 +75,34 @@ class bucket
|
|
74
75
|
*/
|
75
76
|
[[nodiscard]] auto scope(std::string_view scope_name) const -> scope;
|
76
77
|
|
78
|
+
/**
|
79
|
+
* Performs application-level ping requests against services in the Couchbase cluster.
|
80
|
+
*
|
81
|
+
* @note This operation performs active I/O against services and endpoints to assess their health. If you do not
|
82
|
+
* wish to performs I/O, consider using @ref diagnostics() instead.
|
83
|
+
*
|
84
|
+
* @param options custom options to change the default behavior.
|
85
|
+
* @param handler the handler that implements @ref ping_handler.
|
86
|
+
*
|
87
|
+
* @since 1.0.0
|
88
|
+
* @committed
|
89
|
+
*/
|
90
|
+
void ping(const ping_options& options, ping_handler&& handler) const;
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Performs application-level ping requests against services in the Couchbase cluster.
|
94
|
+
*
|
95
|
+
* @note This operation performs active I/O against services and endpoints to assess their health. If you do not
|
96
|
+
* wish to performs I/O, consider using @ref diagnostics() instead.
|
97
|
+
*
|
98
|
+
* @param options custom options to change the default behavior.
|
99
|
+
* @return future object that carries result of the operation.
|
100
|
+
*
|
101
|
+
* @since 1.0.0
|
102
|
+
* @committed
|
103
|
+
*/
|
104
|
+
[[nodiscard]] auto ping(const ping_options& options = {}) const -> std::future<ping_result>;
|
105
|
+
|
77
106
|
/**
|
78
107
|
* Provides access to the collection management services.
|
79
108
|
*
|
@@ -22,11 +22,14 @@
|
|
22
22
|
#include <couchbase/bucket.hxx>
|
23
23
|
#include <couchbase/bucket_manager.hxx>
|
24
24
|
#include <couchbase/cluster_options.hxx>
|
25
|
+
#include <couchbase/diagnostics_options.hxx>
|
26
|
+
#include <couchbase/ping_options.hxx>
|
25
27
|
#include <couchbase/query_index_manager.hxx>
|
26
28
|
#include <couchbase/query_options.hxx>
|
27
29
|
#include <couchbase/search_index_manager.hxx>
|
28
30
|
#include <couchbase/search_options.hxx>
|
29
31
|
#include <couchbase/search_query.hxx>
|
32
|
+
#include <couchbase/search_request.hxx>
|
30
33
|
#include <couchbase/transactions.hxx>
|
31
34
|
|
32
35
|
#include <memory>
|
@@ -141,6 +144,9 @@ class cluster
|
|
141
144
|
/**
|
142
145
|
* Performs a query against the full text search services.
|
143
146
|
*
|
147
|
+
* Consider using the newer @ref cluster::search() interface instead, which can be used
|
148
|
+
* for both traditional FTS queries, and to perform a @ref vector_search
|
149
|
+
*
|
144
150
|
* @param index_name name of the search index
|
145
151
|
* @param query query object, see hierarchy of @ref search_query for more details.
|
146
152
|
* @param options options to customize the query request.
|
@@ -159,6 +165,9 @@ class cluster
|
|
159
165
|
/**
|
160
166
|
* Performs a query against the full text search services.
|
161
167
|
*
|
168
|
+
* Consider using the newer @ref cluster::search() interface instead, which can be used
|
169
|
+
* for both traditional FTS queries, and to perform a vector search.
|
170
|
+
*
|
162
171
|
* @param index_name name of the search index
|
163
172
|
* @param query query object, see hierarchy of @ref search_query for more details.
|
164
173
|
* @param options options to customize the query request.
|
@@ -175,6 +184,47 @@ class cluster
|
|
175
184
|
[[nodiscard]] auto search_query(std::string index_name, const class search_query& query, const search_options& options = {}) const
|
176
185
|
-> std::future<std::pair<search_error_context, search_result>>;
|
177
186
|
|
187
|
+
/**
|
188
|
+
* Performs a request against the full text search services.
|
189
|
+
*
|
190
|
+
* This can be used to perform a traditional FTS query, and/or a vector search.
|
191
|
+
*
|
192
|
+
* @param index_name name of the search index
|
193
|
+
* @param request request object, see @ref search_request for more details.
|
194
|
+
* @param options options to customize the query request.
|
195
|
+
* @param handler the handler that implements @ref search_handler
|
196
|
+
*
|
197
|
+
* @exception errc::common::ambiguous_timeout
|
198
|
+
* @exception errc::common::unambiguous_timeout
|
199
|
+
*
|
200
|
+
* @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
|
201
|
+
*
|
202
|
+
* @since 1.0.0
|
203
|
+
* @volatile
|
204
|
+
*/
|
205
|
+
void search(std::string index_name, search_request request, const search_options& options, search_handler&& handler) const;
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Performs a request against the full text search services.
|
209
|
+
*
|
210
|
+
* This can be used to perform a traditional FTS query, and/or a vector search.
|
211
|
+
*
|
212
|
+
* @param index_name name of the search index
|
213
|
+
* @param request request object, see @ref search_request for more details.
|
214
|
+
* @param options options to customize the query request.
|
215
|
+
* @return future object that carries result of the operation
|
216
|
+
*
|
217
|
+
* @exception errc::common::ambiguous_timeout
|
218
|
+
* @exception errc::common::unambiguous_timeout
|
219
|
+
*
|
220
|
+
* @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
|
221
|
+
*
|
222
|
+
* @since 1.0.0
|
223
|
+
* @volatile
|
224
|
+
*/
|
225
|
+
[[nodiscard]] auto search(std::string index_name, search_request request, const search_options& = {}) const
|
226
|
+
-> std::future<std::pair<search_error_context, search_result>>;
|
227
|
+
|
178
228
|
/**
|
179
229
|
* Performs a query against the analytics services.
|
180
230
|
*
|
@@ -207,6 +257,66 @@ class cluster
|
|
207
257
|
[[nodiscard]] auto analytics_query(std::string statement, const analytics_options& options = {}) const
|
208
258
|
-> std::future<std::pair<analytics_error_context, analytics_result>>;
|
209
259
|
|
260
|
+
/**
|
261
|
+
* Performs application-level ping requests against services in the Couchbase cluster.
|
262
|
+
*
|
263
|
+
* @note This operation performs active I/O against services and endpoints to assess their health. If you do not
|
264
|
+
* wish to performs I/O, consider using @ref diagnostics() instead.
|
265
|
+
*
|
266
|
+
* @param options custom options to change the default behavior.
|
267
|
+
* @param handler the handler that implements @ref ping_handler.
|
268
|
+
*
|
269
|
+
* @since 1.0.0
|
270
|
+
* @committed
|
271
|
+
*/
|
272
|
+
void ping(const ping_options& options, ping_handler&& handler) const;
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Performs application-level ping requests against services in the Couchbase cluster.
|
276
|
+
*
|
277
|
+
* @note This operation performs active I/O against services and endpoints to assess their health. If you do not
|
278
|
+
* wish to performs I/O, consider using @ref diagnostics() instead.
|
279
|
+
*
|
280
|
+
* @param options custom options to change the default behavior.
|
281
|
+
* @return future object that carries result of the operation.
|
282
|
+
*
|
283
|
+
* @since 1.0.0
|
284
|
+
* @committed
|
285
|
+
*/
|
286
|
+
[[nodiscard]] auto ping(const ping_options& options = {}) const -> std::future<ping_result>;
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.
|
290
|
+
*
|
291
|
+
* @note This operation does not perform any I/O to produce the report. It will only use the current known state of
|
292
|
+
* the cluster to assemble the report So, if for example, no SQL++ queries have been run, the Query service's socket
|
293
|
+
* pool might be empty and as a result not show up in the report. If you wish to actively assess the health of the
|
294
|
+
* cluster by performing I/O, consider using @ref ping() instead.
|
295
|
+
*
|
296
|
+
* @param options custom options to change the default behavior.
|
297
|
+
* @param handler the handler that implements @ref diagnostics_handler.
|
298
|
+
*
|
299
|
+
* @since 1.0.0
|
300
|
+
* @committed
|
301
|
+
*/
|
302
|
+
void diagnostics(const diagnostics_options& options, diagnostics_handler&& handler) const;
|
303
|
+
|
304
|
+
/**
|
305
|
+
* Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.
|
306
|
+
*
|
307
|
+
* @note This operation does not perform any I/O to produce the report. It will only use the current known state of
|
308
|
+
* the cluster to assemble the report So, if for example, no SQL++ queries have been run, the Query service's socket
|
309
|
+
* pool might be empty and as a result not show up in the report. If you wish to actively assess the health of the
|
310
|
+
* cluster by performing I/O, consider using @ref ping() instead.
|
311
|
+
*
|
312
|
+
* @param options custom options to change the default behavior.
|
313
|
+
* @return future object that carries result of the operation.
|
314
|
+
*
|
315
|
+
* @since 1.0.0
|
316
|
+
* @committed
|
317
|
+
*/
|
318
|
+
[[nodiscard]] auto diagnostics(const diagnostics_options& options = {}) const -> std::future<diagnostics_result>;
|
319
|
+
|
210
320
|
/**
|
211
321
|
* Provides access to the N1QL index management services.
|
212
322
|
*
|
@@ -40,7 +40,7 @@ class json_transcoder
|
|
40
40
|
{
|
41
41
|
if (encoded.flags != 0 && !codec_flags::has_common_flags(encoded.flags, codec_flags::json_common_flags)) {
|
42
42
|
throw std::system_error(errc::common::decoding_failure,
|
43
|
-
"json_transcoder
|
43
|
+
"json_transcoder expects document to have JSON common flags, flags=" + std::to_string(encoded.flags));
|
44
44
|
}
|
45
45
|
|
46
46
|
return Serializer::template deserialize<Document>(encoded.data);
|
@@ -21,6 +21,7 @@
|
|
21
21
|
#include <couchbase/codec/encoded_value.hxx>
|
22
22
|
#include <couchbase/codec/transcoder_traits.hxx>
|
23
23
|
#include <couchbase/error_codes.hxx>
|
24
|
+
|
24
25
|
#include <type_traits>
|
25
26
|
|
26
27
|
namespace couchbase::codec
|
@@ -40,7 +41,7 @@ class raw_binary_transcoder
|
|
40
41
|
{
|
41
42
|
if (!codec_flags::has_common_flags(encoded.flags, codec_flags::binary_common_flags)) {
|
42
43
|
throw std::system_error(errc::common::decoding_failure,
|
43
|
-
"raw_binary_transcoder
|
44
|
+
"raw_binary_transcoder expects document to have BINARY common flags, flags=" +
|
44
45
|
std::to_string(encoded.flags));
|
45
46
|
}
|
46
47
|
|
@@ -0,0 +1,78 @@
|
|
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
|
+
#pragma once
|
19
|
+
|
20
|
+
#include <couchbase/codec/codec_flags.hxx>
|
21
|
+
#include <couchbase/codec/encoded_value.hxx>
|
22
|
+
#include <couchbase/codec/transcoder_traits.hxx>
|
23
|
+
#include <couchbase/error_codes.hxx>
|
24
|
+
|
25
|
+
#include <cstddef>
|
26
|
+
#include <string>
|
27
|
+
#include <string_view>
|
28
|
+
#include <type_traits>
|
29
|
+
#include <vector>
|
30
|
+
|
31
|
+
namespace couchbase
|
32
|
+
{
|
33
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
34
|
+
namespace core::utils
|
35
|
+
{
|
36
|
+
std::vector<std::byte>
|
37
|
+
to_binary(std::string_view value) noexcept;
|
38
|
+
} // namespace core::utils
|
39
|
+
#endif
|
40
|
+
|
41
|
+
namespace codec
|
42
|
+
{
|
43
|
+
class raw_json_transcoder
|
44
|
+
{
|
45
|
+
public:
|
46
|
+
template<typename Document, std::enable_if_t<std::is_same_v<Document, std::string> || std::is_same_v<Document, binary>, bool> = true>
|
47
|
+
static auto encode(const Document& document) -> encoded_value
|
48
|
+
{
|
49
|
+
if constexpr (std::is_same_v<Document, std::string>) {
|
50
|
+
return { core::utils::to_binary(document), codec_flags::json_common_flags };
|
51
|
+
} else {
|
52
|
+
return { std::move(document), codec_flags::json_common_flags };
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
template<typename Document, std::enable_if_t<std::is_same_v<Document, std::string> || std::is_same_v<Document, binary>, bool> = true>
|
57
|
+
static auto decode(const encoded_value& encoded) -> Document
|
58
|
+
{
|
59
|
+
if (!codec_flags::has_common_flags(encoded.flags, codec_flags::json_common_flags)) {
|
60
|
+
throw std::system_error(errc::common::decoding_failure,
|
61
|
+
"raw_json_transcoder expects document to have JSON common flags, flags=" +
|
62
|
+
std::to_string(encoded.flags));
|
63
|
+
}
|
64
|
+
if constexpr (std::is_same_v<Document, std::string>) {
|
65
|
+
return std::string{ reinterpret_cast<const char*>(encoded.data.data()), encoded.data.size() };
|
66
|
+
} else {
|
67
|
+
return encoded.data;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
73
|
+
template<>
|
74
|
+
struct is_transcoder<raw_json_transcoder> : public std::true_type {
|
75
|
+
};
|
76
|
+
#endif
|
77
|
+
} // namespace codec
|
78
|
+
} // namespace couchbase
|
@@ -0,0 +1,72 @@
|
|
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
|
+
#pragma once
|
19
|
+
|
20
|
+
#include <couchbase/codec/codec_flags.hxx>
|
21
|
+
#include <couchbase/codec/encoded_value.hxx>
|
22
|
+
#include <couchbase/codec/transcoder_traits.hxx>
|
23
|
+
#include <couchbase/error_codes.hxx>
|
24
|
+
|
25
|
+
#include <cstddef>
|
26
|
+
#include <string>
|
27
|
+
#include <string_view>
|
28
|
+
#include <type_traits>
|
29
|
+
#include <vector>
|
30
|
+
|
31
|
+
namespace couchbase
|
32
|
+
{
|
33
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
34
|
+
namespace core::utils
|
35
|
+
{
|
36
|
+
std::vector<std::byte>
|
37
|
+
to_binary(std::string_view value) noexcept;
|
38
|
+
} // namespace core::utils
|
39
|
+
#endif
|
40
|
+
|
41
|
+
namespace codec
|
42
|
+
{
|
43
|
+
class raw_string_transcoder
|
44
|
+
{
|
45
|
+
public:
|
46
|
+
using document_type = std::string;
|
47
|
+
|
48
|
+
static auto encode(document_type document) -> encoded_value
|
49
|
+
{
|
50
|
+
return { core::utils::to_binary(document), codec_flags::string_common_flags };
|
51
|
+
}
|
52
|
+
|
53
|
+
template<typename Document = document_type, std::enable_if_t<std::is_same_v<Document, document_type>, bool> = true>
|
54
|
+
static auto decode(const encoded_value& encoded) -> Document
|
55
|
+
{
|
56
|
+
if (!codec_flags::has_common_flags(encoded.flags, codec_flags::string_common_flags)) {
|
57
|
+
throw std::system_error(errc::common::decoding_failure,
|
58
|
+
"raw_string_transcoder expects document to have STRING common flags, flags=" +
|
59
|
+
std::to_string(encoded.flags));
|
60
|
+
}
|
61
|
+
|
62
|
+
return std::string{ reinterpret_cast<const char*>(encoded.data.data()), encoded.data.size() };
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
67
|
+
template<>
|
68
|
+
struct is_transcoder<raw_string_transcoder> : public std::true_type {
|
69
|
+
};
|
70
|
+
#endif
|
71
|
+
} // namespace codec
|
72
|
+
} // namespace couchbase
|