couchbase 4.2.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/.gitmodules +3 -0
- package/deps/couchbase-cxx-client/.idea/misc.xml +1 -0
- package/deps/couchbase-cxx-client/.idea/vcs.xml +1 -0
- package/deps/couchbase-cxx-client/CMakeLists.txt +11 -1
- package/deps/couchbase-cxx-client/README.md +3 -3
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +4 -1
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +13 -1
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/core/cluster.hxx +15 -5
- package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +17 -6
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/collection_query_index_manager.cxx +93 -0
- package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +11 -0
- package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +119 -0
- package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +108 -0
- package/deps/couchbase-cxx-client/core/impl/get.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +76 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +5 -7
- package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +168 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +15 -1
- package/deps/couchbase-cxx-client/core/logger/configuration.hxx +3 -0
- package/deps/couchbase-cxx-client/core/logger/level.hxx +21 -0
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -6
- package/deps/couchbase-cxx-client/core/meta/CMakeLists.txt +4 -2
- package/deps/couchbase-cxx-client/core/meta/features.hxx +31 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +67 -5
- package/deps/couchbase-cxx-client/core/meta/version.hxx +12 -1
- package/deps/couchbase-cxx-client/core/metrics/CMakeLists.txt +4 -1
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +46 -5
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +10 -26
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +10 -12
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -3
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +8 -14
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +15 -8
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +7 -14
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +11 -16
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +8 -12
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +21 -12
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -2
- package/deps/couchbase-cxx-client/core/origin.hxx +1 -1
- package/deps/couchbase-cxx-client/core/platform/uuid.cc +1 -2
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -1
- package/deps/couchbase-cxx-client/core/query_context.hxx +79 -0
- package/deps/couchbase-cxx-client/core/tracing/CMakeLists.txt +3 -1
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +19 -4
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +10 -4
- package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +52 -63
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +8 -3
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +163 -126
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +24 -37
- package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +51 -13
- package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +26 -1
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +21 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +40 -18
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +5 -0
- package/deps/couchbase-cxx-client/core/transactions/result.hxx +26 -0
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +48 -47
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +6 -6
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +33 -19
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +18 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +25 -2
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +49 -56
- package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +7 -7
- package/deps/couchbase-cxx-client/core/transactions.hxx +0 -12
- package/deps/couchbase-cxx-client/core/utils/binary.hxx +1 -1
- package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +12 -45
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +6 -7
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +8 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +218 -0
- package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +3 -0
- package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +166 -0
- package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +172 -0
- package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +129 -0
- package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +116 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +46 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +70 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +46 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +100 -0
- package/deps/couchbase-cxx-client/{core → couchbase}/management/query_index.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +178 -6
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +1 -18
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +5 -2
- package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +11 -4
- package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +5 -3
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +0 -6
- package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +115 -0
- package/deps/couchbase-cxx-client/examples/minimal.cxx +3 -1
- package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +72 -0
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +727 -310
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +4 -8
- package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +14 -0
- package/deps/couchbase-cxx-client/test/test_transaction_transaction_public_blocking_api.cxx +34 -19
- package/deps/couchbase-cxx-client/test/test_unit_transaction_logging.cxx +66 -22
- package/deps/couchbase-cxx-client/test/test_unit_utils.cxx +51 -0
- package/deps/couchbase-cxx-client/test/tools/tool_kv_loader.cxx +2 -2
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -0
- package/deps/couchbase-cxx-client/test/utils/wait_until.cxx +4 -4
- package/deps/couchbase-cxx-client/third_party/docopt/.travis.yml +103 -0
- package/deps/couchbase-cxx-client/third_party/docopt/CMakeLists.txt +129 -0
- package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-Boost-1.0 +23 -0
- package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-MIT +23 -0
- package/deps/couchbase-cxx-client/third_party/docopt/README.rst +479 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt-config.cmake +1 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.cpp +687 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.h +98 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.pc.in +9 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_private.h +676 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_util.h +122 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_value.h +341 -0
- package/deps/couchbase-cxx-client/third_party/docopt/examples/naval_fate.cpp +36 -0
- package/deps/couchbase-cxx-client/third_party/docopt/main.cpp +16 -0
- package/deps/couchbase-cxx-client/third_party/docopt/run_testcase.cpp +40 -0
- package/deps/couchbase-cxx-client/third_party/docopt/run_tests.py +72 -0
- package/deps/couchbase-cxx-client/third_party/docopt/testcases.docopt +957 -0
- package/deps/couchbase-cxx-client/tools/CMakeLists.txt +14 -0
- package/deps/couchbase-cxx-client/tools/cbc.cxx +65 -0
- package/deps/couchbase-cxx-client/tools/command.hxx +31 -0
- package/deps/couchbase-cxx-client/tools/command_registry.cxx +43 -0
- package/deps/couchbase-cxx-client/tools/command_registry.hxx +39 -0
- package/deps/couchbase-cxx-client/tools/get.cxx +267 -0
- package/deps/couchbase-cxx-client/tools/get.hxx +26 -0
- package/deps/couchbase-cxx-client/tools/query.cxx +441 -0
- package/deps/couchbase-cxx-client/tools/query.hxx +26 -0
- package/deps/couchbase-cxx-client/tools/utils.cxx +418 -0
- package/deps/couchbase-cxx-client/tools/utils.hxx +150 -0
- package/deps/couchbase-cxx-client/tools/version.cxx +82 -0
- package/deps/couchbase-cxx-client/tools/version.hxx +26 -0
- package/dist/authenticators.d.ts +2 -2
- package/dist/authenticators.js +1 -2
- package/dist/binding.d.ts +32 -16
- package/dist/cluster.js +14 -7
- package/dist/collection.d.ts +6 -0
- package/dist/collection.js +8 -0
- package/dist/queryexecutor.js +1 -1
- package/dist/queryindexmanager.d.ts +100 -4
- package/dist/queryindexmanager.js +344 -118
- package/dist/transactions.js +0 -2
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/connection.hpp +1 -0
- package/src/connection_autogen.cpp +16 -0
- package/src/jstocbpp_autogen.hpp +93 -23
- package/src/jstocbpp_basic.hpp +24 -0
- package/src/jstocbpp_transactions.hpp +0 -8
- package/tools/gen-bindings-js.js +1 -0
- package/tools/gen-bindings-json.py +4 -2
- package/deps/couchbase-cxx-client/core/transactions/logging.cxx +0 -107
@@ -0,0 +1,218 @@
|
|
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 <couchbase/build_query_index_options.hxx>
|
21
|
+
#include <couchbase/create_primary_query_index_options.hxx>
|
22
|
+
#include <couchbase/create_query_index_options.hxx>
|
23
|
+
#include <couchbase/drop_primary_query_index_options.hxx>
|
24
|
+
#include <couchbase/drop_query_index_options.hxx>
|
25
|
+
#include <couchbase/get_all_query_indexes_options.hxx>
|
26
|
+
#include <couchbase/watch_query_indexes_options.hxx>
|
27
|
+
|
28
|
+
#include <future>
|
29
|
+
#include <memory>
|
30
|
+
|
31
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
32
|
+
namespace couchbase::core
|
33
|
+
{
|
34
|
+
class cluster;
|
35
|
+
|
36
|
+
class query_context;
|
37
|
+
|
38
|
+
} // namespace couchbase::core
|
39
|
+
#endif
|
40
|
+
|
41
|
+
namespace couchbase
|
42
|
+
{
|
43
|
+
class collection;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* The Query Index Manager interface contains the means for managing indexes used for queries.
|
47
|
+
*
|
48
|
+
* @since 1.0.0
|
49
|
+
* @committed
|
50
|
+
*/
|
51
|
+
class collection_query_index_manager
|
52
|
+
{
|
53
|
+
public:
|
54
|
+
/**
|
55
|
+
* Get all indexes within a collection.
|
56
|
+
*
|
57
|
+
*
|
58
|
+
* @param options optional parameters
|
59
|
+
* @param handler the handler that implements @ref get_all_query_indexes_handler
|
60
|
+
*
|
61
|
+
* @since 1.0.0
|
62
|
+
* @committed
|
63
|
+
*/
|
64
|
+
void get_all_indexes(const get_all_query_indexes_options& options, get_all_indexes_handler&& handler) const;
|
65
|
+
|
66
|
+
[[nodiscard]] auto get_all_indexes(const get_all_query_indexes_options& options) const
|
67
|
+
-> std::future<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>
|
68
|
+
{
|
69
|
+
auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>>();
|
70
|
+
auto future = barrier->get_future();
|
71
|
+
get_all_indexes(options, [barrier](auto ctx, auto resp) { barrier->set_value({ ctx, resp }); });
|
72
|
+
return future;
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Create an index on the collection.
|
76
|
+
*
|
77
|
+
* @param index_name name of the index
|
78
|
+
* @param fields the fields to create the index over
|
79
|
+
* @param options optional parameters
|
80
|
+
* @param handler the handler that implements @ref create_query_index_handler
|
81
|
+
*
|
82
|
+
* @since 1.0.0
|
83
|
+
* @committed
|
84
|
+
*/
|
85
|
+
void create_index(std::string index_name,
|
86
|
+
std::vector<std::string> fields,
|
87
|
+
const create_query_index_options& options,
|
88
|
+
create_query_index_handler&& handler) const;
|
89
|
+
|
90
|
+
[[nodiscard]] auto create_index(std::string index_name,
|
91
|
+
std::vector<std::string> fields,
|
92
|
+
const create_query_index_options& options) const -> std::future<manager_error_context>
|
93
|
+
{
|
94
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
95
|
+
auto future = barrier->get_future();
|
96
|
+
create_index(std::move(index_name), std::move(fields), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
97
|
+
return future;
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Create a primary index on a collection.
|
102
|
+
*
|
103
|
+
* @param options optional parameters
|
104
|
+
* @param handler the handler that implements @ref create_query_index_handler
|
105
|
+
*
|
106
|
+
* @since 1.0.0
|
107
|
+
* @committed
|
108
|
+
*/
|
109
|
+
void create_primary_index(const create_primary_query_index_options& options, create_query_index_handler&& handler) const;
|
110
|
+
|
111
|
+
[[nodiscard]] auto create_primary_index(const create_primary_query_index_options& options) -> std::future<manager_error_context>
|
112
|
+
{
|
113
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
114
|
+
auto future = barrier->get_future();
|
115
|
+
create_primary_index(options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
116
|
+
return future;
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Drop primary index on a collection.
|
120
|
+
*
|
121
|
+
* @param options optional parameters
|
122
|
+
* @param handler the handler that implements @ref drop_query_index_handler
|
123
|
+
*
|
124
|
+
* @since 1.0.0
|
125
|
+
* @committed
|
126
|
+
*/
|
127
|
+
void drop_primary_index(const drop_primary_query_index_options& options, drop_query_index_handler&& handler) const;
|
128
|
+
|
129
|
+
[[nodiscard]] auto drop_primary_index(const drop_primary_query_index_options& options) const -> std::future<manager_error_context>
|
130
|
+
{
|
131
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
132
|
+
auto future = barrier->get_future();
|
133
|
+
drop_primary_index(options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
134
|
+
return future;
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Drop index in collection.
|
139
|
+
*
|
140
|
+
* @param index_name name of the index to drop
|
141
|
+
* @param options optional parameters
|
142
|
+
* @param handler handler that implements @ref drop_query_index_handler
|
143
|
+
*
|
144
|
+
* @since 1.0.0
|
145
|
+
* @committed
|
146
|
+
*/
|
147
|
+
void drop_index(std::string index_name, const drop_query_index_options& options, drop_query_index_handler&& handler) const;
|
148
|
+
|
149
|
+
[[nodiscard]] auto drop_index(std::string index_name, const drop_query_index_options& options) -> std::future<manager_error_context>
|
150
|
+
{
|
151
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
152
|
+
auto future = barrier->get_future();
|
153
|
+
drop_index(std::move(index_name), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
154
|
+
return future;
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Builds all currently deferred indexes in this collection.
|
158
|
+
*
|
159
|
+
* By default, this method will build the indexes on the collection.
|
160
|
+
*
|
161
|
+
* @param options the custom options
|
162
|
+
* @param handler the handler that implements @ref build_deferred_query_indexes_handler
|
163
|
+
*
|
164
|
+
* @since 1.0.0
|
165
|
+
* @committed
|
166
|
+
*/
|
167
|
+
void build_deferred_indexes(const build_query_index_options& options, build_deferred_query_indexes_handler&& handler) const;
|
168
|
+
|
169
|
+
[[nodiscard]] auto build_deferred_indexes(const build_query_index_options& options) const -> std::future<manager_error_context>
|
170
|
+
{
|
171
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
172
|
+
auto future = barrier->get_future();
|
173
|
+
build_deferred_indexes(options, [barrier](auto ctx) { barrier->set_value(std::move(ctx)); });
|
174
|
+
return future;
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Polls the state of a set of indexes, until they all are online.
|
179
|
+
*
|
180
|
+
* @param index_names names of the indexes to watch
|
181
|
+
* @param options optional parameters
|
182
|
+
* @param handler handler that implements @ref watch_query_indexes_handler
|
183
|
+
*
|
184
|
+
* @since 1.0.0
|
185
|
+
* @committed
|
186
|
+
*/
|
187
|
+
void watch_indexes(std::vector<std::string> index_names,
|
188
|
+
const watch_query_indexes_options& options,
|
189
|
+
watch_query_indexes_handler&& handler) const;
|
190
|
+
|
191
|
+
[[nodiscard]] auto watch_indexes(std::vector<std::string> index_names, const watch_query_indexes_options& options)
|
192
|
+
{
|
193
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
194
|
+
auto future = barrier->get_future();
|
195
|
+
watch_indexes(std::move(index_names), options, [barrier](auto ctx) { barrier->set_value(ctx); });
|
196
|
+
return future;
|
197
|
+
}
|
198
|
+
|
199
|
+
private:
|
200
|
+
friend class collection;
|
201
|
+
|
202
|
+
explicit collection_query_index_manager(std::shared_ptr<couchbase::core::cluster> core,
|
203
|
+
std::string bucket_name,
|
204
|
+
std::string scope_name,
|
205
|
+
std::string collection_name)
|
206
|
+
: core_(core)
|
207
|
+
, bucket_name_(std::move(bucket_name))
|
208
|
+
, scope_name_(std::move(scope_name))
|
209
|
+
, collection_name_(std::move(collection_name))
|
210
|
+
{
|
211
|
+
}
|
212
|
+
|
213
|
+
std::shared_ptr<couchbase::core::cluster> core_;
|
214
|
+
std::string bucket_name_;
|
215
|
+
std::string scope_name_;
|
216
|
+
std::string collection_name_;
|
217
|
+
};
|
218
|
+
} // namespace couchbase
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
#include <memory>
|
23
23
|
#include <string>
|
24
|
+
#include <vector>
|
24
25
|
|
25
26
|
namespace couchbase
|
26
27
|
{
|
@@ -54,5 +55,7 @@ class configuration_profiles_registry
|
|
54
55
|
* @internal
|
55
56
|
*/
|
56
57
|
static void apply_profile(const std::string& name, couchbase::cluster_options& options);
|
58
|
+
|
59
|
+
static auto available_profiles() -> std::vector<std::string>;
|
57
60
|
};
|
58
61
|
} // namespace couchbase
|
@@ -0,0 +1,166 @@
|
|
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 <couchbase/common_options.hxx>
|
21
|
+
#include <couchbase/error_codes.hxx>
|
22
|
+
#include <couchbase/manager_error_context.hxx>
|
23
|
+
|
24
|
+
#include <optional>
|
25
|
+
#include <string>
|
26
|
+
|
27
|
+
namespace couchbase
|
28
|
+
{
|
29
|
+
class create_primary_query_index_options : public common_options<create_primary_query_index_options>
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
/**
|
33
|
+
* Give the primary index a name
|
34
|
+
*
|
35
|
+
* defaults to #primary
|
36
|
+
*
|
37
|
+
* @param index_name
|
38
|
+
* @return reference to this object, for use in chaining.
|
39
|
+
*/
|
40
|
+
auto index_name(std::string index_name) -> create_primary_query_index_options&
|
41
|
+
{
|
42
|
+
index_name_.emplace(index_name);
|
43
|
+
return self();
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* Set flag to ignore error if the index already exists
|
47
|
+
*
|
48
|
+
* The default is to not ignore the error.
|
49
|
+
*
|
50
|
+
* @param ignore_if_exists if true, we don't return an error if the index already exists
|
51
|
+
* @return reference to this object, for use in chaining.
|
52
|
+
*
|
53
|
+
* @since 1.0.0
|
54
|
+
* @committed
|
55
|
+
*/
|
56
|
+
auto ignore_if_exists(bool ignore_if_exists) -> create_primary_query_index_options&
|
57
|
+
{
|
58
|
+
ignore_if_exists_ = ignore_if_exists;
|
59
|
+
return self();
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Set flag to defer building of the index
|
63
|
+
*
|
64
|
+
* The default is false, meaning start building the index immediately.
|
65
|
+
*
|
66
|
+
* @param deferred
|
67
|
+
* @return reference to this object, for use in chaining.
|
68
|
+
*
|
69
|
+
* @since 1.0.0
|
70
|
+
* @committed
|
71
|
+
*/
|
72
|
+
auto build_deferred(bool deferred) -> create_primary_query_index_options&
|
73
|
+
{
|
74
|
+
deferred_ = deferred;
|
75
|
+
return self();
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Set the number of replicas the index will have.
|
80
|
+
*
|
81
|
+
*
|
82
|
+
* @param num_replicas
|
83
|
+
* @return reference to this object, for use in chaining.
|
84
|
+
*
|
85
|
+
* @since 1.0.0
|
86
|
+
* @committed
|
87
|
+
*/
|
88
|
+
auto num_replicas(uint8_t num_replicas) -> create_primary_query_index_options&
|
89
|
+
{
|
90
|
+
num_replicas_ = num_replicas;
|
91
|
+
return self();
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Immutable value object representing consistent options.
|
96
|
+
*
|
97
|
+
* @since 1.0.0
|
98
|
+
* @internal
|
99
|
+
*/
|
100
|
+
struct built : public common_options<create_primary_query_index_options>::built {
|
101
|
+
const std::optional<std::string> index_name{};
|
102
|
+
bool ignore_if_exists{};
|
103
|
+
bool deferred{};
|
104
|
+
std::optional<uint8_t> num_replicas{};
|
105
|
+
};
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Validates options and returns them as an immutable value.
|
109
|
+
*
|
110
|
+
* @return consistent options as an immutable value
|
111
|
+
*
|
112
|
+
* @exception std::system_error with code errc::common::invalid_argument if the options are not valid
|
113
|
+
*
|
114
|
+
* @since 1.0.0
|
115
|
+
* @internal
|
116
|
+
*/
|
117
|
+
[[nodiscard]] auto build() const -> built
|
118
|
+
{
|
119
|
+
return { build_common_options(), index_name_, ignore_if_exists_, deferred_, num_replicas_ };
|
120
|
+
}
|
121
|
+
|
122
|
+
private:
|
123
|
+
std::optional<std::string> index_name_{};
|
124
|
+
bool ignore_if_exists_{ false };
|
125
|
+
bool deferred_{ false };
|
126
|
+
std::optional<uint8_t> num_replicas_{};
|
127
|
+
};
|
128
|
+
|
129
|
+
/**
|
130
|
+
* The signature for the handler of the @ref query_index_manager#get_all_indexes() operation
|
131
|
+
*
|
132
|
+
* @since 1.0.0
|
133
|
+
* @uncommitted
|
134
|
+
*/
|
135
|
+
|
136
|
+
using create_primary_query_index_handler = std::function<void(couchbase::manager_error_context)>;
|
137
|
+
|
138
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
139
|
+
namespace core
|
140
|
+
{
|
141
|
+
class cluster;
|
142
|
+
class query_context;
|
143
|
+
namespace impl
|
144
|
+
{
|
145
|
+
|
146
|
+
/**
|
147
|
+
* @since 1.0.0
|
148
|
+
* @internal
|
149
|
+
*/
|
150
|
+
void
|
151
|
+
initiate_create_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
152
|
+
std::string bucket_name,
|
153
|
+
couchbase::create_primary_query_index_options::built options,
|
154
|
+
query_context query_ctx,
|
155
|
+
std::string collection_name,
|
156
|
+
create_primary_query_index_handler&& handler);
|
157
|
+
void
|
158
|
+
initiate_create_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
159
|
+
std::string bucket_name,
|
160
|
+
couchbase::create_primary_query_index_options::built options,
|
161
|
+
create_primary_query_index_handler&& handler);
|
162
|
+
|
163
|
+
#endif
|
164
|
+
} // namespace impl
|
165
|
+
} // namespace core
|
166
|
+
} // namespace couchbase
|
@@ -0,0 +1,172 @@
|
|
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 <couchbase/common_options.hxx>
|
21
|
+
#include <couchbase/error_codes.hxx>
|
22
|
+
#include <couchbase/manager_error_context.hxx>
|
23
|
+
|
24
|
+
#include <optional>
|
25
|
+
#include <string>
|
26
|
+
|
27
|
+
namespace couchbase
|
28
|
+
{
|
29
|
+
class create_query_index_options : public common_options<create_query_index_options>
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
/**
|
33
|
+
* Set flag to ignore error if the index already exists
|
34
|
+
*
|
35
|
+
* The default is to not ignore the error.
|
36
|
+
*
|
37
|
+
* @param ignore_if_exists if true, we don't return an error if the index already exists
|
38
|
+
* @return reference to this object, for use in chaining.
|
39
|
+
*
|
40
|
+
* @since 1.0.0
|
41
|
+
* @committed
|
42
|
+
*/
|
43
|
+
auto ignore_if_exists(bool ignore_if_exists) -> create_query_index_options&
|
44
|
+
{
|
45
|
+
ignore_if_exists_ = ignore_if_exists;
|
46
|
+
return self();
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Set flag to defer building of the index
|
50
|
+
*
|
51
|
+
* The default is false, meaning start building the index immediately.
|
52
|
+
*
|
53
|
+
* @param deferred
|
54
|
+
* @return reference to this object, for use in chaining.
|
55
|
+
*
|
56
|
+
* @since 1.0.0
|
57
|
+
* @committed
|
58
|
+
*/
|
59
|
+
auto build_deferred(bool deferred) -> create_query_index_options&
|
60
|
+
{
|
61
|
+
deferred_ = deferred;
|
62
|
+
return self();
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Set the number of replicas the index will have.
|
67
|
+
*
|
68
|
+
*
|
69
|
+
* @param num_replicas
|
70
|
+
* @return reference to this object, for use in chaining.
|
71
|
+
*
|
72
|
+
* @since 1.0.0
|
73
|
+
* @committed
|
74
|
+
*/
|
75
|
+
auto num_replicas(uint8_t num_replicas) -> create_query_index_options&
|
76
|
+
{
|
77
|
+
num_replicas_ = num_replicas;
|
78
|
+
return self();
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Supply an extra condition on this index.
|
82
|
+
*
|
83
|
+
* This is the contents of the WHERE clause when creating the index.
|
84
|
+
*
|
85
|
+
* @param condition
|
86
|
+
* @return reference to this object, for use in chaining.
|
87
|
+
*/
|
88
|
+
auto condition(std::string condition) -> create_query_index_options&
|
89
|
+
{
|
90
|
+
condition_.emplace(std::move(condition));
|
91
|
+
return self();
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Immutable value object representing consistent options.
|
96
|
+
*
|
97
|
+
* @since 1.0.0
|
98
|
+
* @internal
|
99
|
+
*/
|
100
|
+
struct built : public common_options<create_query_index_options>::built {
|
101
|
+
bool ignore_if_exists{};
|
102
|
+
bool deferred{};
|
103
|
+
std::optional<std::string> condition{};
|
104
|
+
std::optional<uint8_t> num_replicas{};
|
105
|
+
};
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Validates options and returns them as an immutable value.
|
109
|
+
*
|
110
|
+
* @return consistent options as an immutable value
|
111
|
+
*
|
112
|
+
* @exception std::system_error with code errc::common::invalid_argument if the options are not valid
|
113
|
+
*
|
114
|
+
* @since 1.0.0
|
115
|
+
* @internal
|
116
|
+
*/
|
117
|
+
[[nodiscard]] auto build() const -> built
|
118
|
+
{
|
119
|
+
return { build_common_options(), ignore_if_exists_, deferred_, condition_, num_replicas_ };
|
120
|
+
}
|
121
|
+
|
122
|
+
private:
|
123
|
+
std::optional<std::string> scope_name_{};
|
124
|
+
std::optional<std::string> collection_name_{};
|
125
|
+
bool ignore_if_exists_{ false };
|
126
|
+
bool deferred_{ false };
|
127
|
+
std::optional<uint8_t> num_replicas_{};
|
128
|
+
std::optional<std::string> condition_{};
|
129
|
+
};
|
130
|
+
|
131
|
+
/**
|
132
|
+
* The signature for the handler of the @ref query_index_manager#get_all_indexes() operation
|
133
|
+
*
|
134
|
+
* @since 1.0.0
|
135
|
+
* @uncommitted
|
136
|
+
*/
|
137
|
+
|
138
|
+
using create_query_index_handler = std::function<void(couchbase::manager_error_context)>;
|
139
|
+
|
140
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
141
|
+
namespace core
|
142
|
+
{
|
143
|
+
class cluster;
|
144
|
+
class query_context;
|
145
|
+
namespace impl
|
146
|
+
{
|
147
|
+
|
148
|
+
/**
|
149
|
+
* @since 1.0.0
|
150
|
+
* @internal
|
151
|
+
*/
|
152
|
+
void
|
153
|
+
initiate_create_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
154
|
+
std::string bucket_name,
|
155
|
+
std::string index_name,
|
156
|
+
std::vector<std::string> fields,
|
157
|
+
couchbase::create_query_index_options::built options,
|
158
|
+
create_query_index_handler&& handler);
|
159
|
+
void
|
160
|
+
initiate_create_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
161
|
+
std::string bucket_name,
|
162
|
+
std::string index_name,
|
163
|
+
std::vector<std::string> fields,
|
164
|
+
couchbase::create_query_index_options::built options,
|
165
|
+
query_context query_ctx,
|
166
|
+
std::string collection_name,
|
167
|
+
create_query_index_handler&& handler);
|
168
|
+
|
169
|
+
#endif
|
170
|
+
} // namespace impl
|
171
|
+
} // namespace core
|
172
|
+
} // namespace couchbase
|
@@ -0,0 +1,129 @@
|
|
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 <couchbase/common_options.hxx>
|
21
|
+
#include <couchbase/error_codes.hxx>
|
22
|
+
#include <couchbase/manager_error_context.hxx>
|
23
|
+
|
24
|
+
#include <optional>
|
25
|
+
#include <string>
|
26
|
+
|
27
|
+
namespace couchbase
|
28
|
+
{
|
29
|
+
class drop_primary_query_index_options : public common_options<drop_primary_query_index_options>
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
/**
|
33
|
+
* Name of the primary index
|
34
|
+
*
|
35
|
+
* If created with an optional name, specify that here as well.
|
36
|
+
* @param index_name
|
37
|
+
* @return reference to this object, for use in chaining.
|
38
|
+
*/
|
39
|
+
auto index_name(std::string index_name) -> drop_primary_query_index_options&
|
40
|
+
{
|
41
|
+
index_name_.emplace(index_name);
|
42
|
+
return self();
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Set flag to ignore error if the index already exists
|
46
|
+
*
|
47
|
+
* The default is to not ignore the error.
|
48
|
+
*
|
49
|
+
* @param ignore_if_exists if true, we don't return an error if the index already exists
|
50
|
+
* @return reference to this object, for use in chaining.
|
51
|
+
*
|
52
|
+
* @since 1.0.0
|
53
|
+
* @committed
|
54
|
+
*/
|
55
|
+
auto ignore_if_not_exists(bool ignore_if_not_exists) -> drop_primary_query_index_options&
|
56
|
+
{
|
57
|
+
ignore_if_not_exists_ = ignore_if_not_exists;
|
58
|
+
return self();
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Immutable value object representing consistent options.
|
62
|
+
*
|
63
|
+
* @since 1.0.0
|
64
|
+
* @internal
|
65
|
+
*/
|
66
|
+
struct built : public common_options<drop_primary_query_index_options>::built {
|
67
|
+
std::optional<std::string> index_name;
|
68
|
+
bool ignore_if_not_exists{};
|
69
|
+
};
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Validates options and returns them as an immutable value.
|
73
|
+
*
|
74
|
+
* @return consistent options as an immutable value
|
75
|
+
*
|
76
|
+
* @exception std::system_error with code errc::common::invalid_argument if the options are not valid
|
77
|
+
*
|
78
|
+
* @since 1.0.0
|
79
|
+
* @internal
|
80
|
+
*/
|
81
|
+
[[nodiscard]] auto build() const -> built
|
82
|
+
{
|
83
|
+
return { build_common_options(), index_name_, ignore_if_not_exists_ };
|
84
|
+
}
|
85
|
+
|
86
|
+
private:
|
87
|
+
std::optional<std::string> index_name_{};
|
88
|
+
bool ignore_if_not_exists_{ false };
|
89
|
+
};
|
90
|
+
|
91
|
+
/**
|
92
|
+
* The signature for the handler of the @ref query_index_manager#get_all_indexes() operation
|
93
|
+
*
|
94
|
+
* @since 1.0.0
|
95
|
+
* @uncommitted
|
96
|
+
*/
|
97
|
+
|
98
|
+
using drop_primary_query_index_handler = std::function<void(couchbase::manager_error_context)>;
|
99
|
+
|
100
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
101
|
+
namespace core
|
102
|
+
{
|
103
|
+
class cluster;
|
104
|
+
class query_context;
|
105
|
+
namespace impl
|
106
|
+
{
|
107
|
+
|
108
|
+
/**
|
109
|
+
* @since 1.0.0
|
110
|
+
* @internal
|
111
|
+
*/
|
112
|
+
void
|
113
|
+
initiate_drop_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
114
|
+
std::string bucket_name,
|
115
|
+
couchbase::drop_primary_query_index_options::built options,
|
116
|
+
query_context query_ctx,
|
117
|
+
std::string collection_name,
|
118
|
+
drop_primary_query_index_handler&& handler);
|
119
|
+
|
120
|
+
void
|
121
|
+
initiate_drop_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
|
122
|
+
std::string bucket_name,
|
123
|
+
couchbase::drop_primary_query_index_options::built options,
|
124
|
+
drop_primary_query_index_handler&& handler);
|
125
|
+
|
126
|
+
#endif
|
127
|
+
} // namespace impl
|
128
|
+
} // namespace core
|
129
|
+
} // namespace couchbase
|