couchbase 4.2.11-rc.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +49 -2
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
- package/deps/couchbase-cxx-client/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +51 -5
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +224 -209
- package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +1 -0
- package/deps/couchbase-cxx-client/core/io/dns_client.cxx +4 -0
- package/deps/couchbase-cxx-client/core/io/dns_config.cxx +15 -4
- package/deps/couchbase-cxx-client/core/io/dns_config.hxx +1 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +95 -53
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
- package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +1 -0
- package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +116 -105
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +116 -108
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +97 -81
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +5 -0
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +141 -0
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +64 -0
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +224 -336
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +5 -6
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +8 -5
- package/deps/couchbase-cxx-client/core/scan_result.hxx +1 -11
- package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +16 -7
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +578 -483
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +51 -50
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +4 -2
- package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +6 -6
- package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +3 -2
- package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +2 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +5 -1
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +222 -179
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +23 -12
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +61 -24
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +36 -16
- package/deps/couchbase-cxx-client/core/transactions/utils.cxx +9 -0
- package/deps/couchbase-cxx-client/core/transactions.hxx +40 -7
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +20 -1
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/error_context.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +39 -0
- package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/search_result.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -0
- package/dist/binding.d.ts +8 -0
- package/dist/bindingutilities.d.ts +6 -1
- package/dist/bindingutilities.js +15 -1
- package/dist/bucketmanager.d.ts +0 -12
- package/dist/cluster.d.ts +0 -2
- package/dist/cluster.js +0 -2
- package/dist/collection.d.ts +3 -3
- package/dist/collection.js +3 -1
- package/dist/querytypes.d.ts +0 -2
- package/dist/rangeScan.d.ts +0 -8
- package/dist/rangeScan.js +0 -8
- package/dist/scope.d.ts +0 -5
- package/dist/scope.js +0 -5
- package/dist/scopesearchindexmanager.d.ts +0 -2
- package/dist/scopesearchindexmanager.js +0 -2
- package/dist/searchexecutor.js +3 -1
- package/dist/searchtypes.d.ts +16 -6
- package/dist/searchtypes.js +2 -6
- package/dist/transactions.d.ts +23 -0
- package/dist/transactions.js +16 -10
- package/dist/vectorsearch.d.ts +8 -8
- package/dist/vectorsearch.js +7 -7
- package/package.json +7 -7
- package/src/instance.cpp +11 -1
- package/src/instance.hpp +1 -0
- package/src/jstocbpp_autogen.hpp +8 -1
- package/src/jstocbpp_transactions.hpp +40 -3
- package/src/transactions.cpp +12 -1
- package/tools/gen-bindings-json.py +0 -1
- package/deps/couchbase-cxx-client/core/scan_options.hxx +0 -44
@@ -47,7 +47,8 @@ struct js_to_cbpp_t<cbtxns::transactions_config> {
|
|
47
47
|
cppObj.durability_level(durability_level.value());
|
48
48
|
}
|
49
49
|
|
50
|
-
auto timeout = js_to_cbpp<std::optional<std::chrono::milliseconds>>(
|
50
|
+
auto timeout = js_to_cbpp<std::optional<std::chrono::milliseconds>>(
|
51
|
+
jsObj.Get("timeout"));
|
51
52
|
if (timeout.has_value()) {
|
52
53
|
cppObj.timeout(timeout.value());
|
53
54
|
}
|
@@ -81,6 +82,12 @@ struct js_to_cbpp_t<cbtxns::transactions_config> {
|
|
81
82
|
cleanup_client_attempts.value());
|
82
83
|
}
|
83
84
|
|
85
|
+
auto keyspace = js_to_cbpp<std::optional<cbtxns::transaction_keyspace>>(
|
86
|
+
jsObj.Get("metadata_collection"));
|
87
|
+
if (keyspace.has_value()) {
|
88
|
+
cppObj.metadata_collection(keyspace.value());
|
89
|
+
}
|
90
|
+
|
84
91
|
return cppObj;
|
85
92
|
}
|
86
93
|
};
|
@@ -99,7 +106,8 @@ struct js_to_cbpp_t<cbtxns::transaction_options> {
|
|
99
106
|
cppObj.durability_level(durability_level.value());
|
100
107
|
}
|
101
108
|
|
102
|
-
auto timeout = js_to_cbpp<std::optional<std::chrono::milliseconds>>(
|
109
|
+
auto timeout = js_to_cbpp<std::optional<std::chrono::milliseconds>>(
|
110
|
+
jsObj.Get("timeout"));
|
103
111
|
if (timeout.has_value()) {
|
104
112
|
cppObj.timeout(timeout.value());
|
105
113
|
}
|
@@ -197,6 +205,34 @@ struct js_to_cbpp_t<cbcoretxns::document_metadata> {
|
|
197
205
|
}
|
198
206
|
};
|
199
207
|
|
208
|
+
template <>
|
209
|
+
struct js_to_cbpp_t<cbtxns::transaction_keyspace> {
|
210
|
+
static inline cbtxns::transaction_keyspace from_js(Napi::Value jsVal)
|
211
|
+
{
|
212
|
+
auto jsObj = jsVal.ToObject();
|
213
|
+
auto bucket_name = js_to_cbpp<std::string>(jsObj.Get("bucket_name"));
|
214
|
+
auto scope_name =
|
215
|
+
js_to_cbpp<std::optional<std::string>>(jsObj.Get("scope_name"));
|
216
|
+
auto collection_name = js_to_cbpp<std::optional<std::string>>(
|
217
|
+
jsObj.Get("collection_name"));
|
218
|
+
if (scope_name.has_value() && collection_name.has_value()) {
|
219
|
+
return cbtxns::transaction_keyspace(bucket_name, scope_name.value(),
|
220
|
+
collection_name.value());
|
221
|
+
}
|
222
|
+
return cbtxns::transaction_keyspace(bucket_name);
|
223
|
+
}
|
224
|
+
|
225
|
+
static inline Napi::Value to_js(Napi::Env env,
|
226
|
+
const cbtxns::transaction_keyspace &res)
|
227
|
+
{
|
228
|
+
auto resObj = Napi::Object::New(env);
|
229
|
+
resObj.Set("bucket", cbpp_to_js(env, res.bucket));
|
230
|
+
resObj.Set("scope", cbpp_to_js(env, res.scope));
|
231
|
+
resObj.Set("collection", cbpp_to_js(env, res.collection));
|
232
|
+
return resObj;
|
233
|
+
}
|
234
|
+
};
|
235
|
+
|
200
236
|
template <>
|
201
237
|
struct js_to_cbpp_t<cbcoretxns::transaction_get_result> {
|
202
238
|
static inline cbcoretxns::transaction_get_result from_js(Napi::Value jsVal)
|
@@ -387,7 +423,8 @@ struct js_to_cbpp_t<cbcoretxns::op_exception> {
|
|
387
423
|
const cbcoretxns::op_exception &err)
|
388
424
|
{
|
389
425
|
Napi::Error jsErr = Napi::Error::New(env, "transaction_exception");
|
390
|
-
jsErr.Set("ctxtype",
|
426
|
+
jsErr.Set("ctxtype",
|
427
|
+
Napi::String::New(env, "transaction_op_exception"));
|
391
428
|
jsErr.Set("ctx", cbpp_to_js(env, err.ctx()));
|
392
429
|
jsErr.Set("cause", cbpp_to_js(env, err.cause()));
|
393
430
|
return jsErr.Value();
|
package/src/transactions.cpp
CHANGED
@@ -32,7 +32,18 @@ Transactions::Transactions(const Napi::CallbackInfo &info)
|
|
32
32
|
auto cluster = Connection::Unwrap(clusterJsObj)->cluster();
|
33
33
|
|
34
34
|
auto txnsConfig = jsToCbpp<cbtxns::transactions_config>(configJsObj);
|
35
|
-
|
35
|
+
std::future<
|
36
|
+
std::pair<std::error_code, std::shared_ptr<cbcoretxns::transactions>>>
|
37
|
+
future = cbcoretxns::transactions::create(cluster, txnsConfig);
|
38
|
+
std::pair<std::error_code, std::shared_ptr<cbcoretxns::transactions>>
|
39
|
+
result = future.get();
|
40
|
+
if (result.first.value()) {
|
41
|
+
Napi::Error err = Napi::Error::New(info.Env(), result.first.message());
|
42
|
+
err.Set("code", Napi::Number::New(info.Env(), result.first.value()));
|
43
|
+
throw err;
|
44
|
+
}
|
45
|
+
_impl.reset();
|
46
|
+
_impl = std::move(result.second);
|
36
47
|
}
|
37
48
|
|
38
49
|
Transactions::~Transactions()
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright 2022-Present Couchbase, Inc.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
6
|
-
* except in compliance with the License. You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
11
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12
|
-
* ANY KIND, either express or implied. See the License for the specific language governing
|
13
|
-
* permissions and limitations under the License.
|
14
|
-
*/
|
15
|
-
|
16
|
-
#pragma once
|
17
|
-
|
18
|
-
#include "range_scan_options.hxx"
|
19
|
-
|
20
|
-
#include <couchbase/mutation_token.hxx>
|
21
|
-
#include <couchbase/retry_strategy.hxx>
|
22
|
-
|
23
|
-
#include <cinttypes>
|
24
|
-
#include <memory>
|
25
|
-
#include <optional>
|
26
|
-
#include <system_error>
|
27
|
-
#include <variant>
|
28
|
-
#include <vector>
|
29
|
-
|
30
|
-
namespace couchbase
|
31
|
-
{
|
32
|
-
class retry_strategy;
|
33
|
-
namespace tracing
|
34
|
-
{
|
35
|
-
class request_span;
|
36
|
-
} // namespace tracing
|
37
|
-
} // namespace couchbase
|
38
|
-
|
39
|
-
namespace couchbase::core
|
40
|
-
{
|
41
|
-
struct mutation_state {
|
42
|
-
std::vector<couchbase::mutation_token> tokens;
|
43
|
-
};
|
44
|
-
} // namespace couchbase::core
|