couchbase 4.2.11 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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 +84 -53
- 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_orchestrator_options.hxx +2 -1
- 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/cluster.hxx +19 -0
- package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +39 -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 -0
- package/src/jstocbpp_transactions.hpp +40 -3
- package/src/transactions.cpp +12 -1
- package/tools/gen-bindings-json.py +0 -1
@@ -26,6 +26,8 @@
|
|
26
26
|
#include "internal/transactions_cleanup.hxx"
|
27
27
|
#include "internal/utils.hxx"
|
28
28
|
|
29
|
+
#include <system_error>
|
30
|
+
|
29
31
|
namespace couchbase::core::transactions
|
30
32
|
{
|
31
33
|
transactions::transactions(core::cluster cluster, const couchbase::transactions::transactions_config& config)
|
@@ -38,35 +40,60 @@ transactions::transactions(core::cluster cluster, const couchbase::transactions:
|
|
38
40
|
, config_(config)
|
39
41
|
, cleanup_(new transactions_cleanup(cluster_, config_))
|
40
42
|
{
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
}
|
44
|
+
|
45
|
+
transactions::~transactions() = default;
|
46
|
+
|
47
|
+
void
|
48
|
+
transactions::create(core::cluster cluster,
|
49
|
+
const couchbase::transactions::transactions_config::built& config,
|
50
|
+
utils::movable_function<void(std::error_code, std::shared_ptr<transactions>)>&& cb)
|
51
|
+
{
|
52
|
+
if (config.metadata_collection) {
|
53
|
+
// if the config specifies custom metadata collection, lets be sure to open that bucket
|
54
|
+
// on the cluster before we start. NOTE: we actually do call get_and_open_buckets which opens all the buckets
|
55
|
+
// on the cluster (that we have permissions to open) in the cleanup. However, that is happening asynchronously
|
56
|
+
// so there's a chance we will fail to have opened the custom metadata collection bucket before trying to make a
|
57
|
+
// transaction. We have to open this one _now_.
|
58
|
+
|
59
|
+
auto bucket_name = config.metadata_collection->bucket;
|
60
|
+
return cluster.open_bucket(bucket_name, [cluster, config, bucket_name, cb = std::move(cb)](std::error_code ec) mutable {
|
61
|
+
if (ec) {
|
62
|
+
CB_TXN_LOG_ERROR("error opening metadata_collection bucket '{}' specified in the config!", bucket_name);
|
63
|
+
return cb(ec, {});
|
55
64
|
}
|
56
|
-
|
57
|
-
|
65
|
+
|
66
|
+
CB_TXN_LOG_DEBUG("couchbase transactions {} ({}) creating new transaction object",
|
67
|
+
couchbase::core::meta::sdk_id(),
|
68
|
+
couchbase::core::meta::os());
|
69
|
+
return cb({}, std::make_shared<transactions>(std::move(cluster), config));
|
58
70
|
});
|
59
|
-
auto err = f.get();
|
60
|
-
if (err) {
|
61
|
-
auto err_msg =
|
62
|
-
fmt::format("error opening metadata_collection bucket '{}' specified in the config!", config_.metadata_collection->bucket);
|
63
|
-
CB_TXN_LOG_DEBUG("{}", err_msg);
|
64
|
-
throw std::runtime_error(err_msg);
|
65
|
-
}
|
66
71
|
}
|
72
|
+
|
73
|
+
return cb({}, std::make_shared<transactions>(std::move(cluster), config));
|
67
74
|
}
|
68
75
|
|
69
|
-
|
76
|
+
void
|
77
|
+
transactions::create(core::cluster cluster,
|
78
|
+
const couchbase::transactions::transactions_config& config,
|
79
|
+
utils::movable_function<void(std::error_code, std::shared_ptr<transactions>)>&& cb)
|
80
|
+
{
|
81
|
+
return create(std::move(cluster), config.build(), std::move(cb));
|
82
|
+
}
|
83
|
+
|
84
|
+
std::future<std::pair<std::error_code, std::shared_ptr<transactions>>>
|
85
|
+
transactions::create(core::cluster cluster, const couchbase::transactions::transactions_config::built& config)
|
86
|
+
{
|
87
|
+
auto barrier = std::make_shared<std::promise<std::pair<std::error_code, std::shared_ptr<transactions>>>>();
|
88
|
+
create(std::move(cluster), config, [barrier](auto ec, auto txns) mutable { barrier->set_value({ ec, txns }); });
|
89
|
+
return barrier->get_future();
|
90
|
+
}
|
91
|
+
|
92
|
+
std::future<std::pair<std::error_code, std::shared_ptr<transactions>>>
|
93
|
+
transactions::create(core::cluster cluster, const couchbase::transactions::transactions_config& config)
|
94
|
+
{
|
95
|
+
return create(std::move(cluster), config.build());
|
96
|
+
}
|
70
97
|
|
71
98
|
template<typename Handler>
|
72
99
|
::couchbase::transactions::transaction_result
|
@@ -175,6 +202,16 @@ transactions::run(async_logic&& code, txn_complete_callback&& cb)
|
|
175
202
|
return run(config, std::move(code), std::move(cb));
|
176
203
|
}
|
177
204
|
|
205
|
+
void
|
206
|
+
transactions::notify_fork(fork_event event)
|
207
|
+
{
|
208
|
+
if (event == fork_event::prepare) {
|
209
|
+
cleanup_->stop();
|
210
|
+
} else {
|
211
|
+
cleanup_->start();
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
178
215
|
void
|
179
216
|
transactions::close()
|
180
217
|
{
|
@@ -45,18 +45,8 @@ transactions_cleanup::transactions_cleanup(core::cluster cluster, const couchbas
|
|
45
45
|
: cluster_(std::move(cluster))
|
46
46
|
, config_(config)
|
47
47
|
, client_uuid_(uid_generator::next())
|
48
|
-
, running_(config.cleanup_config.cleanup_client_attempts || config.cleanup_config.cleanup_lost_attempts)
|
49
48
|
{
|
50
|
-
|
51
|
-
cleanup_thr_ = std::thread(std::bind(&transactions_cleanup::attempts_loop, this));
|
52
|
-
}
|
53
|
-
if (config_.metadata_collection) {
|
54
|
-
add_collection(
|
55
|
-
{ config_.metadata_collection->bucket, config_.metadata_collection->scope, config_.metadata_collection->collection });
|
56
|
-
}
|
57
|
-
for (auto& k : config_.cleanup_config.collections) {
|
58
|
-
add_collection(k);
|
59
|
-
}
|
49
|
+
start();
|
60
50
|
}
|
61
51
|
|
62
52
|
static std::uint64_t
|
@@ -249,7 +239,9 @@ transactions_cleanup::create_client_record(const couchbase::transactions::transa
|
|
249
239
|
wrap_durable_request(req, config_);
|
250
240
|
auto barrier = std::make_shared<std::promise<result>>();
|
251
241
|
auto f = barrier->get_future();
|
252
|
-
auto ec =
|
242
|
+
auto ec = wait_for_hook([this, bucket = keyspace.bucket](auto handler) mutable {
|
243
|
+
return config_.cleanup_hooks->client_record_before_create(bucket, std::move(handler));
|
244
|
+
});
|
253
245
|
if (ec) {
|
254
246
|
throw client_error(*ec, "client_record_before_create hook raised error");
|
255
247
|
}
|
@@ -285,7 +277,9 @@ transactions_cleanup::get_active_clients(const couchbase::transactions::transact
|
|
285
277
|
.specs();
|
286
278
|
auto barrier = std::make_shared<std::promise<result>>();
|
287
279
|
auto f = barrier->get_future();
|
288
|
-
auto ec =
|
280
|
+
auto ec = wait_for_hook([this, bucket = keyspace.bucket](auto handler) mutable {
|
281
|
+
return config_.cleanup_hooks->client_record_before_get(bucket, std::move(handler));
|
282
|
+
});
|
289
283
|
if (ec) {
|
290
284
|
throw client_error(*ec, "client_record_before_get hook raised error");
|
291
285
|
}
|
@@ -363,7 +357,9 @@ transactions_cleanup::get_active_clients(const couchbase::transactions::transact
|
|
363
357
|
mut_specs.push_back(couchbase::mutate_in_specs::remove(FIELD_CLIENTS + "." + details.expired_client_ids[idx]).xattr());
|
364
358
|
}
|
365
359
|
mutate_req.specs = mut_specs.specs();
|
366
|
-
ec =
|
360
|
+
ec = wait_for_hook([this, bucket = keyspace.bucket](auto handler) mutable {
|
361
|
+
return config_.cleanup_hooks->client_record_before_update(bucket, std::move(handler));
|
362
|
+
});
|
367
363
|
if (ec) {
|
368
364
|
throw client_error(*ec, "client_record_before_update hook raised error");
|
369
365
|
}
|
@@ -401,7 +397,9 @@ transactions_cleanup::remove_client_record_from_all_buckets(const std::string& u
|
|
401
397
|
std::chrono::milliseconds(10), std::chrono::milliseconds(250), std::chrono::milliseconds(500), [this, keyspace, uuid]() {
|
402
398
|
try {
|
403
399
|
// proceed to remove the client uuid if it exists
|
404
|
-
auto ec =
|
400
|
+
auto ec = wait_for_hook([this, bucket = keyspace.bucket](auto handler) mutable {
|
401
|
+
return config_.cleanup_hooks->client_record_before_remove_client(bucket, std::move(handler));
|
402
|
+
});
|
405
403
|
if (ec) {
|
406
404
|
throw client_error(*ec, "client_record_before_remove_client hook raised error");
|
407
405
|
}
|
@@ -546,7 +544,23 @@ transactions_cleanup::add_collection(couchbase::transactions::transaction_keyspa
|
|
546
544
|
}
|
547
545
|
|
548
546
|
void
|
549
|
-
transactions_cleanup::
|
547
|
+
transactions_cleanup::start()
|
548
|
+
{
|
549
|
+
running_ = config_.cleanup_config.cleanup_client_attempts || config_.cleanup_config.cleanup_lost_attempts;
|
550
|
+
if (config_.cleanup_config.cleanup_client_attempts) {
|
551
|
+
cleanup_thr_ = std::thread(std::bind(&transactions_cleanup::attempts_loop, this));
|
552
|
+
}
|
553
|
+
if (config_.metadata_collection) {
|
554
|
+
add_collection(
|
555
|
+
{ config_.metadata_collection->bucket, config_.metadata_collection->scope, config_.metadata_collection->collection });
|
556
|
+
}
|
557
|
+
for (const auto& k : config_.cleanup_config.collections) {
|
558
|
+
add_collection(k);
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
void
|
563
|
+
transactions_cleanup::stop()
|
550
564
|
{
|
551
565
|
{
|
552
566
|
std::unique_lock<std::mutex> lock(mutex_);
|
@@ -563,6 +577,12 @@ transactions_cleanup::close()
|
|
563
577
|
t.join();
|
564
578
|
}
|
565
579
|
}
|
580
|
+
}
|
581
|
+
|
582
|
+
void
|
583
|
+
transactions_cleanup::close()
|
584
|
+
{
|
585
|
+
stop();
|
566
586
|
CB_LOST_ATTEMPT_CLEANUP_LOG_DEBUG("all lost attempt cleanup threads closed");
|
567
587
|
remove_client_record_from_all_buckets(client_uuid_);
|
568
588
|
}
|
@@ -92,6 +92,15 @@ wrap_operation_future(std::future<result>& fut, bool ignore_subdoc_errors)
|
|
92
92
|
return res;
|
93
93
|
}
|
94
94
|
|
95
|
+
std::optional<error_class>
|
96
|
+
wait_for_hook(std::function<void(utils::movable_function<void(std::optional<error_class>)>)> hook)
|
97
|
+
{
|
98
|
+
auto hook_barrier = std::make_shared<std::promise<std::optional<error_class>>>();
|
99
|
+
auto hook_future = hook_barrier->get_future();
|
100
|
+
hook([hook_barrier](std::optional<error_class> ec) mutable { return hook_barrier->set_value(ec); });
|
101
|
+
return hook_future.get();
|
102
|
+
}
|
103
|
+
|
95
104
|
template<>
|
96
105
|
bool
|
97
106
|
is_error(const core::operations::mutate_in_response& resp)
|
@@ -18,20 +18,24 @@
|
|
18
18
|
|
19
19
|
#include <couchbase/transactions.hxx>
|
20
20
|
|
21
|
-
#include
|
22
|
-
#include
|
23
|
-
#include
|
21
|
+
#include <couchbase/fork_event.hxx>
|
22
|
+
#include <couchbase/transactions/transaction_options.hxx>
|
23
|
+
#include <couchbase/transactions/transaction_result.hxx>
|
24
|
+
#include <couchbase/transactions/transactions_config.hxx>
|
25
|
+
|
24
26
|
#include "transactions/async_attempt_context.hxx"
|
25
27
|
#include "transactions/attempt_context.hxx"
|
26
28
|
#include "transactions/exceptions.hxx"
|
27
29
|
|
28
30
|
#include "core/cluster.hxx"
|
29
31
|
#include "core/logger/logger.hxx"
|
32
|
+
#include "core/utils/movable_function.hxx"
|
30
33
|
|
31
34
|
#include <spdlog/common.h>
|
32
35
|
|
33
36
|
#include <cmath>
|
34
37
|
#include <functional>
|
38
|
+
#include <system_error>
|
35
39
|
#include <thread>
|
36
40
|
|
37
41
|
// workaround for MSVC define overlap with log levels
|
@@ -127,6 +131,11 @@ using txn_complete_callback =
|
|
127
131
|
class transactions : public couchbase::transactions::transactions
|
128
132
|
{
|
129
133
|
public:
|
134
|
+
/**
|
135
|
+
* @brief Destructor
|
136
|
+
*/
|
137
|
+
~transactions();
|
138
|
+
|
130
139
|
/**
|
131
140
|
* @brief Create a transactions object.
|
132
141
|
*
|
@@ -134,14 +143,30 @@ class transactions : public couchbase::transactions::transactions
|
|
134
143
|
*
|
135
144
|
* @param cluster The cluster to use for the transactions.
|
136
145
|
* @param config The configuration parameters to use for the transactions.
|
146
|
+
* @param cb Called when the transactions object has been created or an error has occurred during the creation.
|
137
147
|
*/
|
138
|
-
|
139
|
-
|
148
|
+
static void create(core::cluster cluster,
|
149
|
+
const couchbase::transactions::transactions_config::built&,
|
150
|
+
utils::movable_function<void(std::error_code, std::shared_ptr<transactions>)>&& cb);
|
151
|
+
static void create(core::cluster cluster,
|
152
|
+
const couchbase::transactions::transactions_config&,
|
153
|
+
utils::movable_function<void(std::error_code, std::shared_ptr<transactions>)>&& cb);
|
140
154
|
|
141
155
|
/**
|
142
|
-
* @brief
|
156
|
+
* @brief Create a transactions object.
|
157
|
+
*
|
158
|
+
* Creates a transactions object, which can be used to run transactions within the current thread.
|
159
|
+
*
|
160
|
+
* @param cluster The cluster to use for the transactions.
|
161
|
+
* @param config The configuration parameters to use for the transactions.
|
162
|
+
* @return a future containing the error that occurred or the transactions object.
|
143
163
|
*/
|
144
|
-
|
164
|
+
static std::future<std::pair<std::error_code, std::shared_ptr<transactions>>> create(
|
165
|
+
core::cluster cluster,
|
166
|
+
const couchbase::transactions::transactions_config::built& config);
|
167
|
+
static std::future<std::pair<std::error_code, std::shared_ptr<transactions>>> create(
|
168
|
+
core::cluster cluster,
|
169
|
+
const couchbase::transactions::transactions_config& config);
|
145
170
|
|
146
171
|
/**
|
147
172
|
* @brief Run a transaction
|
@@ -199,6 +224,8 @@ class transactions : public couchbase::transactions::transactions
|
|
199
224
|
ctx.rollback();
|
200
225
|
}
|
201
226
|
|
227
|
+
void notify_fork(fork_event event);
|
228
|
+
|
202
229
|
/**
|
203
230
|
* @brief Shut down the transactions object
|
204
231
|
*
|
@@ -245,6 +272,12 @@ class transactions : public couchbase::transactions::transactions
|
|
245
272
|
return cluster_;
|
246
273
|
}
|
247
274
|
|
275
|
+
/**
|
276
|
+
* @internal
|
277
|
+
*/
|
278
|
+
transactions(core::cluster cluster, const couchbase::transactions::transactions_config::built& config);
|
279
|
+
transactions(core::cluster cluster, const couchbase::transactions::transactions_config& config);
|
280
|
+
|
248
281
|
private:
|
249
282
|
core::cluster cluster_;
|
250
283
|
couchbase::transactions::transactions_config::built config_;
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#include <couchbase/bucket_manager.hxx>
|
24
24
|
#include <couchbase/cluster_options.hxx>
|
25
25
|
#include <couchbase/diagnostics_options.hxx>
|
26
|
+
#include <couchbase/fork_event.hxx>
|
26
27
|
#include <couchbase/ping_options.hxx>
|
27
28
|
#include <couchbase/query_index_manager.hxx>
|
28
29
|
#include <couchbase/query_options.hxx>
|
@@ -40,6 +41,11 @@ namespace couchbase
|
|
40
41
|
namespace core
|
41
42
|
{
|
42
43
|
class cluster;
|
44
|
+
|
45
|
+
namespace transactions
|
46
|
+
{
|
47
|
+
class transactions;
|
48
|
+
}
|
43
49
|
} // namespace core
|
44
50
|
class cluster_impl;
|
45
51
|
#endif
|
@@ -90,6 +96,8 @@ class cluster
|
|
90
96
|
auto operator=(const cluster& other) -> cluster& = default;
|
91
97
|
auto operator=(cluster&& other) -> cluster& = default;
|
92
98
|
|
99
|
+
void notify_fork(fork_event event);
|
100
|
+
|
93
101
|
void close() const;
|
94
102
|
|
95
103
|
/**
|
@@ -102,6 +110,17 @@ class cluster
|
|
102
110
|
*/
|
103
111
|
explicit cluster(core::cluster core);
|
104
112
|
|
113
|
+
/**
|
114
|
+
* Wraps low-level implementation of the SDK & transactions
|
115
|
+
*
|
116
|
+
* @param core pointer to the low-level SDK handle
|
117
|
+
* @param transactions pointer to the lowe-level transactions handle
|
118
|
+
*
|
119
|
+
* @since 1.0.0
|
120
|
+
* @volatile
|
121
|
+
*/
|
122
|
+
explicit cluster(core::cluster core, std::shared_ptr<core::transactions::transactions> transactions);
|
123
|
+
|
105
124
|
/**
|
106
125
|
* Opens a {@link bucket} with the given name.
|
107
126
|
*
|
@@ -0,0 +1,39 @@
|
|
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
|
+
namespace couchbase
|
21
|
+
{
|
22
|
+
enum class fork_event {
|
23
|
+
/**
|
24
|
+
* Notify the cluster that the process is about to fork.
|
25
|
+
*/
|
26
|
+
prepare,
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Notify the context that the process has forked and is the parent.
|
30
|
+
*/
|
31
|
+
parent,
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Notify the context that the process has forked and is the child.
|
35
|
+
*/
|
36
|
+
child,
|
37
|
+
};
|
38
|
+
|
39
|
+
} // namespace couchbase
|
package/dist/binding.d.ts
CHANGED
@@ -885,6 +885,8 @@ export interface CppSearchRequest {
|
|
885
885
|
};
|
886
886
|
client_context_id?: string;
|
887
887
|
timeout?: CppMilliseconds;
|
888
|
+
log_request?: boolean;
|
889
|
+
log_response?: boolean;
|
888
890
|
body_str: string;
|
889
891
|
}
|
890
892
|
export interface CppTouchResponse {
|
@@ -2670,6 +2672,11 @@ export interface CppConnection extends CppConnectionAutogen {
|
|
2670
2672
|
result: CppScanIterator;
|
2671
2673
|
};
|
2672
2674
|
}
|
2675
|
+
export interface CppTransactionKeyspace {
|
2676
|
+
bucket_name: string;
|
2677
|
+
scope_name?: string;
|
2678
|
+
collection_name?: string;
|
2679
|
+
}
|
2673
2680
|
export interface CppTransactionsConfig {
|
2674
2681
|
durability_level?: CppDurabilityLevel;
|
2675
2682
|
timeout?: CppMilliseconds;
|
@@ -2677,6 +2684,7 @@ export interface CppTransactionsConfig {
|
|
2677
2684
|
cleanup_window?: CppMilliseconds;
|
2678
2685
|
cleanup_lost_attempts?: boolean;
|
2679
2686
|
cleanup_client_attempts?: boolean;
|
2687
|
+
metadata_collection?: CppTransactionKeyspace;
|
2680
2688
|
}
|
2681
2689
|
export interface CppTransactionOptions {
|
2682
2690
|
durability_level?: CppDurabilityLevel;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AnalyticsScanConsistency, AnalyticsStatus } from './analyticstypes';
|
2
|
-
import { CppAnalyticsResponseAnalyticsStatus, CppAnalyticsScanConsistency, CppDesignDocumentNamespace, CppDiagEndpointState, CppDiagPingState, CppDurabilityLevel, CppError, CppManagementClusterBucketCompression, CppManagementClusterBucketConflictResolution, CppManagementClusterBucketEvictionPolicy, CppManagementClusterBucketStorageBackend, CppManagementClusterBucketType, CppMutationState, CppPersistTo, CppPrefixScan, CppQueryProfile, CppQueryScanConsistency, CppRangeScan, CppReplicateTo, CppSamplingScan, CppSearchHighlightStyle, CppSearchScanConsistency, CppServiceType, CppStoreSemantics, CppTxnExternalException, CppTxnOpException, CppVectorQueryCombination, CppViewScanConsistency, CppViewSortOrder } from './binding';
|
2
|
+
import { CppAnalyticsResponseAnalyticsStatus, CppAnalyticsScanConsistency, CppDesignDocumentNamespace, CppDiagEndpointState, CppDiagPingState, CppDurabilityLevel, CppError, CppManagementClusterBucketCompression, CppManagementClusterBucketConflictResolution, CppManagementClusterBucketEvictionPolicy, CppManagementClusterBucketStorageBackend, CppManagementClusterBucketType, CppMutationState, CppPersistTo, CppPrefixScan, CppQueryProfile, CppQueryScanConsistency, CppRangeScan, CppReplicateTo, CppSamplingScan, CppSearchHighlightStyle, CppSearchScanConsistency, CppServiceType, CppStoreSemantics, CppTransactionKeyspace, CppTxnExternalException, CppTxnOpException, CppVectorQueryCombination, CppViewScanConsistency, CppViewSortOrder } from './binding';
|
3
3
|
import { BucketType, CompressionMode, ConflictResolutionType, EvictionPolicy, StorageBackend } from './bucketmanager';
|
4
4
|
import { EndpointState, PingState } from './diagnosticstypes';
|
5
5
|
import { ErrorContext } from './errorcontexts';
|
@@ -8,6 +8,7 @@ import { MutationState } from './mutationstate';
|
|
8
8
|
import { QueryProfileMode, QueryScanConsistency } from './querytypes';
|
9
9
|
import { PrefixScan, RangeScan, SamplingScan } from './rangeScan';
|
10
10
|
import { HighlightStyle, SearchScanConsistency } from './searchtypes';
|
11
|
+
import { TransactionKeyspace } from './transactions';
|
11
12
|
import { VectorQueryCombination } from './vectorsearch';
|
12
13
|
import { DesignDocumentNamespace, ViewOrdering, ViewScanConsistency } from './viewtypes';
|
13
14
|
/**
|
@@ -154,3 +155,7 @@ export declare function designDocumentNamespaceFromCpp(namespace: CppDesignDocum
|
|
154
155
|
* @internal
|
155
156
|
*/
|
156
157
|
export declare function designDocumentNamespaceToCpp(namespace: DesignDocumentNamespace): CppDesignDocumentNamespace;
|
158
|
+
/**
|
159
|
+
* @internal
|
160
|
+
*/
|
161
|
+
export declare function transactionKeyspaceToCpp(keyspace?: TransactionKeyspace): CppTransactionKeyspace | undefined;
|
package/dist/bindingutilities.js
CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.designDocumentNamespaceToCpp = exports.designDocumentNamespaceFromCpp = exports.vectorQueryCombinationToCpp = exports.bucketConflictResolutionTypeFromCpp = exports.bucketConflictResolutionTypeToCpp = exports.bucketStorageBackendFromCpp = exports.bucketStorageBackendToCpp = exports.bucketEvictionPolicyFromCpp = exports.bucketEvictionPolicyToCpp = exports.bucketCompressionModeFromCpp = exports.bucketCompressionModeToCpp = exports.bucketTypeFromCpp = exports.bucketTypeToCpp = exports.scanTypeToCpp = exports.errorFromCpp = exports.contextFromCpp = exports.pingStateFromCpp = exports.txnOpExeptionFromCpp = exports.txnExternalExceptionStringFromCpp = exports.endpointStateFromCpp = exports.serviceTypeFromCpp = exports.serviceTypeToCpp = exports.mutationStateToCpp = exports.searchHighlightStyleToCpp = exports.searchScanConsistencyToCpp = exports.analyticsStatusFromCpp = exports.analyticsScanConsistencyToCpp = exports.queryProfileToCpp = exports.queryScanConsistencyToCpp = exports.viewOrderingToCpp = exports.viewScanConsistencyToCpp = exports.storeSemanticToCpp = exports.replicateToToCpp = exports.persistToToCpp = exports.durabilityFromCpp = exports.durabilityToCpp = void 0;
|
29
|
+
exports.transactionKeyspaceToCpp = exports.designDocumentNamespaceToCpp = exports.designDocumentNamespaceFromCpp = exports.vectorQueryCombinationToCpp = exports.bucketConflictResolutionTypeFromCpp = exports.bucketConflictResolutionTypeToCpp = exports.bucketStorageBackendFromCpp = exports.bucketStorageBackendToCpp = exports.bucketEvictionPolicyFromCpp = exports.bucketEvictionPolicyToCpp = exports.bucketCompressionModeFromCpp = exports.bucketCompressionModeToCpp = exports.bucketTypeFromCpp = exports.bucketTypeToCpp = exports.scanTypeToCpp = exports.errorFromCpp = exports.contextFromCpp = exports.pingStateFromCpp = exports.txnOpExeptionFromCpp = exports.txnExternalExceptionStringFromCpp = exports.endpointStateFromCpp = exports.serviceTypeFromCpp = exports.serviceTypeToCpp = exports.mutationStateToCpp = exports.searchHighlightStyleToCpp = exports.searchScanConsistencyToCpp = exports.analyticsStatusFromCpp = exports.analyticsScanConsistencyToCpp = exports.queryProfileToCpp = exports.queryScanConsistencyToCpp = exports.viewOrderingToCpp = exports.viewScanConsistencyToCpp = exports.storeSemanticToCpp = exports.replicateToToCpp = exports.persistToToCpp = exports.durabilityFromCpp = exports.durabilityToCpp = void 0;
|
30
30
|
const analyticstypes_1 = require("./analyticstypes");
|
31
31
|
const binding_1 = __importDefault(require("./binding"));
|
32
32
|
const bucketmanager_1 = require("./bucketmanager");
|
@@ -1051,3 +1051,17 @@ function designDocumentNamespaceToCpp(namespace) {
|
|
1051
1051
|
throw new errs.InvalidArgumentError(new Error('Unrecognized DesignDocumentNamespace.'));
|
1052
1052
|
}
|
1053
1053
|
exports.designDocumentNamespaceToCpp = designDocumentNamespaceToCpp;
|
1054
|
+
/**
|
1055
|
+
* @internal
|
1056
|
+
*/
|
1057
|
+
function transactionKeyspaceToCpp(keyspace) {
|
1058
|
+
var _a, _b;
|
1059
|
+
if (!keyspace)
|
1060
|
+
return undefined;
|
1061
|
+
return {
|
1062
|
+
bucket_name: keyspace.bucket,
|
1063
|
+
scope_name: (_a = keyspace.scope) !== null && _a !== void 0 ? _a : '_default',
|
1064
|
+
collection_name: (_b = keyspace.collection) !== null && _b !== void 0 ? _b : '_default',
|
1065
|
+
};
|
1066
|
+
}
|
1067
|
+
exports.transactionKeyspaceToCpp = transactionKeyspaceToCpp;
|
package/dist/bucketmanager.d.ts
CHANGED
@@ -163,8 +163,6 @@ export interface IBucketSettings {
|
|
163
163
|
*/
|
164
164
|
minimumDurabilityLevel?: DurabilityLevel | string;
|
165
165
|
/**
|
166
|
-
* Uncommitted: This API is subject to change in the future.
|
167
|
-
*
|
168
166
|
* Specifies the default history retention on all collections in this bucket.
|
169
167
|
* Only available on Magma Buckets.
|
170
168
|
*
|
@@ -172,14 +170,10 @@ export interface IBucketSettings {
|
|
172
170
|
*/
|
173
171
|
historyRetentionCollectionDefault?: boolean;
|
174
172
|
/**
|
175
|
-
* Uncommitted: This API is subject to change in the future.
|
176
|
-
*
|
177
173
|
* Specifies the maximum history retention in bytes on all collections in this bucket.
|
178
174
|
*/
|
179
175
|
historyRetentionBytes?: number;
|
180
176
|
/**
|
181
|
-
* Uncommitted: This API is subject to change in the future.
|
182
|
-
*
|
183
177
|
* Specifies the maximum duration in seconds to be covered by the change history that is written
|
184
178
|
* to disk for all collections in this bucket.
|
185
179
|
*/
|
@@ -261,8 +255,6 @@ export declare class BucketSettings implements IBucketSettings {
|
|
261
255
|
*/
|
262
256
|
minimumDurabilityLevel?: DurabilityLevel;
|
263
257
|
/**
|
264
|
-
* Uncommitted: This API is subject to change in the future.
|
265
|
-
*
|
266
258
|
* Specifies the default history retention on all collections in this bucket.
|
267
259
|
* Only available on Magma Buckets.
|
268
260
|
*
|
@@ -270,14 +262,10 @@ export declare class BucketSettings implements IBucketSettings {
|
|
270
262
|
*/
|
271
263
|
historyRetentionCollectionDefault?: boolean;
|
272
264
|
/**
|
273
|
-
* Uncommitted: This API is subject to change in the future.
|
274
|
-
*
|
275
265
|
* Specifies the maximum history retention in bytes on all collections in this bucket.
|
276
266
|
*/
|
277
267
|
historyRetentionBytes?: number;
|
278
268
|
/**
|
279
|
-
* Uncommitted: This API is subject to change in the future.
|
280
|
-
*
|
281
269
|
* Specifies the maximum duration in seconds to be covered by the change history that is written
|
282
270
|
* to disk for all collections in this bucket.
|
283
271
|
*/
|
package/dist/cluster.d.ts
CHANGED
@@ -303,8 +303,6 @@ export declare class Cluster {
|
|
303
303
|
/**
|
304
304
|
* Executes a search query against the cluster.
|
305
305
|
*
|
306
|
-
* Volatile: This API is subject to change at any time.
|
307
|
-
*
|
308
306
|
* @param indexName The name of the index to query.
|
309
307
|
* @param request The SearchRequest describing the search to execute.
|
310
308
|
* @param options Optional parameters for this operation.
|
package/dist/cluster.js
CHANGED
@@ -320,8 +320,6 @@ class Cluster {
|
|
320
320
|
/**
|
321
321
|
* Executes a search query against the cluster.
|
322
322
|
*
|
323
|
-
* Volatile: This API is subject to change at any time.
|
324
|
-
*
|
325
323
|
* @param indexName The name of the index to query.
|
326
324
|
* @param request The SearchRequest describing the search to execute.
|
327
325
|
* @param options Optional parameters for this operation.
|
package/dist/collection.d.ts
CHANGED
@@ -345,8 +345,6 @@ export interface MutateInOptions {
|
|
345
345
|
upsertDocument?: boolean;
|
346
346
|
}
|
347
347
|
/**
|
348
|
-
* Volatile: This API is subject to change at any time.
|
349
|
-
*
|
350
348
|
* @category Key-Value
|
351
349
|
*/
|
352
350
|
export interface ScanOptions {
|
@@ -574,7 +572,9 @@ export declare class Collection {
|
|
574
572
|
/**
|
575
573
|
* Performs a key-value scan operation.
|
576
574
|
*
|
577
|
-
*
|
575
|
+
* Use this API for low concurrency batch queries where latency is not a critical as the system
|
576
|
+
* may have to scan a lot of documents to find the matching documents.
|
577
|
+
* For low latency range queries, it is recommended that you use SQL++ with the necessary indexes.
|
578
578
|
*
|
579
579
|
* @param scanType The type of scan to execute.
|
580
580
|
* @param options Optional parameters for the scan operation.
|
package/dist/collection.js
CHANGED
@@ -876,7 +876,9 @@ class Collection {
|
|
876
876
|
/**
|
877
877
|
* Performs a key-value scan operation.
|
878
878
|
*
|
879
|
-
*
|
879
|
+
* Use this API for low concurrency batch queries where latency is not a critical as the system
|
880
|
+
* may have to scan a lot of documents to find the matching documents.
|
881
|
+
* For low latency range queries, it is recommended that you use SQL++ with the necessary indexes.
|
880
882
|
*
|
881
883
|
* @param scanType The type of scan to execute.
|
882
884
|
* @param options Optional parameters for the scan operation.
|
package/dist/querytypes.d.ts
CHANGED
@@ -281,8 +281,6 @@ export interface QueryOptions {
|
|
281
281
|
*/
|
282
282
|
readOnly?: boolean;
|
283
283
|
/**
|
284
|
-
* Uncommitted: This API is subject to change in the future.
|
285
|
-
*
|
286
284
|
* Specifies whether the query engine should use replica nodes for kv fetches,
|
287
285
|
* if the active node is down.
|
288
286
|
*/
|
package/dist/rangeScan.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* Represents a search term for a RangeScan.
|
3
3
|
*
|
4
|
-
* Volatile: This API is subject to change at any time.
|
5
|
-
*
|
6
4
|
* @see {@link RangeScan}
|
7
5
|
* @category Key-Value
|
8
6
|
*/
|
@@ -36,8 +34,6 @@ export interface ScanType {
|
|
36
34
|
* A RangeScan performs a scan on a range of keys with the range specified through
|
37
35
|
* a start and end ScanTerm.
|
38
36
|
*
|
39
|
-
* Volatile: This API is subject to change at any time.
|
40
|
-
*
|
41
37
|
* @category Key-Value
|
42
38
|
*/
|
43
39
|
export declare class RangeScan implements ScanType {
|
@@ -62,8 +58,6 @@ export declare class RangeScan implements ScanType {
|
|
62
58
|
* A SamplingScan performs a scan on a random sampling of keys with the sampling bounded by
|
63
59
|
* a limit.
|
64
60
|
*
|
65
|
-
* Volatile: This API is subject to change at any time.
|
66
|
-
*
|
67
61
|
* @category Key-Value
|
68
62
|
*/
|
69
63
|
export declare class SamplingScan implements ScanType {
|
@@ -87,8 +81,6 @@ export declare class SamplingScan implements ScanType {
|
|
87
81
|
/**
|
88
82
|
* A PrefixScan scan type selects every document whose ID starts with a certain prefix.
|
89
83
|
*
|
90
|
-
* Volatile: This API is subject to change at any time.
|
91
|
-
*
|
92
84
|
* @category key-value
|
93
85
|
*/
|
94
86
|
export declare class PrefixScan implements ScanType {
|