couchbase 4.2.5 → 4.2.6-dev
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +9 -1
- package/deps/couchbase-cxx-client/bin/api.rb +234 -0
- package/deps/couchbase-cxx-client/bin/create-search-index +18 -135
- package/deps/couchbase-cxx-client/bin/init-cluster +17 -139
- package/deps/couchbase-cxx-client/bin/load-sample-buckets +54 -0
- package/deps/couchbase-cxx-client/core/cluster.hxx +33 -12
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +3 -0
- package/deps/couchbase-cxx-client/core/crud_component.cxx +51 -22
- package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +115 -50
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +6 -0
- package/deps/couchbase-cxx-client/core/impl/create_bucket.cxx +155 -0
- package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +172 -59
- package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +2 -1
- package/deps/couchbase-cxx-client/core/impl/drop_bucket.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +138 -59
- package/deps/couchbase-cxx-client/core/impl/flush_bucket.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/get_all_buckets.cxx +163 -0
- package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +67 -37
- package/deps/couchbase-cxx-client/core/impl/get_bucket.cxx +153 -0
- package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.cxx +113 -0
- package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.hxx +60 -0
- package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +2 -4
- package/deps/couchbase-cxx-client/core/impl/manager_error_context.cxx +100 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/update_bucket.cxx +130 -0
- package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +53 -29
- package/deps/couchbase-cxx-client/core/io/dns_client.cxx +71 -38
- package/deps/couchbase-cxx-client/core/io/dns_config.cxx +5 -4
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +5 -6
- package/deps/couchbase-cxx-client/core/meta/features.hxx +6 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +11 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +270 -0
- package/deps/couchbase-cxx-client/core/origin.hxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -2
- package/deps/couchbase-cxx-client/core/range_scan_options.cxx +3 -27
- package/deps/couchbase-cxx-client/core/range_scan_options.hxx +13 -17
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +367 -170
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +13 -2
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +5 -3
- package/deps/couchbase-cxx-client/core/scan_options.hxx +0 -19
- package/deps/couchbase-cxx-client/core/scan_result.cxx +19 -5
- package/deps/couchbase-cxx-client/core/scan_result.hxx +5 -2
- package/deps/couchbase-cxx-client/core/timeout_defaults.hxx +2 -3
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +2 -0
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_fmt.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +5 -0
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -0
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +4 -0
- package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +19 -2
- package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +135 -0
- package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +0 -30
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +14 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +7 -48
- package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +41 -0
- package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +0 -29
- package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +0 -33
- package/deps/couchbase-cxx-client/couchbase/drop_bucket_options.hxx +41 -0
- package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +0 -30
- package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +0 -31
- package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +1 -2
- package/deps/couchbase-cxx-client/couchbase/flush_bucket_options.hxx +41 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_buckets_options.hxx +44 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +0 -30
- package/deps/couchbase-cxx-client/couchbase/get_bucket_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/management/bucket_settings.hxx +116 -0
- package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +29 -53
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +16 -83
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +18 -0
- package/deps/couchbase-cxx-client/couchbase/security_options.hxx +15 -0
- package/deps/couchbase-cxx-client/couchbase/update_bucket_options.hxx +41 -0
- package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +0 -31
- package/deps/couchbase-cxx-client/docs/cbc-analytics.md +1 -0
- package/deps/couchbase-cxx-client/docs/cbc-get.md +1 -0
- package/deps/couchbase-cxx-client/docs/cbc-pillowfight.md +1 -0
- package/deps/couchbase-cxx-client/docs/cbc-query.md +1 -0
- package/deps/couchbase-cxx-client/docs/cbc.md +10 -0
- package/deps/couchbase-cxx-client/test/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +6 -0
- package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +5 -0
- package/deps/couchbase-cxx-client/test/test_integration_examples.cxx +137 -1
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +709 -266
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +19 -7
- package/deps/couchbase-cxx-client/test/test_integration_range_scan.cxx +351 -112
- package/deps/couchbase-cxx-client/test/test_integration_search.cxx +10 -1
- package/deps/couchbase-cxx-client/test/test_transaction_public_async_api.cxx +13 -12
- package/deps/couchbase-cxx-client/test/test_transaction_public_blocking_api.cxx +27 -21
- package/deps/couchbase-cxx-client/test/test_unit_query.cxx +75 -0
- package/deps/couchbase-cxx-client/test/utils/server_version.hxx +5 -0
- package/deps/couchbase-cxx-client/test/utils/wait_until.cxx +29 -10
- package/deps/couchbase-cxx-client/test/utils/wait_until.hxx +3 -1
- package/deps/couchbase-cxx-client/tools/utils.cxx +4 -1
- package/dist/binding.d.ts +21 -16
- package/dist/binding.js +1 -4
- package/dist/bindingutilities.d.ts +6 -1
- package/dist/bindingutilities.js +36 -1
- package/dist/collection.d.ts +65 -3
- package/dist/collection.js +107 -0
- package/dist/crudoptypes.d.ts +34 -0
- package/dist/crudoptypes.js +18 -1
- package/dist/queryexecutor.js +1 -0
- package/dist/querytypes.d.ts +7 -0
- package/dist/rangeScan.d.ts +107 -0
- package/dist/rangeScan.js +91 -0
- package/dist/streamablepromises.d.ts +6 -0
- package/dist/streamablepromises.js +25 -1
- package/package.json +12 -13
- package/src/addondata.hpp +1 -0
- package/src/binding.cpp +5 -2
- package/src/connection.cpp +108 -2
- package/src/connection.hpp +1 -0
- package/src/constants.cpp +2 -12
- package/src/jstocbpp_autogen.hpp +49 -22
- package/src/jstocbpp_basic.hpp +2 -8
- package/src/mutationtoken.cpp +13 -0
- package/src/scan_iterator.cpp +90 -0
- package/src/scan_iterator.hpp +30 -0
- package/tools/gen-bindings-json.py +9 -8
- package/deps/couchbase-cxx-client/core/impl/collection_query_index_manager.cxx +0 -93
@@ -61,19 +61,11 @@ class query_index_manager
|
|
61
61
|
*/
|
62
62
|
void get_all_indexes(std::string bucket_name,
|
63
63
|
const get_all_query_indexes_options& options,
|
64
|
-
get_all_query_indexes_handler&& handler) const
|
65
|
-
|
66
|
-
return core::impl::initiate_get_all_query_indexes(
|
67
|
-
core_, std::move(bucket_name), options.build(), std::forward<get_all_query_indexes_handler>(handler));
|
68
|
-
}
|
64
|
+
get_all_query_indexes_handler&& handler) const;
|
65
|
+
|
69
66
|
[[nodiscard]] auto get_all_indexes(std::string bucket_name, const get_all_query_indexes_options& options) const
|
70
|
-
-> std::future<std::pair<manager_error_context, std::vector<couchbase::management::query::index
|
71
|
-
|
72
|
-
auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>>();
|
73
|
-
auto future = barrier->get_future();
|
74
|
-
get_all_indexes(std::move(bucket_name), options, [barrier](auto ctx, auto resp) { barrier->set_value({ ctx, resp }); });
|
75
|
-
return future;
|
76
|
-
}
|
67
|
+
-> std::future<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>;
|
68
|
+
|
77
69
|
/**
|
78
70
|
* Create an index on a bucket.
|
79
71
|
*
|
@@ -90,23 +82,12 @@ class query_index_manager
|
|
90
82
|
std::string index_name,
|
91
83
|
std::vector<std::string> fields,
|
92
84
|
const create_query_index_options& options,
|
93
|
-
create_query_index_handler&& handler) const
|
94
|
-
{
|
95
|
-
core::impl::initiate_create_query_index(
|
96
|
-
core_, std::move(bucket_name), std::move(index_name), std::move(fields), options.build(), std::move(handler));
|
97
|
-
}
|
85
|
+
create_query_index_handler&& handler) const;
|
98
86
|
|
99
87
|
[[nodiscard]] auto create_index(std::string bucket_name,
|
100
88
|
std::string index_name,
|
101
89
|
std::vector<std::string> fields,
|
102
|
-
const create_query_index_options& options) const -> std::future<manager_error_context
|
103
|
-
{
|
104
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
105
|
-
auto future = barrier->get_future();
|
106
|
-
create_index(
|
107
|
-
std::move(bucket_name), std::move(index_name), std::move(fields), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
108
|
-
return future;
|
109
|
-
}
|
90
|
+
const create_query_index_options& options) const -> std::future<manager_error_context>;
|
110
91
|
|
111
92
|
/**
|
112
93
|
* Create a primary index on a bucket.
|
@@ -120,19 +101,10 @@ class query_index_manager
|
|
120
101
|
*/
|
121
102
|
void create_primary_index(std::string bucket_name,
|
122
103
|
const create_primary_query_index_options& options,
|
123
|
-
create_query_index_handler&& handler)
|
124
|
-
{
|
125
|
-
return core::impl::initiate_create_primary_query_index(core_, std::move(bucket_name), options.build(), std::move(handler));
|
126
|
-
}
|
104
|
+
create_query_index_handler&& handler);
|
127
105
|
|
128
106
|
[[nodiscard]] auto create_primary_index(std::string bucket_name, const create_primary_query_index_options& options)
|
129
|
-
-> std::future<manager_error_context
|
130
|
-
{
|
131
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
132
|
-
auto future = barrier->get_future();
|
133
|
-
create_primary_index(std::move(bucket_name), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
134
|
-
return future;
|
135
|
-
}
|
107
|
+
-> std::future<manager_error_context>;
|
136
108
|
/**
|
137
109
|
* Drop primary index on a bucket.
|
138
110
|
*
|
@@ -143,19 +115,10 @@ class query_index_manager
|
|
143
115
|
* @since 1.0.0
|
144
116
|
* @committed
|
145
117
|
*/
|
146
|
-
void drop_primary_index(std::string bucket_name, const drop_primary_query_index_options& options, drop_query_index_handler&& handler)
|
147
|
-
{
|
148
|
-
return core::impl::initiate_drop_primary_query_index(core_, std::move(bucket_name), options.build(), std::move(handler));
|
149
|
-
}
|
118
|
+
void drop_primary_index(std::string bucket_name, const drop_primary_query_index_options& options, drop_query_index_handler&& handler);
|
150
119
|
|
151
120
|
[[nodiscard]] auto drop_primary_index(std::string bucket_name, const drop_primary_query_index_options& options)
|
152
|
-
-> std::future<manager_error_context
|
153
|
-
{
|
154
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
155
|
-
auto future = barrier->get_future();
|
156
|
-
drop_primary_index(std::move(bucket_name), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
157
|
-
return future;
|
158
|
-
}
|
121
|
+
-> std::future<manager_error_context>;
|
159
122
|
|
160
123
|
/**
|
161
124
|
*
|
@@ -170,20 +133,10 @@ class query_index_manager
|
|
170
133
|
void drop_index(std::string bucket_name,
|
171
134
|
std::string index_name,
|
172
135
|
const drop_query_index_options& options,
|
173
|
-
drop_query_index_handler&& handler)
|
174
|
-
{
|
175
|
-
return core::impl::initiate_drop_query_index(
|
176
|
-
core_, std::move(bucket_name), std::move(index_name), options.build(), std::move(handler));
|
177
|
-
}
|
136
|
+
drop_query_index_handler&& handler);
|
178
137
|
|
179
138
|
[[nodiscard]] auto drop_index(std::string bucket_name, std::string index_name, const drop_query_index_options& options)
|
180
|
-
-> std::future<manager_error_context
|
181
|
-
{
|
182
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
183
|
-
auto future = barrier->get_future();
|
184
|
-
drop_index(std::move(bucket_name), std::move(index_name), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
185
|
-
return future;
|
186
|
-
}
|
139
|
+
-> std::future<manager_error_context>;
|
187
140
|
/**
|
188
141
|
* Builds all currently deferred indexes.
|
189
142
|
*
|
@@ -198,20 +151,10 @@ class query_index_manager
|
|
198
151
|
*/
|
199
152
|
void build_deferred_indexes(std::string bucket_name,
|
200
153
|
const build_query_index_options& options,
|
201
|
-
build_deferred_query_indexes_handler&& handler) const
|
202
|
-
{
|
203
|
-
return core::impl::initiate_build_deferred_indexes(
|
204
|
-
core_, std::move(bucket_name), options.build(), std::forward<build_deferred_query_indexes_handler>(handler));
|
205
|
-
}
|
154
|
+
build_deferred_query_indexes_handler&& handler) const;
|
206
155
|
|
207
156
|
[[nodiscard]] auto build_deferred_indexes(std::string bucket_name, const build_query_index_options& options) const
|
208
|
-
-> std::future<manager_error_context
|
209
|
-
{
|
210
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
211
|
-
auto future = barrier->get_future();
|
212
|
-
build_deferred_indexes(std::move(bucket_name), options, [barrier](auto ctx) { barrier->set_value(std::move(ctx)); });
|
213
|
-
return future;
|
214
|
-
}
|
157
|
+
-> std::future<manager_error_context>;
|
215
158
|
|
216
159
|
/**
|
217
160
|
* Polls the state of a set of indexes, until they all are online.
|
@@ -227,21 +170,11 @@ class query_index_manager
|
|
227
170
|
void watch_indexes(std::string bucket_name,
|
228
171
|
std::vector<std::string> index_names,
|
229
172
|
const watch_query_indexes_options& options,
|
230
|
-
watch_query_indexes_handler&& handler)
|
231
|
-
{
|
232
|
-
return core::impl::initiate_watch_query_indexes(
|
233
|
-
core_, std::move(bucket_name), std::move(index_names), options.build(), std::move(handler));
|
234
|
-
}
|
173
|
+
watch_query_indexes_handler&& handler);
|
235
174
|
|
236
175
|
[[nodiscard]] auto watch_indexes(std::string bucket_name,
|
237
176
|
std::vector<std::string> index_names,
|
238
|
-
const watch_query_indexes_options& options)
|
239
|
-
{
|
240
|
-
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
241
|
-
auto future = barrier->get_future();
|
242
|
-
watch_indexes(std::move(bucket_name), std::move(index_names), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
243
|
-
return future;
|
244
|
-
}
|
177
|
+
const watch_query_indexes_options& options) -> std::future<manager_error_context>;
|
245
178
|
|
246
179
|
private:
|
247
180
|
friend class cluster;
|
@@ -51,6 +51,7 @@ struct query_options : public common_options<query_options> {
|
|
51
51
|
const bool readonly;
|
52
52
|
const bool flex_index;
|
53
53
|
const bool preserve_expiry;
|
54
|
+
std::optional<bool> use_replica;
|
54
55
|
std::optional<std::uint64_t> max_parallelism;
|
55
56
|
std::optional<std::uint64_t> scan_cap;
|
56
57
|
std::optional<std::chrono::milliseconds> scan_wait;
|
@@ -84,6 +85,7 @@ struct query_options : public common_options<query_options> {
|
|
84
85
|
readonly_,
|
85
86
|
flex_index_,
|
86
87
|
preserve_expiry_,
|
88
|
+
use_replica_,
|
87
89
|
max_parallelism_,
|
88
90
|
scan_cap_,
|
89
91
|
scan_wait_,
|
@@ -225,6 +227,21 @@ struct query_options : public common_options<query_options> {
|
|
225
227
|
return self();
|
226
228
|
}
|
227
229
|
|
230
|
+
/**
|
231
|
+
* Specifies that the query engine should use replica nodes for KV fetches if the active node is down.
|
232
|
+
*
|
233
|
+
* @param use_replica whether replica nodes should be used if the active node is down. If not provided, the server default will be used.
|
234
|
+
* @return the options builder for chaining purposes.
|
235
|
+
*
|
236
|
+
* @since 1.0.0
|
237
|
+
* @committed
|
238
|
+
*/
|
239
|
+
auto use_replica(bool use_replica) -> query_options&
|
240
|
+
{
|
241
|
+
use_replica_ = use_replica;
|
242
|
+
return self();
|
243
|
+
}
|
244
|
+
|
228
245
|
/**
|
229
246
|
* Allows overriding the default maximum parallelism for the query execution on the server side.
|
230
247
|
*
|
@@ -529,6 +546,7 @@ struct query_options : public common_options<query_options> {
|
|
529
546
|
bool readonly_{ false };
|
530
547
|
bool flex_index_{ false };
|
531
548
|
bool preserve_expiry_{ false };
|
549
|
+
std::optional<bool> use_replica_{};
|
532
550
|
std::optional<std::uint64_t> max_parallelism_{};
|
533
551
|
std::optional<std::uint64_t> scan_cap_{};
|
534
552
|
std::optional<std::uint64_t> pipeline_batch_{};
|
@@ -45,11 +45,20 @@ class security_options
|
|
45
45
|
return *this;
|
46
46
|
}
|
47
47
|
|
48
|
+
auto trust_certificate_value(std::string certificate_value) -> security_options&
|
49
|
+
{
|
50
|
+
trust_certificate_value_ = certificate_value;
|
51
|
+
return *this;
|
52
|
+
}
|
53
|
+
|
48
54
|
struct built {
|
49
55
|
bool enabled;
|
50
56
|
tls_verify_mode tls_verify;
|
51
57
|
std::optional<std::string> trust_certificate;
|
58
|
+
std::optional<std::string> trust_certificate_value;
|
52
59
|
bool disable_mozilla_ca_certificates;
|
60
|
+
bool disable_deprecated_protocols;
|
61
|
+
bool disable_tls_v1_2;
|
53
62
|
};
|
54
63
|
|
55
64
|
[[nodiscard]] auto build() const -> built
|
@@ -58,7 +67,10 @@ class security_options
|
|
58
67
|
enabled_,
|
59
68
|
tls_verify_,
|
60
69
|
trust_certificate_,
|
70
|
+
trust_certificate_value_,
|
61
71
|
disable_mozilla_ca_certificates_,
|
72
|
+
disable_deprecated_protocols,
|
73
|
+
disable_tls_v1_2,
|
62
74
|
};
|
63
75
|
}
|
64
76
|
|
@@ -66,6 +78,9 @@ class security_options
|
|
66
78
|
bool enabled_{ true };
|
67
79
|
tls_verify_mode tls_verify_{ tls_verify_mode::peer };
|
68
80
|
std::optional<std::string> trust_certificate_{};
|
81
|
+
std::optional<std::string> trust_certificate_value_{};
|
69
82
|
bool disable_mozilla_ca_certificates_{ false };
|
83
|
+
bool disable_deprecated_protocols{ true };
|
84
|
+
bool disable_tls_v1_2{ false };
|
70
85
|
};
|
71
86
|
} // namespace couchbase
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-Present 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 <functional>
|
21
|
+
#include <memory>
|
22
|
+
#include <optional>
|
23
|
+
#include <string>
|
24
|
+
|
25
|
+
namespace couchbase
|
26
|
+
{
|
27
|
+
struct update_bucket_options : public common_options<update_bucket_options> {
|
28
|
+
public:
|
29
|
+
struct built : public common_options<update_bucket_options>::built {
|
30
|
+
};
|
31
|
+
|
32
|
+
[[nodiscard]] auto build() const -> built
|
33
|
+
{
|
34
|
+
return { build_common_options() };
|
35
|
+
}
|
36
|
+
|
37
|
+
private:
|
38
|
+
};
|
39
|
+
|
40
|
+
using update_bucket_handler = std::function<void(couchbase::manager_error_context)>;
|
41
|
+
} // namespace couchbase
|
@@ -81,35 +81,4 @@ class watch_query_indexes_options : public common_options<watch_query_indexes_op
|
|
81
81
|
*/
|
82
82
|
|
83
83
|
using watch_query_indexes_handler = std::function<void(couchbase::manager_error_context)>;
|
84
|
-
|
85
|
-
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
86
|
-
namespace core
|
87
|
-
{
|
88
|
-
class cluster;
|
89
|
-
class query_context;
|
90
|
-
namespace impl
|
91
|
-
{
|
92
|
-
|
93
|
-
/**
|
94
|
-
* @since 1.0.0
|
95
|
-
* @internal
|
96
|
-
*/
|
97
|
-
void
|
98
|
-
initiate_watch_query_indexes(std::shared_ptr<couchbase::core::cluster> core,
|
99
|
-
std::string bucket_name,
|
100
|
-
std::vector<std::string> index_names,
|
101
|
-
couchbase::watch_query_indexes_options::built options,
|
102
|
-
query_context query_ctx,
|
103
|
-
std::string collection_name,
|
104
|
-
watch_query_indexes_handler&& handler);
|
105
|
-
void
|
106
|
-
initiate_watch_query_indexes(std::shared_ptr<couchbase::core::cluster> core,
|
107
|
-
std::string bucket_name,
|
108
|
-
std::vector<std::string> index_names,
|
109
|
-
couchbase::watch_query_indexes_options::built options,
|
110
|
-
watch_query_indexes_handler&& handler);
|
111
|
-
|
112
|
-
#endif
|
113
|
-
} // namespace impl
|
114
|
-
} // namespace core
|
115
84
|
} // namespace couchbase
|
@@ -141,6 +141,7 @@ Execute one or more Analytics queries and print results to standard output.
|
|
141
141
|
|
142
142
|
<dl>
|
143
143
|
<dt>`--user-agent-extra=STRING`</dt><dd>Append extra string SDK identifiers. [default: `cbc`].</dd>
|
144
|
+
<dt>`--network=STRING`</dt><dd>Network (a.k.a. Alternate Addresses) to use. [default: `auto`]</dd>
|
144
145
|
<dt>`--show-queries`</dt><dd>Log queries on INFO level.</dd>
|
145
146
|
<dt>`--enable-clustermap-notifications`</dt><dd>Allow server to send notifications when cluster configuration changes.</dd>
|
146
147
|
<dt>`--disable-mutation-tokens`</dt><dd>Do not request Key/Value service to send mutation tokens.</dd>
|
@@ -141,6 +141,7 @@ Retrieve one or more documents from the server and print them to standard output
|
|
141
141
|
|
142
142
|
<dl>
|
143
143
|
<dt>`--user-agent-extra=STRING`</dt><dd>Append extra string SDK identifiers. [default: `cbc`].</dd>
|
144
|
+
<dt>`--network=STRING`</dt><dd>Network (a.k.a. Alternate Addresses) to use. [default: `auto`]</dd>
|
144
145
|
<dt>`--show-queries`</dt><dd>Log queries on INFO level.</dd>
|
145
146
|
<dt>`--enable-clustermap-notifications`</dt><dd>Allow server to send notifications when cluster configuration changes.</dd>
|
146
147
|
<dt>`--disable-mutation-tokens`</dt><dd>Do not request Key/Value service to send mutation tokens.</dd>
|
@@ -148,6 +148,7 @@ Run simple workload generator that sends GET/UPSERT requests with optional N1QL
|
|
148
148
|
|
149
149
|
<dl>
|
150
150
|
<dt>`--user-agent-extra=STRING`</dt><dd>Append extra string SDK identifiers. [default: `cbc`].</dd>
|
151
|
+
<dt>`--network=STRING`</dt><dd>Network (a.k.a. Alternate Addresses) to use. [default: `auto`]</dd>
|
151
152
|
<dt>`--show-queries`</dt><dd>Log queries on INFO level.</dd>
|
152
153
|
<dt>`--enable-clustermap-notifications`</dt><dd>Allow server to send notifications when cluster configuration changes.</dd>
|
153
154
|
<dt>`--disable-mutation-tokens`</dt><dd>Do not request Key/Value service to send mutation tokens.</dd>
|
@@ -149,6 +149,7 @@ Execute one or more N1QL queries and print results to standard output.
|
|
149
149
|
|
150
150
|
<dl>
|
151
151
|
<dt>`--user-agent-extra=STRING`</dt><dd>Append extra string SDK identifiers. [default: `cbc`].</dd>
|
152
|
+
<dt>`--network=STRING`</dt><dd>Network (a.k.a. Alternate Addresses) to use. [default: `auto`]</dd>
|
152
153
|
<dt>`--show-queries`</dt><dd>Log queries on INFO level.</dd>
|
153
154
|
<dt>`--enable-clustermap-notifications`</dt><dd>Allow server to send notifications when cluster configuration changes.</dd>
|
154
155
|
<dt>`--disable-mutation-tokens`</dt><dd>Do not request Key/Value service to send mutation tokens.</dd>
|
@@ -32,6 +32,16 @@ Retrieve document from the server. See [cbc-get](md_docs_2cbc-get) for more info
|
|
32
32
|
<dd>
|
33
33
|
Perform N1QL query. See [cbc-query](md_docs_2cbc-query) for more information.
|
34
34
|
</dd>
|
35
|
+
|
36
|
+
<dt>analytics</dt>
|
37
|
+
<dd>
|
38
|
+
Perform Analytics query. See [cbc-analytics](md_docs_2cbc-analytics) for more information.
|
39
|
+
</dd>
|
40
|
+
|
41
|
+
<dt>pillowfight</dt>
|
42
|
+
<dd>
|
43
|
+
Run simple workload generator. See [cbc-pillowfight](md_docs_2cbc-pillowfight) for more information.
|
44
|
+
</dd>
|
35
45
|
</dl>
|
36
46
|
|
37
47
|
### OPTIONS
|
@@ -113,6 +113,12 @@ TEST_CASE("integration: get and insert non default scope and collection", "[inte
|
|
113
113
|
REQUIRE_SUCCESS(resp.ctx.ec());
|
114
114
|
REQUIRE(resp.value == couchbase::core::utils::to_binary(key));
|
115
115
|
}
|
116
|
+
|
117
|
+
{
|
118
|
+
couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, scope_name };
|
119
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
120
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
121
|
+
}
|
116
122
|
}
|
117
123
|
|
118
124
|
TEST_CASE("integration: insert into dropped scope", "[integration]")
|
@@ -315,6 +315,11 @@ TEST_CASE("integration: lock/unlock without lock time", "[integration]")
|
|
315
315
|
TEST_CASE("integration: touch with zero expiry resets expiry", "[integration]")
|
316
316
|
{
|
317
317
|
test::utils::integration_test_guard integration;
|
318
|
+
|
319
|
+
if (integration.ctx.deployment == test::utils::deployment_type::elixir) {
|
320
|
+
SKIP("Timeout is too strict for sanity test env");
|
321
|
+
}
|
322
|
+
|
318
323
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
319
324
|
|
320
325
|
couchbase::core::document_id id{ integration.ctx.bucket, "_default", "_default", test::utils::uniq_id("get_reset_expiry_key") };
|
@@ -132,6 +132,9 @@ row: {"airline":{"callsign":"MILE-AIR","country":"United States","iata":"Q5","ic
|
|
132
132
|
TEST_CASE("example: start using", "[integration]")
|
133
133
|
{
|
134
134
|
test::utils::integration_test_guard integration;
|
135
|
+
if (integration.cluster_version().is_capella()) {
|
136
|
+
SKIP("Capella does not allow to use REST API to load sample buckets");
|
137
|
+
}
|
135
138
|
if (!integration.cluster_version().supports_collections()) {
|
136
139
|
SKIP("cluster does not support collections");
|
137
140
|
}
|
@@ -438,8 +441,12 @@ row: {"airline":{"callsign":"MILE-AIR","country":"United States","iata":"Q5","ic
|
|
438
441
|
TEST_CASE("example: search", "[integration]")
|
439
442
|
{
|
440
443
|
test::utils::integration_test_guard integration;
|
444
|
+
|
445
|
+
if (integration.cluster_version().is_capella()) {
|
446
|
+
SKIP("Capella does not allow to use REST API to load sample buckets");
|
447
|
+
}
|
441
448
|
if (!integration.cluster_version().supports_collections()) {
|
442
|
-
|
449
|
+
SKIP("cluster does not support collections");
|
443
450
|
}
|
444
451
|
|
445
452
|
const auto env = test::utils::test_context::load_from_environment();
|
@@ -452,3 +459,132 @@ TEST_CASE("example: search", "[integration]")
|
|
452
459
|
|
453
460
|
REQUIRE(example_search::main(4, argv) == 0);
|
454
461
|
}
|
462
|
+
|
463
|
+
namespace example_buckets
|
464
|
+
{
|
465
|
+
//! [example-buckets]
|
466
|
+
#include <couchbase/cluster.hxx>
|
467
|
+
|
468
|
+
int
|
469
|
+
main(int argc, const char* argv[])
|
470
|
+
{
|
471
|
+
if (argc != 4) {
|
472
|
+
fmt::print("USAGE: ./example_buckets couchbase://127.0.0.1 Administrator password\n");
|
473
|
+
return 1;
|
474
|
+
}
|
475
|
+
|
476
|
+
std::string connection_string{ argv[1] }; // "couchbase://127.0.0.1"
|
477
|
+
std::string username{ argv[2] }; // "Administrator"
|
478
|
+
std::string password{ argv[3] }; // "password"
|
479
|
+
std::string bucket_name{ "travel-sample" };
|
480
|
+
|
481
|
+
// run IO context on separate thread
|
482
|
+
asio::io_context io;
|
483
|
+
auto guard = asio::make_work_guard(io);
|
484
|
+
std::thread io_thread([&io]() { io.run(); });
|
485
|
+
|
486
|
+
auto options = couchbase::cluster_options(username, password);
|
487
|
+
// customize through the 'options'.
|
488
|
+
// For example, optimize timeouts for WAN
|
489
|
+
options.apply_profile("wan_development");
|
490
|
+
|
491
|
+
auto [cluster, ec] = couchbase::cluster::connect(io, connection_string, options).get();
|
492
|
+
if (ec) {
|
493
|
+
fmt::print("unable to connect to the cluster: {}\n", ec.message());
|
494
|
+
return 1;
|
495
|
+
}
|
496
|
+
auto manager = cluster.buckets();
|
497
|
+
|
498
|
+
couchbase::management::cluster::bucket_settings bucket_settings{};
|
499
|
+
std::string test_bucket_name = "cxx_test_integration_examples_bucket";
|
500
|
+
bucket_settings.name = test_bucket_name;
|
501
|
+
bucket_settings.ram_quota_mb = 150;
|
502
|
+
bucket_settings.bucket_type = couchbase::management::cluster::bucket_type::couchbase;
|
503
|
+
bucket_settings.eviction_policy = couchbase::management::cluster::bucket_eviction_policy::value_only;
|
504
|
+
bucket_settings.flush_enabled = true;
|
505
|
+
bucket_settings.replica_indexes = true;
|
506
|
+
bucket_settings.conflict_resolution_type = couchbase::management::cluster::bucket_conflict_resolution::sequence_number;
|
507
|
+
{
|
508
|
+
fmt::print("--- create bucket\n");
|
509
|
+
auto ctx = manager.create_bucket(bucket_settings).get();
|
510
|
+
if (ctx.ec()) {
|
511
|
+
if (ctx.ec() == couchbase::errc::common::invalid_argument) {
|
512
|
+
fmt::print("bucket already exists\n");
|
513
|
+
} else {
|
514
|
+
fmt::print("unable to create the bucket: {}\n", ctx.ec().message());
|
515
|
+
return 1;
|
516
|
+
}
|
517
|
+
} else {
|
518
|
+
fmt::print("--- bucket has been successfully created\n");
|
519
|
+
}
|
520
|
+
}
|
521
|
+
{
|
522
|
+
fmt::print("--- get bucket\n");
|
523
|
+
auto [ctx, bucket] = manager.get_bucket(bucket_name).get();
|
524
|
+
if (ctx.ec()) {
|
525
|
+
fmt::print("unable to get the bucket: {}\n", ctx.ec().message());
|
526
|
+
return 1;
|
527
|
+
}
|
528
|
+
fmt::print("name of fetched bucket: {}\n", bucket.name);
|
529
|
+
}
|
530
|
+
{
|
531
|
+
fmt::print("--- get all buckets\n");
|
532
|
+
auto [ctx, buckets] = manager.get_all_buckets().get();
|
533
|
+
if (ctx.ec()) {
|
534
|
+
fmt::print("unable to get all buckets: {}\n", ctx.ec().message());
|
535
|
+
return 1;
|
536
|
+
}
|
537
|
+
for (const auto& fetched_bucket : buckets) {
|
538
|
+
fmt::print("Bucket name: {}\n", fetched_bucket.name);
|
539
|
+
}
|
540
|
+
}
|
541
|
+
{
|
542
|
+
fmt::print("--- update bucket\n");
|
543
|
+
bucket_settings.ram_quota_mb = 150;
|
544
|
+
auto ctx = manager.update_bucket(bucket_settings).get();
|
545
|
+
if (ctx.ec()) {
|
546
|
+
fmt::print("unable to update the bucket: {}\n", ctx.ec().message());
|
547
|
+
return 1;
|
548
|
+
}
|
549
|
+
fmt::print("bucket has been updated\n");
|
550
|
+
}
|
551
|
+
{
|
552
|
+
fmt::print("--- drop bucket\n");
|
553
|
+
auto ctx = manager.drop_bucket(test_bucket_name).get();
|
554
|
+
if (ctx.ec()) {
|
555
|
+
fmt::print("unable to drop the bucket: {}\n", ctx.ec().message());
|
556
|
+
return 1;
|
557
|
+
}
|
558
|
+
fmt::print("bucket has been dropped\n");
|
559
|
+
}
|
560
|
+
|
561
|
+
// close cluster connection
|
562
|
+
cluster.close();
|
563
|
+
guard.reset();
|
564
|
+
|
565
|
+
io_thread.join();
|
566
|
+
return 0;
|
567
|
+
}
|
568
|
+
|
569
|
+
//! [example-buckets]
|
570
|
+
} // namespace example_buckets
|
571
|
+
|
572
|
+
TEST_CASE("example: bucket management", "[integration]")
|
573
|
+
{
|
574
|
+
test::utils::integration_test_guard integration;
|
575
|
+
|
576
|
+
if (integration.cluster_version().is_capella()) {
|
577
|
+
SKIP("Capella does not allow to use REST API to load sample buckets");
|
578
|
+
}
|
579
|
+
|
580
|
+
const auto env = test::utils::test_context::load_from_environment();
|
581
|
+
|
582
|
+
const char* argv[] = {
|
583
|
+
"example_buckets", // name of the "executable"
|
584
|
+
env.connection_string.c_str(),
|
585
|
+
env.username.c_str(),
|
586
|
+
env.password.c_str(),
|
587
|
+
};
|
588
|
+
|
589
|
+
REQUIRE(example_buckets::main(4, argv) == 0);
|
590
|
+
}
|