couchbase 3.0.0.alpha.5-universal-darwin-19 → 3.0.0.beta.1-universal-darwin-19
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.
- checksums.yaml +4 -4
- data/Gemfile +12 -3
- data/README.md +4 -2
- data/Rakefile +1 -1
- data/couchbase.gemspec +17 -12
- data/ext/.idea/misc.xml +12 -0
- data/ext/CMakeLists.txt +10 -1
- data/ext/build_config.hxx.in +20 -0
- data/ext/build_version.hxx.in +1 -1
- data/ext/couchbase/bucket.hxx +90 -24
- data/ext/couchbase/cluster.hxx +125 -84
- data/ext/couchbase/cluster_options.hxx +53 -0
- data/ext/couchbase/configuration.hxx +220 -2
- data/ext/couchbase/couchbase.cxx +134 -127
- data/ext/couchbase/io/dns_client.hxx +3 -1
- data/ext/couchbase/io/http_command.hxx +91 -0
- data/ext/couchbase/io/http_session.hxx +58 -19
- data/ext/couchbase/io/http_session_manager.hxx +26 -31
- data/ext/couchbase/io/mcbp_command.hxx +180 -0
- data/ext/couchbase/io/mcbp_message.hxx +5 -0
- data/ext/couchbase/io/mcbp_session.hxx +213 -98
- data/ext/couchbase/io/streams.hxx +165 -0
- data/ext/couchbase/operations.hxx +1 -1
- data/ext/couchbase/operations/analytics_dataset_create.hxx +1 -1
- data/ext/couchbase/operations/bucket_create.hxx +4 -2
- data/ext/couchbase/operations/bucket_drop.hxx +4 -2
- data/ext/couchbase/operations/bucket_flush.hxx +4 -2
- data/ext/couchbase/operations/bucket_get.hxx +4 -2
- data/ext/couchbase/operations/bucket_get_all.hxx +4 -2
- data/ext/couchbase/operations/bucket_update.hxx +4 -2
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +4 -2
- data/ext/couchbase/operations/collection_create.hxx +4 -2
- data/ext/couchbase/operations/collection_drop.hxx +4 -2
- data/ext/couchbase/operations/document_analytics.hxx +0 -4
- data/ext/couchbase/operations/document_decrement.hxx +6 -3
- data/ext/couchbase/operations/document_get.hxx +3 -0
- data/ext/couchbase/operations/document_get_and_lock.hxx +3 -0
- data/ext/couchbase/operations/document_get_and_touch.hxx +5 -2
- data/ext/couchbase/operations/document_get_projected.hxx +12 -9
- data/ext/couchbase/operations/document_increment.hxx +6 -3
- data/ext/couchbase/operations/document_insert.hxx +5 -2
- data/ext/couchbase/operations/document_lookup_in.hxx +3 -0
- data/ext/couchbase/operations/document_mutate_in.hxx +6 -3
- data/ext/couchbase/operations/document_remove.hxx +3 -0
- data/ext/couchbase/operations/document_replace.hxx +5 -2
- data/ext/couchbase/operations/document_search.hxx +6 -7
- data/ext/couchbase/operations/document_touch.hxx +5 -2
- data/ext/couchbase/operations/document_unlock.hxx +3 -0
- data/ext/couchbase/operations/document_upsert.hxx +5 -2
- data/ext/couchbase/operations/query_index_build_deferred.hxx +3 -3
- data/ext/couchbase/operations/query_index_create.hxx +3 -3
- data/ext/couchbase/operations/query_index_drop.hxx +3 -3
- data/ext/couchbase/operations/query_index_get_all.hxx +3 -3
- data/ext/couchbase/operations/scope_create.hxx +4 -2
- data/ext/couchbase/operations/scope_drop.hxx +4 -2
- data/ext/couchbase/operations/scope_get_all.hxx +4 -2
- data/ext/couchbase/operations/search_index_analyze_document.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_ingest.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_query.hxx +2 -2
- data/ext/couchbase/operations/search_index_drop.hxx +2 -2
- data/ext/couchbase/operations/search_index_get.hxx +2 -2
- data/ext/couchbase/operations/search_index_get_all.hxx +2 -2
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +2 -2
- data/ext/couchbase/operations/search_index_upsert.hxx +2 -2
- data/ext/couchbase/origin.hxx +148 -0
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +1 -6
- data/ext/couchbase/protocol/cmd_decrement.hxx +5 -5
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +5 -5
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +1 -6
- data/ext/couchbase/protocol/cmd_increment.hxx +5 -5
- data/ext/couchbase/protocol/cmd_info.hxx +0 -11
- data/ext/couchbase/protocol/cmd_insert.hxx +5 -5
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +6 -6
- data/ext/couchbase/protocol/cmd_replace.hxx +5 -5
- data/ext/couchbase/protocol/cmd_touch.hxx +1 -1
- data/ext/couchbase/protocol/cmd_upsert.hxx +5 -5
- data/ext/couchbase/timeout_defaults.hxx +7 -0
- data/ext/couchbase/utils/connection_string.hxx +139 -0
- data/ext/extconf.rb +44 -11
- data/ext/test/main.cxx +93 -15
- data/ext/third_party/http_parser/Makefile +160 -0
- data/ext/third_party/json/Makefile +77 -0
- data/lib/couchbase/analytics_options.rb +18 -4
- data/lib/couchbase/binary_collection.rb +2 -2
- data/lib/couchbase/binary_collection_options.rb +2 -2
- data/lib/couchbase/bucket.rb +4 -4
- data/lib/couchbase/cluster.rb +60 -46
- data/lib/couchbase/collection.rb +13 -13
- data/lib/couchbase/collection_options.rb +15 -9
- data/{bin/console → lib/couchbase/datastructures.rb} +4 -7
- data/lib/couchbase/datastructures/couchbase_list.rb +171 -0
- data/lib/couchbase/datastructures/couchbase_map.rb +205 -0
- data/lib/couchbase/datastructures/couchbase_queue.rb +145 -0
- data/lib/couchbase/datastructures/couchbase_set.rb +138 -0
- data/lib/couchbase/errors.rb +66 -63
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/user_manager.rb +1 -1
- data/lib/couchbase/mutation_state.rb +1 -0
- data/lib/couchbase/query_options.rb +25 -2
- data/lib/couchbase/scope.rb +0 -7
- data/lib/couchbase/search_options.rb +7 -0
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase/view_options.rb +4 -3
- metadata +20 -82
- data/.github/workflows/tests-6.0.3.yml +0 -52
- data/.github/workflows/tests-dev-preview.yml +0 -55
- data/.github/workflows/tests.yml +0 -50
- data/.gitignore +0 -20
- data/.gitmodules +0 -21
- data/.idea/.gitignore +0 -5
- data/.idea/dictionaries/gem_terms.xml +0 -18
- data/.idea/inspectionProfiles/Project_Default.xml +0 -8
- data/.idea/vcs.xml +0 -13
- data/bin/check-cluster +0 -31
- data/bin/fetch-stats +0 -19
- data/bin/init-cluster +0 -82
- data/bin/jenkins/build-extension +0 -35
- data/bin/jenkins/install-dependencies +0 -47
- data/bin/jenkins/test-with-cbdyncluster +0 -58
- data/bin/setup +0 -24
- data/ext/couchbase/configuration_monitor.hxx +0 -93
- data/ext/couchbase/operations/command.hxx +0 -163
- data/rbi/couchbase.rbi +0 -79
@@ -0,0 +1,165 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020 Couchbase, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#pragma once
|
19
|
+
|
20
|
+
#include <functional>
|
21
|
+
|
22
|
+
#include <asio.hpp>
|
23
|
+
#include <asio/ssl.hpp>
|
24
|
+
|
25
|
+
namespace couchbase::io
|
26
|
+
{
|
27
|
+
|
28
|
+
class stream_impl
|
29
|
+
{
|
30
|
+
protected:
|
31
|
+
asio::strand<asio::io_context::executor_type> strand_;
|
32
|
+
bool tls_;
|
33
|
+
|
34
|
+
public:
|
35
|
+
stream_impl(asio::io_context& ctx, bool is_tls)
|
36
|
+
: strand_(asio::make_strand(ctx))
|
37
|
+
, tls_(is_tls)
|
38
|
+
{
|
39
|
+
}
|
40
|
+
|
41
|
+
virtual ~stream_impl() = default;
|
42
|
+
|
43
|
+
[[nodiscard]] std::string_view log_prefix() const
|
44
|
+
{
|
45
|
+
return tls_ ? "tls" : "plain";
|
46
|
+
}
|
47
|
+
|
48
|
+
[[nodiscard]] virtual bool is_open() const = 0;
|
49
|
+
|
50
|
+
virtual void close() = 0;
|
51
|
+
|
52
|
+
virtual void set_options() = 0;
|
53
|
+
|
54
|
+
virtual void async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
55
|
+
std::function<void(std::error_code)>&& handler) = 0;
|
56
|
+
|
57
|
+
virtual void async_write(std::vector<asio::const_buffer>& buffers, std::function<void(std::error_code, std::size_t)>&& handler) = 0;
|
58
|
+
|
59
|
+
virtual void async_read_some(asio::mutable_buffer buffer, std::function<void(std::error_code, std::size_t)>&& handler) = 0;
|
60
|
+
};
|
61
|
+
|
62
|
+
class plain_stream_impl : public stream_impl
|
63
|
+
{
|
64
|
+
private:
|
65
|
+
asio::ip::tcp::socket stream_;
|
66
|
+
|
67
|
+
public:
|
68
|
+
explicit plain_stream_impl(asio::io_context& ctx)
|
69
|
+
: stream_impl(ctx, false)
|
70
|
+
, stream_(strand_)
|
71
|
+
{
|
72
|
+
}
|
73
|
+
|
74
|
+
[[nodiscard]] bool is_open() const override
|
75
|
+
{
|
76
|
+
return stream_.is_open();
|
77
|
+
}
|
78
|
+
|
79
|
+
void close() override
|
80
|
+
{
|
81
|
+
stream_.close();
|
82
|
+
}
|
83
|
+
|
84
|
+
void set_options() override
|
85
|
+
{
|
86
|
+
stream_.set_option(asio::ip::tcp::no_delay{ true });
|
87
|
+
stream_.set_option(asio::socket_base::keep_alive{ true });
|
88
|
+
}
|
89
|
+
|
90
|
+
void async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
91
|
+
std::function<void(std::error_code)>&& handler) override
|
92
|
+
{
|
93
|
+
return stream_.async_connect(endpoint, handler);
|
94
|
+
}
|
95
|
+
|
96
|
+
void async_write(std::vector<asio::const_buffer>& buffers, std::function<void(std::error_code, std::size_t)>&& handler) override
|
97
|
+
{
|
98
|
+
return asio::async_write(stream_, buffers, handler);
|
99
|
+
}
|
100
|
+
|
101
|
+
void async_read_some(asio::mutable_buffer buffer, std::function<void(std::error_code, std::size_t)>&& handler) override
|
102
|
+
{
|
103
|
+
return stream_.async_read_some(buffer, handler);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
class tls_stream_impl : public stream_impl
|
108
|
+
{
|
109
|
+
private:
|
110
|
+
asio::ssl::stream<asio::ip::tcp::socket> stream_;
|
111
|
+
|
112
|
+
public:
|
113
|
+
tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls)
|
114
|
+
: stream_impl(ctx, true)
|
115
|
+
, stream_(ctx, tls)
|
116
|
+
{
|
117
|
+
}
|
118
|
+
|
119
|
+
[[nodiscard]] bool is_open() const override
|
120
|
+
{
|
121
|
+
return stream_.lowest_layer().is_open();
|
122
|
+
}
|
123
|
+
|
124
|
+
void close() override
|
125
|
+
{
|
126
|
+
stream_.lowest_layer().close();
|
127
|
+
}
|
128
|
+
|
129
|
+
void set_options() override
|
130
|
+
{
|
131
|
+
stream_.lowest_layer().set_option(asio::ip::tcp::no_delay{ true });
|
132
|
+
stream_.lowest_layer().set_option(asio::socket_base::keep_alive{ true });
|
133
|
+
}
|
134
|
+
|
135
|
+
void async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
136
|
+
std::function<void(std::error_code)>&& handler) override
|
137
|
+
{
|
138
|
+
return stream_.lowest_layer().async_connect(endpoint, [this, handler](std::error_code ec_connect) mutable {
|
139
|
+
if (ec_connect == asio::error::operation_aborted) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
if (ec_connect) {
|
143
|
+
return handler(ec_connect);
|
144
|
+
}
|
145
|
+
stream_.async_handshake(asio::ssl::stream_base::client, [handler](std::error_code ec_handshake) mutable {
|
146
|
+
if (ec_handshake == asio::error::operation_aborted) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
return handler(ec_handshake);
|
150
|
+
});
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
void async_write(std::vector<asio::const_buffer>& buffers, std::function<void(std::error_code, std::size_t)>&& handler) override
|
155
|
+
{
|
156
|
+
return asio::async_write(stream_, buffers, handler);
|
157
|
+
}
|
158
|
+
|
159
|
+
void async_read_some(asio::mutable_buffer buffer, std::function<void(std::error_code, std::size_t)>&& handler) override
|
160
|
+
{
|
161
|
+
return stream_.async_read_some(buffer, handler);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
} // namespace couchbase::io
|
@@ -61,7 +61,7 @@ struct analytics_dataset_create_request {
|
|
61
61
|
tao::json::value body{
|
62
62
|
{ "statement",
|
63
63
|
fmt::format(
|
64
|
-
"CREATE DATASET `{}`.`{}` ON `{}` {}
|
64
|
+
"CREATE DATASET {} `{}`.`{}` ON `{}` {}", if_not_exists_clause, dataverse_name, dataset_name, bucket_name, where_clause) },
|
65
65
|
};
|
66
66
|
encoded.headers["content-type"] = "application/json";
|
67
67
|
encoded.method = "POST";
|
@@ -27,6 +27,7 @@ namespace couchbase::operations
|
|
27
27
|
{
|
28
28
|
|
29
29
|
struct bucket_create_response {
|
30
|
+
std::string client_context_id;
|
30
31
|
std::error_code ec;
|
31
32
|
std::string error_message{};
|
32
33
|
};
|
@@ -40,6 +41,7 @@ struct bucket_create_request {
|
|
40
41
|
|
41
42
|
bucket_settings bucket{};
|
42
43
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
44
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
43
45
|
|
44
46
|
void encode_to(encoded_request_type& encoded)
|
45
47
|
{
|
@@ -103,9 +105,9 @@ struct bucket_create_request {
|
|
103
105
|
};
|
104
106
|
|
105
107
|
bucket_create_response
|
106
|
-
make_response(std::error_code ec, bucket_create_request
|
108
|
+
make_response(std::error_code ec, bucket_create_request& request, bucket_create_request::encoded_response_type encoded)
|
107
109
|
{
|
108
|
-
bucket_create_response response{ ec };
|
110
|
+
bucket_create_response response{ request.client_context_id, ec };
|
109
111
|
if (!ec) {
|
110
112
|
switch (encoded.status_code) {
|
111
113
|
case 404:
|
@@ -23,6 +23,7 @@ namespace couchbase::operations
|
|
23
23
|
{
|
24
24
|
|
25
25
|
struct bucket_drop_response {
|
26
|
+
std::string client_context_id;
|
26
27
|
std::error_code ec;
|
27
28
|
};
|
28
29
|
|
@@ -35,6 +36,7 @@ struct bucket_drop_request {
|
|
35
36
|
|
36
37
|
std::string name;
|
37
38
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
39
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
38
40
|
|
39
41
|
void encode_to(encoded_request_type& encoded)
|
40
42
|
{
|
@@ -44,9 +46,9 @@ struct bucket_drop_request {
|
|
44
46
|
};
|
45
47
|
|
46
48
|
bucket_drop_response
|
47
|
-
make_response(std::error_code ec, bucket_drop_request
|
49
|
+
make_response(std::error_code ec, bucket_drop_request& request, bucket_drop_request::encoded_response_type encoded)
|
48
50
|
{
|
49
|
-
bucket_drop_response response{ ec };
|
51
|
+
bucket_drop_response response{ request.client_context_id, ec };
|
50
52
|
if (!ec) {
|
51
53
|
switch (encoded.status_code) {
|
52
54
|
case 404:
|
@@ -23,6 +23,7 @@ namespace couchbase::operations
|
|
23
23
|
{
|
24
24
|
|
25
25
|
struct bucket_flush_response {
|
26
|
+
std::string client_context_id;
|
26
27
|
std::error_code ec;
|
27
28
|
};
|
28
29
|
|
@@ -35,6 +36,7 @@ struct bucket_flush_request {
|
|
35
36
|
|
36
37
|
std::string name;
|
37
38
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
39
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
38
40
|
|
39
41
|
void encode_to(encoded_request_type& encoded)
|
40
42
|
{
|
@@ -44,9 +46,9 @@ struct bucket_flush_request {
|
|
44
46
|
};
|
45
47
|
|
46
48
|
bucket_flush_response
|
47
|
-
make_response(std::error_code ec, bucket_flush_request
|
49
|
+
make_response(std::error_code ec, bucket_flush_request& request, bucket_flush_request::encoded_response_type encoded)
|
48
50
|
{
|
49
|
-
bucket_flush_response response{ ec };
|
51
|
+
bucket_flush_response response{ request.client_context_id, ec };
|
50
52
|
if (!ec) {
|
51
53
|
switch (encoded.status_code) {
|
52
54
|
case 404:
|
@@ -26,6 +26,7 @@ namespace couchbase::operations
|
|
26
26
|
{
|
27
27
|
|
28
28
|
struct bucket_get_response {
|
29
|
+
std::string client_context_id;
|
29
30
|
std::error_code ec;
|
30
31
|
bucket_settings bucket{};
|
31
32
|
};
|
@@ -39,6 +40,7 @@ struct bucket_get_request {
|
|
39
40
|
|
40
41
|
std::string name;
|
41
42
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
43
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
42
44
|
|
43
45
|
void encode_to(encoded_request_type& encoded)
|
44
46
|
{
|
@@ -48,9 +50,9 @@ struct bucket_get_request {
|
|
48
50
|
};
|
49
51
|
|
50
52
|
bucket_get_response
|
51
|
-
make_response(std::error_code ec, bucket_get_request
|
53
|
+
make_response(std::error_code ec, bucket_get_request& request, bucket_get_request::encoded_response_type encoded)
|
52
54
|
{
|
53
|
-
bucket_get_response response{ ec };
|
55
|
+
bucket_get_response response{ request.client_context_id, ec };
|
54
56
|
if (!ec) {
|
55
57
|
switch (encoded.status_code) {
|
56
58
|
case 404:
|
@@ -26,6 +26,7 @@ namespace couchbase::operations
|
|
26
26
|
{
|
27
27
|
|
28
28
|
struct bucket_get_all_response {
|
29
|
+
std::string client_context_id;
|
29
30
|
std::error_code ec;
|
30
31
|
std::vector<bucket_settings> buckets{};
|
31
32
|
};
|
@@ -37,6 +38,7 @@ struct bucket_get_all_request {
|
|
37
38
|
|
38
39
|
static const inline service_type type = service_type::management;
|
39
40
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
41
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
40
42
|
|
41
43
|
void encode_to(encoded_request_type& encoded)
|
42
44
|
{
|
@@ -46,9 +48,9 @@ struct bucket_get_all_request {
|
|
46
48
|
};
|
47
49
|
|
48
50
|
bucket_get_all_response
|
49
|
-
make_response(std::error_code ec, bucket_get_all_request
|
51
|
+
make_response(std::error_code ec, bucket_get_all_request& request, bucket_get_all_request::encoded_response_type encoded)
|
50
52
|
{
|
51
|
-
bucket_get_all_response response{ ec };
|
53
|
+
bucket_get_all_response response{ request.client_context_id, ec };
|
52
54
|
if (!ec) {
|
53
55
|
auto payload = tao::json::from_string(encoded.body);
|
54
56
|
const auto& entries = payload.get_array();
|
@@ -27,6 +27,7 @@ namespace couchbase::operations
|
|
27
27
|
{
|
28
28
|
|
29
29
|
struct bucket_update_response {
|
30
|
+
std::string client_context_id;
|
30
31
|
std::error_code ec;
|
31
32
|
bucket_settings bucket{};
|
32
33
|
std::string error_message{};
|
@@ -39,6 +40,7 @@ struct bucket_update_request {
|
|
39
40
|
|
40
41
|
static const inline service_type type = service_type::management;
|
41
42
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
43
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
42
44
|
|
43
45
|
bucket_settings bucket{};
|
44
46
|
|
@@ -80,9 +82,9 @@ struct bucket_update_request {
|
|
80
82
|
};
|
81
83
|
|
82
84
|
bucket_update_response
|
83
|
-
make_response(std::error_code ec, bucket_update_request
|
85
|
+
make_response(std::error_code ec, bucket_update_request& request, bucket_update_request::encoded_response_type encoded)
|
84
86
|
{
|
85
|
-
bucket_update_response response{ ec };
|
87
|
+
bucket_update_response response{ request.client_context_id, ec };
|
86
88
|
if (!ec) {
|
87
89
|
switch (encoded.status_code) {
|
88
90
|
case 404:
|
@@ -26,6 +26,7 @@ namespace couchbase::operations
|
|
26
26
|
{
|
27
27
|
|
28
28
|
struct cluster_developer_preview_enable_response {
|
29
|
+
std::string client_context_id;
|
29
30
|
std::error_code ec;
|
30
31
|
};
|
31
32
|
|
@@ -36,6 +37,7 @@ struct cluster_developer_preview_enable_request {
|
|
36
37
|
|
37
38
|
static const inline service_type type = service_type::management;
|
38
39
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
40
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
39
41
|
|
40
42
|
void encode_to(encoded_request_type& encoded)
|
41
43
|
{
|
@@ -47,9 +49,9 @@ struct cluster_developer_preview_enable_request {
|
|
47
49
|
};
|
48
50
|
|
49
51
|
cluster_developer_preview_enable_response
|
50
|
-
make_response(std::error_code ec, cluster_developer_preview_enable_request
|
52
|
+
make_response(std::error_code ec, cluster_developer_preview_enable_request& request, scope_get_all_request::encoded_response_type encoded)
|
51
53
|
{
|
52
|
-
cluster_developer_preview_enable_response response{ ec };
|
54
|
+
cluster_developer_preview_enable_response response{ request.client_context_id, ec };
|
53
55
|
if (!ec) {
|
54
56
|
if (encoded.status_code != 200) {
|
55
57
|
response.ec = std::make_error_code(error::common_errc::internal_server_failure);
|
@@ -27,6 +27,7 @@ namespace couchbase::operations
|
|
27
27
|
{
|
28
28
|
|
29
29
|
struct collection_create_response {
|
30
|
+
std::string client_context_id;
|
30
31
|
std::error_code ec;
|
31
32
|
std::uint64_t uid{ 0 };
|
32
33
|
};
|
@@ -43,6 +44,7 @@ struct collection_create_request {
|
|
43
44
|
std::string collection_name;
|
44
45
|
std::uint32_t max_expiry{ 0 };
|
45
46
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
47
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
46
48
|
|
47
49
|
void encode_to(encoded_request_type& encoded)
|
48
50
|
{
|
@@ -57,9 +59,9 @@ struct collection_create_request {
|
|
57
59
|
};
|
58
60
|
|
59
61
|
collection_create_response
|
60
|
-
make_response(std::error_code ec, collection_create_request
|
62
|
+
make_response(std::error_code ec, collection_create_request& request, collection_create_request::encoded_response_type encoded)
|
61
63
|
{
|
62
|
-
collection_create_response response{ ec };
|
64
|
+
collection_create_response response{ request.client_context_id, ec };
|
63
65
|
if (!ec) {
|
64
66
|
switch (encoded.status_code) {
|
65
67
|
case 400:
|
@@ -27,6 +27,7 @@ namespace couchbase::operations
|
|
27
27
|
{
|
28
28
|
|
29
29
|
struct collection_drop_response {
|
30
|
+
std::string client_context_id;
|
30
31
|
std::error_code ec;
|
31
32
|
std::uint64_t uid{ 0 };
|
32
33
|
};
|
@@ -42,6 +43,7 @@ struct collection_drop_request {
|
|
42
43
|
std::string scope_name;
|
43
44
|
std::string collection_name;
|
44
45
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
46
|
+
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
45
47
|
|
46
48
|
void encode_to(encoded_request_type& encoded)
|
47
49
|
{
|
@@ -51,9 +53,9 @@ struct collection_drop_request {
|
|
51
53
|
};
|
52
54
|
|
53
55
|
collection_drop_response
|
54
|
-
make_response(std::error_code ec, collection_drop_request
|
56
|
+
make_response(std::error_code ec, collection_drop_request& request, collection_drop_request::encoded_response_type encoded)
|
55
57
|
{
|
56
|
-
collection_drop_response response{ ec };
|
58
|
+
collection_drop_response response{ request.client_context_id, ec };
|
57
59
|
if (!ec) {
|
58
60
|
switch (encoded.status_code) {
|
59
61
|
case 400:
|
@@ -161,7 +161,6 @@ struct analytics_request {
|
|
161
161
|
bool priority{ false };
|
162
162
|
|
163
163
|
std::optional<scan_consistency_type> scan_consistency{};
|
164
|
-
std::optional<std::uint64_t> scan_wait{};
|
165
164
|
|
166
165
|
std::map<std::string, tao::json::value> raw{};
|
167
166
|
std::vector<tao::json::value> positional_parameters{};
|
@@ -196,9 +195,6 @@ struct analytics_request {
|
|
196
195
|
body["scan_consistency"] = "request_plus";
|
197
196
|
break;
|
198
197
|
}
|
199
|
-
if (scan_wait) {
|
200
|
-
body["scan_wait"] = fmt::format("{}ms", scan_wait.value());
|
201
|
-
}
|
202
198
|
}
|
203
199
|
for (auto& param : raw) {
|
204
200
|
body[param.first] = param.second;
|