couchbase 3.8.0 → 3.8.2
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/README.md +2 -2
- data/ext/cache/extconf_include.rb +4 -4
- data/ext/cache/mozilla-ca-bundle.crt +96 -675
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +3 -1
- data/ext/couchbase/core/error_context/base_error_context.hxx +32 -0
- data/ext/couchbase/core/error_context/key_value.cxx +1 -0
- data/ext/couchbase/core/error_context/key_value.hxx +23 -0
- data/ext/couchbase/core/error_context/key_value_error_context.hxx +35 -0
- data/ext/couchbase/core/error_context/subdocument_error_context.hxx +41 -0
- data/ext/couchbase/core/impl/binary_collection.cxx +123 -88
- data/ext/couchbase/core/impl/collection.cxx +416 -189
- data/ext/couchbase/core/impl/error.cxx +29 -4
- data/ext/couchbase/core/impl/invoke_with_node_id.hxx +44 -0
- data/ext/couchbase/core/impl/node_id.cxx +110 -0
- data/ext/couchbase/core/impl/node_id.hxx +40 -0
- data/ext/couchbase/core/impl/public_cluster.cxx +118 -5
- data/ext/couchbase/core/io/configuration_belongs_to_session.hxx +67 -0
- data/ext/couchbase/core/io/http_session_manager.hxx +97 -57
- data/ext/couchbase/core/io/mcbp_session.cxx +7 -16
- data/ext/couchbase/core/io/streams.cxx +143 -12
- data/ext/couchbase/core/io/streams.hxx +6 -0
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +14 -4
- data/ext/couchbase/core/operations/document_get_projected.cxx +3 -4
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +4 -0
- data/ext/couchbase/core/operations/document_query.cxx +12 -12
- data/ext/couchbase/core/operations/management/bucket_create.cxx +37 -38
- data/ext/couchbase/core/operations/management/bucket_update.cxx +26 -28
- data/ext/couchbase/core/operations/management/collection_create.cxx +11 -11
- data/ext/couchbase/core/operations/management/collection_drop.cxx +11 -11
- data/ext/couchbase/core/operations/management/collection_update.cxx +11 -11
- data/ext/couchbase/core/operations/management/error_utils.cxx +9 -6
- data/ext/couchbase/core/operations/management/query_index_create.cxx +5 -4
- data/ext/couchbase/core/operations/management/query_index_drop.cxx +7 -6
- data/ext/couchbase/core/operations/management/scope_create.cxx +12 -13
- data/ext/couchbase/core/operations/management/scope_drop.cxx +8 -9
- data/ext/couchbase/core/topology/configuration.cxx +21 -0
- data/ext/couchbase/core/topology/configuration.hxx +28 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +254 -178
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +5 -1
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +42 -7
- data/ext/couchbase/core/transactions/waitable_op_list.hxx +13 -2
- data/ext/couchbase/core/utils/contains_string.cxx +61 -0
- data/ext/couchbase/core/utils/contains_string.hxx +26 -0
- data/ext/couchbase/couchbase/cluster.hxx +33 -0
- data/ext/couchbase/couchbase/collection.hxx +73 -0
- data/ext/couchbase/couchbase/error.hxx +16 -0
- data/ext/couchbase/couchbase/node_id.hxx +123 -0
- data/ext/couchbase/couchbase/node_id_for_options.hxx +61 -0
- data/ext/couchbase/couchbase/node_ids_options.hxx +62 -0
- data/ext/couchbase/couchbase/result.hxx +42 -0
- data/ext/rcb_crud.cxx +2 -0
- data/ext/rcb_logger.cxx +15 -17
- data/lib/couchbase/cluster.rb +16 -14
- data/lib/couchbase/datastructures/couchbase_list.rb +1 -0
- data/lib/couchbase/datastructures/couchbase_map.rb +1 -0
- data/lib/couchbase/datastructures/couchbase_queue.rb +1 -0
- data/lib/couchbase/datastructures/couchbase_set.rb +1 -0
- data/lib/couchbase/errors.rb +1 -1
- data/lib/couchbase/json_transcoder.rb +1 -1
- data/lib/couchbase/options.rb +9 -4
- data/lib/couchbase/protostellar/client.rb +0 -2
- data/lib/couchbase/protostellar/cluster.rb +4 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_pb.rb +54 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_services_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +16 -0
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +16 -0
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +18 -0
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +23 -0
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +4 -25
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +10 -0
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +6 -25
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +18 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_pb.rb +46 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_services_pb.rb +56 -0
- data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +3 -26
- data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +47 -0
- data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +4 -26
- data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +10 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_pb.rb +26 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_services_pb.rb +43 -0
- data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +5 -26
- data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +11 -0
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +30 -0
- data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +9 -0
- data/lib/couchbase/protostellar/request_generator/admin/collection.rb +4 -2
- data/lib/couchbase/protostellar/request_generator/admin/query.rb +2 -0
- data/lib/couchbase/protostellar/request_generator/kv.rb +1 -1
- data/lib/couchbase/protostellar/scope.rb +4 -0
- data/lib/couchbase/utils/observability.rb +10 -4
- data/lib/couchbase/version.rb +1 -1
- metadata +20 -7
- data/lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb +0 -52
- data/lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb +0 -30
|
@@ -24,13 +24,11 @@
|
|
|
24
24
|
#include <spdlog/fmt/bundled/core.h>
|
|
25
25
|
#include <tao/json/value.hpp>
|
|
26
26
|
|
|
27
|
-
#include <regex>
|
|
28
|
-
|
|
29
27
|
namespace couchbase::core::operations::management
|
|
30
28
|
{
|
|
31
29
|
auto
|
|
32
|
-
scope_drop_request::encode_to(encoded_request_type& encoded,
|
|
33
|
-
|
|
30
|
+
scope_drop_request::encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
|
31
|
+
-> std::error_code
|
|
34
32
|
{
|
|
35
33
|
encoded.method = "DELETE";
|
|
36
34
|
encoded.path = fmt::format("/pools/default/buckets/{}/scopes/{}",
|
|
@@ -45,13 +43,14 @@ scope_drop_request::make_response(error_context::http&& ctx,
|
|
|
45
43
|
{
|
|
46
44
|
scope_drop_response response{ std::move(ctx) };
|
|
47
45
|
if (!response.ctx.ec) {
|
|
48
|
-
switch (encoded.status_code) {
|
|
46
|
+
switch (const auto& body = encoded.body.data(); encoded.status_code) {
|
|
49
47
|
case 400:
|
|
50
48
|
response.ctx.ec = errc::common::unsupported_operation;
|
|
51
49
|
break;
|
|
52
50
|
case 404: {
|
|
53
|
-
const
|
|
54
|
-
if (std::
|
|
51
|
+
const auto prefix_pos = body.find("Scope with name ");
|
|
52
|
+
if (prefix_pos != std::string_view::npos &&
|
|
53
|
+
body.find(" is not found", prefix_pos) != std::string_view::npos) {
|
|
55
54
|
response.ctx.ec = errc::common::scope_not_found;
|
|
56
55
|
} else {
|
|
57
56
|
response.ctx.ec = errc::common::bucket_not_found;
|
|
@@ -60,7 +59,7 @@ scope_drop_request::make_response(error_context::http&& ctx,
|
|
|
60
59
|
case 200: {
|
|
61
60
|
tao::json::value payload{};
|
|
62
61
|
try {
|
|
63
|
-
payload = utils::json::parse(
|
|
62
|
+
payload = utils::json::parse(body);
|
|
64
63
|
} catch (const tao::pegtl::parse_error&) {
|
|
65
64
|
response.ctx.ec = errc::common::parsing_failure;
|
|
66
65
|
return response;
|
|
@@ -68,7 +67,7 @@ scope_drop_request::make_response(error_context::http&& ctx,
|
|
|
68
67
|
response.uid = std::stoull(payload.at("uid").get_string(), nullptr, 16);
|
|
69
68
|
} break;
|
|
70
69
|
default:
|
|
71
|
-
response.ctx.ec = extract_common_error_code(encoded.status_code,
|
|
70
|
+
response.ctx.ec = extract_common_error_code(encoded.status_code, body);
|
|
72
71
|
break;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
#include "configuration.hxx"
|
|
19
19
|
|
|
20
|
+
#include "core/impl/node_id.hxx"
|
|
20
21
|
#include "core/logger/logger.hxx"
|
|
21
22
|
#include "core/service_type_fmt.hxx"
|
|
22
23
|
#include "core/utils/crc32.hxx"
|
|
@@ -171,6 +172,26 @@ configuration::node::endpoint(const std::string& network, service_type type, boo
|
|
|
171
172
|
return fmt::format("{}:{}", hostname_for(network), p);
|
|
172
173
|
}
|
|
173
174
|
|
|
175
|
+
auto
|
|
176
|
+
configuration::node::effective_node_id(bool is_tls) const -> couchbase::node_id
|
|
177
|
+
{
|
|
178
|
+
return internal_node_id::build(node_uuid, hostname, port_or(service_type::key_value, is_tls, 0));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
auto
|
|
182
|
+
configuration::effective_node_ids(bool is_tls) const -> std::vector<couchbase::node_id>
|
|
183
|
+
{
|
|
184
|
+
std::vector<couchbase::node_id> result;
|
|
185
|
+
result.reserve(nodes.size());
|
|
186
|
+
for (const auto& n : nodes) {
|
|
187
|
+
if (n.port_or(service_type::key_value, is_tls, 0) == 0) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
result.push_back(n.effective_node_id(is_tls));
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
|
|
174
195
|
auto
|
|
175
196
|
configuration::has_node(const std::string& network,
|
|
176
197
|
service_type type,
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
#include "core/platform/uuid.h"
|
|
22
22
|
#include "core/service_type.hxx"
|
|
23
23
|
|
|
24
|
+
#include <couchbase/node_id.hxx>
|
|
25
|
+
|
|
24
26
|
#include <map>
|
|
25
27
|
#include <optional>
|
|
26
28
|
#include <set>
|
|
@@ -83,10 +85,36 @@ struct configuration {
|
|
|
83
85
|
|
|
84
86
|
[[nodiscard]] auto endpoint(const std::string& network, service_type type, bool is_tls) const
|
|
85
87
|
-> std::optional<std::string>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns a node_id built from this node's UUID (when available on
|
|
91
|
+
* Server 8.0.1+) with fallback to a deterministic hash of hostname +
|
|
92
|
+
* KV port for older servers.
|
|
93
|
+
*
|
|
94
|
+
* The KV port selected mirrors what mcbp_session uses for the same node
|
|
95
|
+
* (TLS port when @p is_tls, plain port otherwise), ensuring that the
|
|
96
|
+
* node_id surfaced on the request side via collection::node_id_for
|
|
97
|
+
* matches the node_id attached to results and errors.
|
|
98
|
+
*/
|
|
99
|
+
[[nodiscard]] auto effective_node_id(bool is_tls) const -> couchbase::node_id;
|
|
86
100
|
};
|
|
87
101
|
|
|
88
102
|
[[nodiscard]] auto select_network(const std::string& bootstrap_hostname) const -> std::string;
|
|
89
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Returns one node_id per cluster node that currently serves the
|
|
106
|
+
* key-value service over the requested transport. Nodes that do not
|
|
107
|
+
* expose a KV port for @p is_tls are filtered out — without a KV port
|
|
108
|
+
* the fallback hash would be derived from a meaningless port=0 and
|
|
109
|
+
* could collide with a sibling node that is also missing its KV port.
|
|
110
|
+
*
|
|
111
|
+
* The returned vector preserves topology order; callers that want a
|
|
112
|
+
* set semantic should hash the entries themselves (couchbase::node_id
|
|
113
|
+
* is hashable). Topology nodes are unique by construction, so no
|
|
114
|
+
* dedup is performed here.
|
|
115
|
+
*/
|
|
116
|
+
[[nodiscard]] auto effective_node_ids(bool is_tls) const -> std::vector<couchbase::node_id>;
|
|
117
|
+
|
|
90
118
|
using vbucket_map = typename std::vector<std::vector<std::int16_t>>;
|
|
91
119
|
|
|
92
120
|
std::optional<std::int64_t> epoch{};
|