couchbase 4.2.6 → 4.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/.github/workflows/windows.yml +0 -3
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/bin/build-tests.rb +1 -1
- package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +176 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +167 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +75 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.cxx +97 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +67 -0
- package/deps/couchbase-cxx-client/core/meta/features.hxx +13 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +192 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +188 -0
- package/deps/couchbase-cxx-client/core/operations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +1 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.cxx +107 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.hxx +137 -0
- package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +3 -0
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +5 -0
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +111 -0
- package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/lookup_in_all_replicas_options.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_any_replica_options.hxx +101 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/lookup_in_replica_result.hxx +74 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_result.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +3 -3
- package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +655 -0
- package/dist/binding.d.ts +45 -0
- package/dist/collection.d.ts +53 -1
- package/dist/collection.js +139 -1
- package/dist/crudoptypes.d.ts +24 -0
- package/dist/crudoptypes.js +14 -1
- package/package.json +13 -13
- package/src/connection.cpp +4 -0
- package/src/connection.hpp +2 -0
- package/src/connection_autogen.cpp +28 -0
- package/src/jstocbpp_autogen.hpp +262 -0
@@ -0,0 +1,74 @@
|
|
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/lookup_in_result.hxx>
|
21
|
+
|
22
|
+
#include <vector>
|
23
|
+
|
24
|
+
namespace couchbase
|
25
|
+
{
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Represents result of lookup_in_replica operations.
|
29
|
+
*
|
30
|
+
* @since 1.0.0
|
31
|
+
* @committed
|
32
|
+
*/
|
33
|
+
class lookup_in_replica_result : public lookup_in_result
|
34
|
+
{
|
35
|
+
public:
|
36
|
+
/**
|
37
|
+
* @since 1.0.0
|
38
|
+
* @internal
|
39
|
+
*/
|
40
|
+
lookup_in_replica_result() = default;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Constructs result for lookup_in_replica operation
|
44
|
+
*
|
45
|
+
* @param cas
|
46
|
+
* @param entries list of the fields returned by the server
|
47
|
+
* @param is_deleted
|
48
|
+
* @param is_replica true if document originates from replica node
|
49
|
+
*
|
50
|
+
* @since 1.0.0
|
51
|
+
* @committed
|
52
|
+
*/
|
53
|
+
lookup_in_replica_result(couchbase::cas cas, std::vector<entry> entries, bool is_deleted, bool is_replica)
|
54
|
+
: lookup_in_result{ cas, std::move(entries), is_deleted }
|
55
|
+
, is_replica_{ is_replica }
|
56
|
+
{
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Returns whether this document originates from a replica node
|
61
|
+
*
|
62
|
+
* @return whether document originates from a replica node
|
63
|
+
*
|
64
|
+
* @since 1.0.0
|
65
|
+
*/
|
66
|
+
[[nodiscard]] auto is_replica() const -> bool
|
67
|
+
{
|
68
|
+
return is_replica_;
|
69
|
+
}
|
70
|
+
|
71
|
+
private:
|
72
|
+
bool is_replica_{ false };
|
73
|
+
};
|
74
|
+
} // namespace couchbase
|
@@ -44,6 +44,7 @@ class lookup_in_result : public result
|
|
44
44
|
codec::binary value;
|
45
45
|
std::size_t original_index;
|
46
46
|
bool exists;
|
47
|
+
std::error_code ec;
|
47
48
|
};
|
48
49
|
|
49
50
|
/**
|
@@ -84,6 +85,11 @@ class lookup_in_result : public result
|
|
84
85
|
{
|
85
86
|
for (const entry& e : entries_) {
|
86
87
|
if (e.original_index == index) {
|
88
|
+
if (e.ec) {
|
89
|
+
throw std::system_error(
|
90
|
+
e.ec, "error getting result for spec at index " + std::to_string(index) + ", path \"" + e.path + "\"");
|
91
|
+
}
|
92
|
+
|
87
93
|
return codec::tao_json_serializer::deserialize<Document>(e.value);
|
88
94
|
}
|
89
95
|
}
|
@@ -105,6 +111,10 @@ class lookup_in_result : public result
|
|
105
111
|
{
|
106
112
|
for (const entry& e : entries_) {
|
107
113
|
if (e.path == path) {
|
114
|
+
if (e.ec) {
|
115
|
+
throw std::system_error(e.ec, "error getting result for path \"" + e.path + "\"");
|
116
|
+
}
|
117
|
+
|
108
118
|
return codec::tao_json_serializer::deserialize<Document>(e.value);
|
109
119
|
}
|
110
120
|
}
|
@@ -127,6 +137,10 @@ class lookup_in_result : public result
|
|
127
137
|
const auto& macro_string = subdoc::to_string(macro);
|
128
138
|
for (const entry& e : entries_) {
|
129
139
|
if (e.path == macro_string) {
|
140
|
+
if (e.ec) {
|
141
|
+
throw std::system_error(e.ec, "error getting result for macro \"" + macro_string + "\"");
|
142
|
+
}
|
143
|
+
|
130
144
|
return codec::tao_json_serializer::deserialize<Document>(e.value);
|
131
145
|
}
|
132
146
|
}
|
@@ -147,6 +161,10 @@ class lookup_in_result : public result
|
|
147
161
|
{
|
148
162
|
for (const entry& e : entries_) {
|
149
163
|
if (e.original_index == index) {
|
164
|
+
if (e.ec && e.ec != couchbase::errc::key_value::path_not_found) {
|
165
|
+
throw std::system_error(e.ec, "error getting result for path \"" + e.path + "\"");
|
166
|
+
}
|
167
|
+
|
150
168
|
return e.exists;
|
151
169
|
}
|
152
170
|
}
|
@@ -167,6 +185,10 @@ class lookup_in_result : public result
|
|
167
185
|
const auto& macro_string = subdoc::to_string(macro);
|
168
186
|
for (const entry& e : entries_) {
|
169
187
|
if (e.path == macro_string) {
|
188
|
+
if (e.ec && e.ec != couchbase::errc::key_value::path_not_found) {
|
189
|
+
throw std::system_error(e.ec, "error getting result for macro \"" + macro_string + "\"");
|
190
|
+
}
|
191
|
+
|
170
192
|
return e.exists;
|
171
193
|
}
|
172
194
|
}
|
@@ -186,6 +208,10 @@ class lookup_in_result : public result
|
|
186
208
|
{
|
187
209
|
for (const entry& e : entries_) {
|
188
210
|
if (e.path == path) {
|
211
|
+
if (e.ec && e.ec != couchbase::errc::key_value::path_not_found) {
|
212
|
+
throw std::system_error(e.ec, "error getting result for path \"" + e.path + "\"");
|
213
|
+
}
|
214
|
+
|
189
215
|
return e.exists;
|
190
216
|
}
|
191
217
|
}
|
@@ -225,8 +225,8 @@ initiate_mutate_in_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
225
225
|
std::string collection_name,
|
226
226
|
std::string document_key,
|
227
227
|
const std::vector<couchbase::core::impl::subdoc::command>& specs,
|
228
|
-
mutate_in_options::built options,
|
229
|
-
mutate_in_handler&& handler);
|
228
|
+
couchbase::mutate_in_options::built options,
|
229
|
+
couchbase::mutate_in_handler&& handler);
|
230
230
|
#endif
|
231
231
|
} // namespace impl
|
232
232
|
} // namespace core
|
@@ -115,8 +115,8 @@ initiate_remove_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
115
115
|
std::string scope_name,
|
116
116
|
std::string collection_name,
|
117
117
|
std::string document_key,
|
118
|
-
remove_options::built options,
|
119
|
-
remove_handler&& handler);
|
118
|
+
couchbase::remove_options::built options,
|
119
|
+
couchbase::remove_handler&& handler);
|
120
120
|
#endif
|
121
121
|
} // namespace impl
|
122
122
|
} // namespace core
|
@@ -175,9 +175,9 @@ initiate_replace_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
175
175
|
std::string scope_name,
|
176
176
|
std::string collection_name,
|
177
177
|
std::string document_key,
|
178
|
-
codec::encoded_value encoded,
|
179
|
-
replace_options::built options,
|
180
|
-
replace_handler&& handler);
|
178
|
+
couchbase::codec::encoded_value encoded,
|
179
|
+
couchbase::replace_options::built options,
|
180
|
+
couchbase::replace_handler&& handler);
|
181
181
|
#endif
|
182
182
|
} // namespace impl
|
183
183
|
} // namespace core
|
@@ -86,8 +86,8 @@ initiate_touch_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
86
86
|
std::string collection_name,
|
87
87
|
std::string document_key,
|
88
88
|
std::uint32_t expiry,
|
89
|
-
touch_options::built options,
|
90
|
-
touch_handler&& handler);
|
89
|
+
couchbase::touch_options::built options,
|
90
|
+
couchbase::touch_handler&& handler);
|
91
91
|
#endif
|
92
92
|
} // namespace impl
|
93
93
|
} // namespace core
|
@@ -89,8 +89,8 @@ initiate_unlock_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
89
89
|
std::string collection_name,
|
90
90
|
std::string document_key,
|
91
91
|
couchbase::cas cas,
|
92
|
-
unlock_options::built options,
|
93
|
-
unlock_handler&& handler);
|
92
|
+
couchbase::unlock_options::built options,
|
93
|
+
couchbase::unlock_handler&& handler);
|
94
94
|
#endif
|
95
95
|
} // namespace impl
|
96
96
|
} // namespace core
|
@@ -149,9 +149,9 @@ initiate_upsert_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
149
149
|
std::string scope_name,
|
150
150
|
std::string collection_name,
|
151
151
|
std::string document_key,
|
152
|
-
codec::encoded_value encoded,
|
153
|
-
upsert_options::built options,
|
154
|
-
upsert_handler&& handler);
|
152
|
+
couchbase::codec::encoded_value encoded,
|
153
|
+
couchbase::upsert_options::built options,
|
154
|
+
couchbase::upsert_handler&& handler);
|
155
155
|
#endif
|
156
156
|
} // namespace impl
|
157
157
|
} // namespace core
|