couchbase 3.1.1-universal-darwin-20 → 3.2.0-universal-darwin-20
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/CMakeLists.txt +3 -1
- data/ext/build_version.hxx.in +1 -1
- data/ext/cmake/Testing.cmake +1 -0
- data/ext/cmake/ThirdPartyDependencies.cmake +6 -0
- data/ext/cmake/VersionInfo.cmake +3 -0
- data/ext/couchbase/bucket.hxx +47 -28
- data/ext/couchbase/cbsasl/client.h +1 -1
- data/ext/couchbase/cbsasl/context.cc +1 -1
- data/ext/couchbase/cbsasl/context.h +3 -3
- data/ext/couchbase/cbsasl/mechanism.cc +5 -8
- data/ext/couchbase/cbsasl/mechanism.h +1 -4
- data/ext/couchbase/cbsasl/plain/plain.cc +1 -1
- data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +30 -36
- data/ext/couchbase/cluster.hxx +40 -22
- data/ext/couchbase/cluster_options.hxx +7 -1
- data/ext/couchbase/configuration.hxx +37 -16
- data/ext/couchbase/couchbase.cxx +1145 -291
- data/ext/couchbase/error_map.hxx +1 -1
- data/ext/couchbase/errors.hxx +25 -17
- data/ext/couchbase/io/dns_client.hxx +3 -3
- data/ext/couchbase/io/dns_codec.hxx +4 -5
- data/ext/couchbase/io/dns_config.hxx +5 -6
- data/ext/couchbase/io/dns_message.hxx +3 -3
- data/ext/couchbase/io/http_command.hxx +70 -35
- data/ext/couchbase/io/http_session.hxx +4 -3
- data/ext/couchbase/io/http_session_manager.hxx +28 -19
- data/ext/couchbase/io/mcbp_command.hxx +51 -19
- data/ext/couchbase/io/mcbp_context.hxx +1 -1
- data/ext/couchbase/io/mcbp_parser.hxx +4 -4
- data/ext/couchbase/io/mcbp_session.hxx +91 -101
- data/ext/couchbase/io/query_cache.hxx +2 -2
- data/ext/couchbase/io/retry_orchestrator.hxx +2 -4
- data/ext/couchbase/io/retry_reason.hxx +2 -2
- data/ext/couchbase/io/retry_strategy.hxx +1 -6
- data/ext/couchbase/io/streams.hxx +7 -7
- data/ext/couchbase/metrics/logging_meter.hxx +228 -0
- data/ext/couchbase/metrics/logging_meter_options.hxx +28 -0
- data/ext/couchbase/metrics/meter.hxx +49 -0
- data/ext/couchbase/metrics/noop_meter.hxx +43 -0
- data/ext/couchbase/operations.hxx +4 -0
- data/ext/couchbase/operations/analytics_dataset_create.hxx +16 -12
- data/ext/couchbase/operations/analytics_dataset_drop.hxx +11 -11
- data/ext/couchbase/operations/analytics_dataset_get_all.hxx +6 -6
- data/ext/couchbase/operations/analytics_dataverse_create.hxx +10 -11
- data/ext/couchbase/operations/analytics_dataverse_drop.hxx +10 -11
- data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +9 -11
- data/ext/couchbase/operations/analytics_index_create.hxx +14 -13
- data/ext/couchbase/operations/analytics_index_drop.hxx +18 -12
- data/ext/couchbase/operations/analytics_index_get_all.hxx +8 -6
- data/ext/couchbase/operations/analytics_link.hxx +39 -0
- data/ext/couchbase/operations/analytics_link_azure_blob_external.hxx +145 -0
- data/ext/couchbase/operations/analytics_link_connect.hxx +14 -12
- data/ext/couchbase/operations/analytics_link_couchbase_remote.hxx +220 -0
- data/ext/couchbase/operations/analytics_link_create.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_disconnect.hxx +11 -12
- data/ext/couchbase/operations/analytics_link_drop.hxx +130 -0
- data/ext/couchbase/operations/analytics_link_get_all.hxx +160 -0
- data/ext/couchbase/operations/analytics_link_replace.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_s3_external.hxx +122 -0
- data/ext/couchbase/operations/bucket_create.hxx +8 -8
- data/ext/couchbase/operations/bucket_drop.hxx +5 -5
- data/ext/couchbase/operations/bucket_flush.hxx +5 -5
- data/ext/couchbase/operations/bucket_get.hxx +7 -7
- data/ext/couchbase/operations/bucket_get_all.hxx +7 -5
- data/ext/couchbase/operations/bucket_settings.hxx +40 -49
- data/ext/couchbase/operations/bucket_update.hxx +8 -8
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +7 -7
- data/ext/couchbase/operations/collection_create.hxx +11 -11
- data/ext/couchbase/operations/collection_drop.hxx +12 -10
- data/ext/couchbase/operations/collections_manifest_get.hxx +3 -3
- data/ext/couchbase/operations/design_document.hxx +2 -2
- data/ext/couchbase/operations/document_analytics.hxx +29 -36
- data/ext/couchbase/operations/document_append.hxx +3 -3
- data/ext/couchbase/operations/document_decrement.hxx +3 -3
- data/ext/couchbase/operations/document_exists.hxx +2 -2
- data/ext/couchbase/operations/document_get.hxx +3 -3
- data/ext/couchbase/operations/document_get_and_lock.hxx +5 -3
- data/ext/couchbase/operations/document_get_and_touch.hxx +5 -3
- data/ext/couchbase/operations/document_get_projected.hxx +10 -11
- data/ext/couchbase/operations/document_increment.hxx +3 -3
- data/ext/couchbase/operations/document_insert.hxx +3 -3
- data/ext/couchbase/operations/document_lookup_in.hxx +12 -18
- data/ext/couchbase/operations/document_mutate_in.hxx +13 -18
- data/ext/couchbase/operations/document_prepend.hxx +3 -3
- data/ext/couchbase/operations/document_query.hxx +39 -41
- data/ext/couchbase/operations/document_remove.hxx +3 -3
- data/ext/couchbase/operations/document_replace.hxx +3 -3
- data/ext/couchbase/operations/document_search.hxx +56 -61
- data/ext/couchbase/operations/document_touch.hxx +3 -3
- data/ext/couchbase/operations/document_unlock.hxx +3 -3
- data/ext/couchbase/operations/document_upsert.hxx +3 -3
- data/ext/couchbase/operations/document_view.hxx +23 -23
- data/ext/couchbase/operations/group_drop.hxx +5 -5
- data/ext/couchbase/operations/group_get.hxx +7 -7
- data/ext/couchbase/operations/group_get_all.hxx +6 -6
- data/ext/couchbase/operations/group_upsert.hxx +11 -11
- data/ext/couchbase/operations/http_noop.hxx +6 -6
- data/ext/couchbase/operations/mcbp_noop.hxx +3 -3
- data/ext/couchbase/operations/query_index_build_deferred.hxx +6 -6
- data/ext/couchbase/operations/query_index_create.hxx +10 -8
- data/ext/couchbase/operations/query_index_drop.hxx +8 -8
- data/ext/couchbase/operations/query_index_get_all.hxx +43 -39
- data/ext/couchbase/operations/rbac.hxx +40 -63
- data/ext/couchbase/operations/role_get_all.hxx +6 -6
- data/ext/couchbase/operations/scope_create.hxx +10 -10
- data/ext/couchbase/operations/scope_drop.hxx +9 -9
- data/ext/couchbase/operations/scope_get_all.hxx +8 -8
- data/ext/couchbase/operations/search_get_stats.hxx +5 -3
- data/ext/couchbase/operations/search_index.hxx +6 -15
- data/ext/couchbase/operations/search_index_analyze_document.hxx +11 -11
- data/ext/couchbase/operations/search_index_control_ingest.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_query.hxx +9 -9
- data/ext/couchbase/operations/search_index_drop.hxx +11 -9
- data/ext/couchbase/operations/search_index_get.hxx +11 -9
- data/ext/couchbase/operations/search_index_get_all.hxx +11 -11
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +10 -10
- data/ext/couchbase/operations/search_index_get_stats.hxx +10 -8
- data/ext/couchbase/operations/search_index_upsert.hxx +12 -10
- data/ext/couchbase/operations/user_drop.hxx +5 -5
- data/ext/couchbase/operations/user_get.hxx +7 -7
- data/ext/couchbase/operations/user_get_all.hxx +6 -6
- data/ext/couchbase/operations/user_upsert.hxx +9 -9
- data/ext/couchbase/operations/view_index_drop.hxx +10 -10
- data/ext/couchbase/operations/view_index_get.hxx +13 -15
- data/ext/couchbase/operations/view_index_get_all.hxx +17 -20
- data/ext/couchbase/operations/view_index_upsert.hxx +9 -7
- data/ext/couchbase/origin.hxx +14 -10
- data/ext/couchbase/platform/backtrace.c +1 -1
- data/ext/couchbase/platform/base64.cc +5 -5
- data/ext/couchbase/platform/base64.h +2 -5
- data/ext/couchbase/protocol/client_opcode.hxx +7 -4
- data/ext/couchbase/protocol/client_request.hxx +2 -2
- data/ext/couchbase/protocol/client_response.hxx +41 -16
- data/ext/couchbase/protocol/cmd_append.hxx +17 -16
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +4 -4
- data/ext/couchbase/protocol/cmd_decrement.hxx +10 -11
- data/ext/couchbase/protocol/cmd_exists.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get.hxx +11 -14
- data/ext/couchbase/protocol/cmd_get_and_lock.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +13 -18
- data/ext/couchbase/protocol/cmd_get_collection_id.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +12 -16
- data/ext/couchbase/protocol/cmd_get_error_map.hxx +14 -17
- data/ext/couchbase/protocol/cmd_hello.hxx +8 -10
- data/ext/couchbase/protocol/cmd_increment.hxx +9 -10
- data/ext/couchbase/protocol/cmd_insert.hxx +9 -9
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +12 -13
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +11 -11
- data/ext/couchbase/protocol/cmd_noop.hxx +16 -20
- data/ext/couchbase/protocol/cmd_prepend.hxx +9 -10
- data/ext/couchbase/protocol/cmd_remove.hxx +10 -13
- data/ext/couchbase/protocol/cmd_replace.hxx +7 -7
- data/ext/couchbase/protocol/cmd_sasl_auth.hxx +8 -10
- data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +10 -15
- data/ext/couchbase/protocol/cmd_sasl_step.hxx +10 -12
- data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -18
- data/ext/couchbase/protocol/cmd_touch.hxx +8 -11
- data/ext/couchbase/protocol/cmd_unlock.hxx +10 -14
- data/ext/couchbase/protocol/cmd_upsert.hxx +8 -8
- data/ext/couchbase/protocol/datatype.hxx +3 -3
- data/ext/couchbase/protocol/durability_level.hxx +2 -2
- data/ext/couchbase/protocol/frame_info_id.hxx +4 -4
- data/ext/couchbase/protocol/hello_feature.hxx +2 -2
- data/ext/couchbase/protocol/magic.hxx +2 -2
- data/ext/couchbase/protocol/server_opcode.hxx +2 -2
- data/ext/couchbase/protocol/server_request.hxx +1 -1
- data/ext/couchbase/protocol/status.hxx +4 -7
- data/ext/couchbase/protocol/unsigned_leb128.h +5 -20
- data/ext/couchbase/service_type.hxx +4 -4
- data/ext/couchbase/tracing/constants.hxx +261 -0
- data/ext/couchbase/tracing/noop_tracer.hxx +50 -0
- data/ext/couchbase/tracing/request_tracer.hxx +77 -0
- data/ext/couchbase/tracing/threshold_logging_options.hxx +64 -0
- data/ext/couchbase/tracing/threshold_logging_tracer.hxx +366 -0
- data/ext/couchbase/utils/byteswap.hxx +1 -1
- data/ext/couchbase/utils/connection_string.hxx +21 -1
- data/ext/couchbase/utils/name_codec.hxx +41 -0
- data/ext/couchbase/utils/url_codec.hxx +236 -0
- data/ext/couchbase/version.hxx +1 -1
- data/ext/test/CMakeLists.txt +1 -0
- data/ext/test/test_native_trivial_query.cxx +60 -0
- data/ext/third_party/hdr_histogram_c/CMakeLists.txt +84 -0
- data/ext/third_party/hdr_histogram_c/COPYING.txt +121 -0
- data/ext/third_party/hdr_histogram_c/LICENSE.txt +41 -0
- data/ext/third_party/hdr_histogram_c/config.cmake.in +6 -0
- data/ext/third_party/hdr_histogram_c/src/CMakeLists.txt +83 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_atomic.h +146 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.c +322 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.h +79 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_endian.h +116 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.c +1196 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.h +516 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.c +1290 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.h +236 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log_no_op.c +171 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.c +227 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.h +109 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_malloc.h +19 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_tests.h +22 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.c +108 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.h +55 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.c +98 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.h +49 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.c +143 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.h +51 -0
- data/lib/couchbase/cluster.rb +1 -0
- data/lib/couchbase/errors.rb +3 -0
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/analytics_index_manager.rb +920 -226
- data/lib/couchbase/management/bucket_manager.rb +207 -69
- data/lib/couchbase/management/collection_manager.rb +173 -61
- data/lib/couchbase/management/query_index_manager.rb +357 -169
- data/lib/couchbase/options.rb +75 -3
- data/lib/couchbase/scope.rb +102 -0
- data/lib/couchbase/utils/time.rb +4 -0
- data/lib/couchbase/version.rb +6 -6
- metadata +48 -5
@@ -42,7 +42,7 @@ struct role_get_all_request {
|
|
42
42
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
43
43
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
44
44
|
|
45
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
45
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
46
46
|
{
|
47
47
|
encoded.method = "GET";
|
48
48
|
encoded.path = "/settings/rbac/roles";
|
@@ -52,23 +52,23 @@ struct role_get_all_request {
|
|
52
52
|
};
|
53
53
|
|
54
54
|
role_get_all_response
|
55
|
-
make_response(error_context::http&& ctx, role_get_all_request
|
55
|
+
make_response(error_context::http&& ctx, const role_get_all_request& /* request */, role_get_all_request::encoded_response_type&& encoded)
|
56
56
|
{
|
57
|
-
role_get_all_response response{ ctx };
|
57
|
+
role_get_all_response response{ std::move(ctx) };
|
58
58
|
if (!response.ctx.ec) {
|
59
59
|
if (encoded.status_code == 200) {
|
60
60
|
tao::json::value payload{};
|
61
61
|
try {
|
62
62
|
payload = tao::json::from_string(encoded.body);
|
63
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
64
|
-
response.ctx.ec =
|
63
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
64
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
65
65
|
return response;
|
66
66
|
}
|
67
67
|
for (const auto& entry : payload.get_array()) {
|
68
68
|
response.roles.emplace_back(entry.as<rbac::role_and_description>());
|
69
69
|
}
|
70
70
|
} else {
|
71
|
-
response.ctx.ec =
|
71
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
72
72
|
}
|
73
73
|
}
|
74
74
|
return response;
|
@@ -46,7 +46,7 @@ struct scope_create_request {
|
|
46
46
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
47
47
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
48
48
|
|
49
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
49
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
50
50
|
{
|
51
51
|
encoded.method = "POST";
|
52
52
|
encoded.path = fmt::format("/pools/default/buckets/{}/scopes", bucket_name);
|
@@ -57,36 +57,36 @@ struct scope_create_request {
|
|
57
57
|
};
|
58
58
|
|
59
59
|
scope_create_response
|
60
|
-
make_response(error_context::http&& ctx, scope_create_request& /* request */, scope_create_request::encoded_response_type&& encoded)
|
60
|
+
make_response(error_context::http&& ctx, const scope_create_request& /* request */, scope_create_request::encoded_response_type&& encoded)
|
61
61
|
{
|
62
|
-
scope_create_response response{ ctx };
|
62
|
+
scope_create_response response{ std::move(ctx) };
|
63
63
|
if (!response.ctx.ec) {
|
64
64
|
switch (encoded.status_code) {
|
65
65
|
case 400: {
|
66
66
|
std::regex scope_exists("Scope with name .+ already exists");
|
67
67
|
if (std::regex_search(encoded.body, scope_exists)) {
|
68
|
-
response.ctx.ec =
|
68
|
+
response.ctx.ec = error::management_errc::scope_exists;
|
69
69
|
} else if (encoded.body.find("Not allowed on this version of cluster") != std::string::npos) {
|
70
|
-
response.ctx.ec =
|
70
|
+
response.ctx.ec = error::common_errc::feature_not_available;
|
71
71
|
} else {
|
72
|
-
response.ctx.ec =
|
72
|
+
response.ctx.ec = error::common_errc::invalid_argument;
|
73
73
|
}
|
74
74
|
} break;
|
75
75
|
case 404:
|
76
|
-
response.ctx.ec =
|
76
|
+
response.ctx.ec = error::common_errc::bucket_not_found;
|
77
77
|
break;
|
78
78
|
case 200: {
|
79
79
|
tao::json::value payload{};
|
80
80
|
try {
|
81
81
|
payload = tao::json::from_string(encoded.body);
|
82
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
83
|
-
response.ctx.ec =
|
82
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
83
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
84
84
|
return response;
|
85
85
|
}
|
86
86
|
response.uid = std::stoull(payload.at("uid").get_string(), 0, 16);
|
87
87
|
} break;
|
88
88
|
default:
|
89
|
-
response.ctx.ec =
|
89
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
90
90
|
break;
|
91
91
|
}
|
92
92
|
}
|
@@ -46,7 +46,7 @@ struct scope_drop_request {
|
|
46
46
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
47
47
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
48
48
|
|
49
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
49
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
50
50
|
{
|
51
51
|
encoded.method = "DELETE";
|
52
52
|
encoded.path = fmt::format("/pools/default/buckets/{}/scopes/{}", bucket_name, scope_name);
|
@@ -55,34 +55,34 @@ struct scope_drop_request {
|
|
55
55
|
};
|
56
56
|
|
57
57
|
scope_drop_response
|
58
|
-
make_response(error_context::http&& ctx, scope_drop_request& /* request */, scope_drop_request::encoded_response_type&& encoded)
|
58
|
+
make_response(error_context::http&& ctx, const scope_drop_request& /* request */, scope_drop_request::encoded_response_type&& encoded)
|
59
59
|
{
|
60
|
-
scope_drop_response response{ ctx };
|
60
|
+
scope_drop_response response{ std::move(ctx) };
|
61
61
|
if (!response.ctx.ec) {
|
62
62
|
switch (encoded.status_code) {
|
63
63
|
case 400:
|
64
|
-
response.ctx.ec =
|
64
|
+
response.ctx.ec = error::common_errc::unsupported_operation;
|
65
65
|
break;
|
66
66
|
case 404: {
|
67
67
|
std::regex scope_not_found("Scope with name .+ is not found");
|
68
68
|
if (std::regex_search(encoded.body, scope_not_found)) {
|
69
|
-
response.ctx.ec =
|
69
|
+
response.ctx.ec = error::common_errc::scope_not_found;
|
70
70
|
} else {
|
71
|
-
response.ctx.ec =
|
71
|
+
response.ctx.ec = error::common_errc::bucket_not_found;
|
72
72
|
}
|
73
73
|
} break;
|
74
74
|
case 200: {
|
75
75
|
tao::json::value payload{};
|
76
76
|
try {
|
77
77
|
payload = tao::json::from_string(encoded.body);
|
78
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
79
|
-
response.ctx.ec =
|
78
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
79
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
80
80
|
return response;
|
81
81
|
}
|
82
82
|
response.uid = std::stoull(payload.at("uid").get_string(), 0, 16);
|
83
83
|
} break;
|
84
84
|
default:
|
85
|
-
response.ctx.ec =
|
85
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
86
86
|
break;
|
87
87
|
}
|
88
88
|
}
|
@@ -43,7 +43,7 @@ struct scope_get_all_request {
|
|
43
43
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
44
44
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
45
45
|
|
46
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
47
47
|
{
|
48
48
|
encoded.method = "GET";
|
49
49
|
encoded.path = fmt::format("/pools/default/buckets/{}/scopes", bucket_name);
|
@@ -52,27 +52,27 @@ struct scope_get_all_request {
|
|
52
52
|
};
|
53
53
|
|
54
54
|
scope_get_all_response
|
55
|
-
make_response(error_context::http&& ctx, scope_get_all_request
|
55
|
+
make_response(error_context::http&& ctx, const scope_get_all_request& /* request */, scope_get_all_request::encoded_response_type&& encoded)
|
56
56
|
{
|
57
|
-
scope_get_all_response response{ ctx };
|
57
|
+
scope_get_all_response response{ std::move(ctx) };
|
58
58
|
if (!response.ctx.ec) {
|
59
59
|
switch (encoded.status_code) {
|
60
60
|
case 400:
|
61
|
-
response.ctx.ec =
|
61
|
+
response.ctx.ec = error::common_errc::unsupported_operation;
|
62
62
|
break;
|
63
63
|
case 404:
|
64
|
-
response.ctx.ec =
|
64
|
+
response.ctx.ec = error::common_errc::bucket_not_found;
|
65
65
|
break;
|
66
66
|
case 200:
|
67
67
|
try {
|
68
68
|
response.manifest = tao::json::from_string(encoded.body).as<collections_manifest>();
|
69
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
70
|
-
response.ctx.ec =
|
69
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
70
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
71
71
|
return response;
|
72
72
|
}
|
73
73
|
break;
|
74
74
|
default:
|
75
|
-
response.ctx.ec =
|
75
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
76
76
|
break;
|
77
77
|
}
|
78
78
|
}
|
@@ -39,7 +39,7 @@ struct search_index_stats_request {
|
|
39
39
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
40
40
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
41
41
|
|
42
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
42
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
43
43
|
{
|
44
44
|
encoded.method = "GET";
|
45
45
|
encoded.path = "/api/nsstats";
|
@@ -48,9 +48,11 @@ struct search_index_stats_request {
|
|
48
48
|
};
|
49
49
|
|
50
50
|
search_index_stats_response
|
51
|
-
make_response(error_context::http&& ctx,
|
51
|
+
make_response(error_context::http&& ctx,
|
52
|
+
const search_index_stats_request& /* request */,
|
53
|
+
search_index_stats_request::encoded_response_type&& encoded)
|
52
54
|
{
|
53
|
-
search_index_stats_response response{ ctx };
|
55
|
+
search_index_stats_response response{ std::move(ctx) };
|
54
56
|
if (!response.ctx.ec) {
|
55
57
|
response.stats = encoded.body;
|
56
58
|
}
|
@@ -46,11 +46,8 @@ struct traits<couchbase::operations::search_index> {
|
|
46
46
|
result.uuid = v.at("uuid").get_string();
|
47
47
|
result.name = v.at("name").get_string();
|
48
48
|
result.type = v.at("type").get_string();
|
49
|
-
{
|
50
|
-
|
51
|
-
if (params != nullptr && params->is_object()) {
|
52
|
-
result.params_json = tao::json::to_string(*params);
|
53
|
-
}
|
49
|
+
if (const auto* params = v.find("params"); params != nullptr && params->is_object()) {
|
50
|
+
result.params_json = tao::json::to_string(*params);
|
54
51
|
}
|
55
52
|
if (v.find("sourceUUID") != nullptr) {
|
56
53
|
result.source_uuid = v.at("sourceUUID").get_string();
|
@@ -61,17 +58,11 @@ struct traits<couchbase::operations::search_index> {
|
|
61
58
|
if (v.find("sourceType") != nullptr) {
|
62
59
|
result.source_type = v.at("sourceType").get_string();
|
63
60
|
}
|
64
|
-
{
|
65
|
-
|
66
|
-
if (params != nullptr && params->is_object()) {
|
67
|
-
result.source_params_json = tao::json::to_string(*params);
|
68
|
-
}
|
61
|
+
if (const auto* params = v.find("sourceParams"); params != nullptr && params->is_object()) {
|
62
|
+
result.source_params_json = tao::json::to_string(*params);
|
69
63
|
}
|
70
|
-
{
|
71
|
-
|
72
|
-
if (params != nullptr && params->is_object()) {
|
73
|
-
result.plan_params_json = tao::json::to_string(*params);
|
74
|
-
}
|
64
|
+
if (const auto* params = v.find("planParams"); params != nullptr && params->is_object()) {
|
65
|
+
result.plan_params_json = tao::json::to_string(*params);
|
75
66
|
}
|
76
67
|
return result;
|
77
68
|
}
|
@@ -44,7 +44,7 @@ struct search_index_analyze_document_request {
|
|
44
44
|
std::string index_name;
|
45
45
|
std::string encoded_document;
|
46
46
|
|
47
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
48
48
|
{
|
49
49
|
encoded.method = "POST";
|
50
50
|
encoded.headers["cache-control"] = "no-cache";
|
@@ -57,17 +57,17 @@ struct search_index_analyze_document_request {
|
|
57
57
|
|
58
58
|
search_index_analyze_document_response
|
59
59
|
make_response(error_context::http&& ctx,
|
60
|
-
search_index_analyze_document_request
|
60
|
+
const search_index_analyze_document_request& /* request */,
|
61
61
|
search_index_analyze_document_request::encoded_response_type&& encoded)
|
62
62
|
{
|
63
|
-
search_index_analyze_document_response response{ ctx };
|
63
|
+
search_index_analyze_document_response response{ std::move(ctx) };
|
64
64
|
if (!response.ctx.ec) {
|
65
65
|
if (encoded.status_code == 200) {
|
66
66
|
tao::json::value payload{};
|
67
67
|
try {
|
68
68
|
payload = tao::json::from_string(encoded.body);
|
69
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
70
|
-
response.ctx.ec =
|
69
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
70
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
71
71
|
return response;
|
72
72
|
}
|
73
73
|
response.status = payload.at("status").get_string();
|
@@ -77,27 +77,27 @@ make_response(error_context::http&& ctx,
|
|
77
77
|
}
|
78
78
|
} else if (encoded.status_code == 400) {
|
79
79
|
if (encoded.body.find("no indexName:") != std::string::npos) {
|
80
|
-
response.ctx.ec =
|
80
|
+
response.ctx.ec = error::common_errc::index_not_found;
|
81
81
|
return response;
|
82
82
|
}
|
83
83
|
tao::json::value payload{};
|
84
84
|
try {
|
85
85
|
payload = tao::json::from_string(encoded.body);
|
86
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
87
|
-
response.ctx.ec =
|
86
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
87
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
88
88
|
return response;
|
89
89
|
}
|
90
90
|
response.status = payload.at("status").get_string();
|
91
91
|
response.error = payload.at("error").get_string();
|
92
92
|
if (response.error.find("index not found") != std::string::npos) {
|
93
|
-
response.ctx.ec =
|
93
|
+
response.ctx.ec = error::common_errc::index_not_found;
|
94
94
|
return response;
|
95
95
|
} else if (response.error.find("index with the same name already exists") != std::string::npos) {
|
96
|
-
response.ctx.ec =
|
96
|
+
response.ctx.ec = error::common_errc::index_exists;
|
97
97
|
return response;
|
98
98
|
}
|
99
99
|
}
|
100
|
-
response.ctx.ec =
|
100
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
101
101
|
}
|
102
102
|
return response;
|
103
103
|
}
|
@@ -43,7 +43,7 @@ struct search_index_control_ingest_request {
|
|
43
43
|
std::string index_name;
|
44
44
|
bool pause;
|
45
45
|
|
46
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
47
47
|
{
|
48
48
|
encoded.method = "POST";
|
49
49
|
encoded.path = fmt::format("/api/index/{}/ingestControl/{}", index_name, pause ? "pause" : "resume");
|
@@ -53,17 +53,17 @@ struct search_index_control_ingest_request {
|
|
53
53
|
|
54
54
|
search_index_control_ingest_response
|
55
55
|
make_response(error_context::http&& ctx,
|
56
|
-
search_index_control_ingest_request
|
56
|
+
const search_index_control_ingest_request& /* request */,
|
57
57
|
search_index_control_ingest_request::encoded_response_type&& encoded)
|
58
58
|
{
|
59
|
-
search_index_control_ingest_response response{ ctx };
|
59
|
+
search_index_control_ingest_response response{ std::move(ctx) };
|
60
60
|
if (!response.ctx.ec) {
|
61
61
|
if (encoded.status_code == 200) {
|
62
62
|
tao::json::value payload{};
|
63
63
|
try {
|
64
64
|
payload = tao::json::from_string(encoded.body);
|
65
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
66
|
-
response.ctx.ec =
|
65
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
66
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
67
67
|
return response;
|
68
68
|
}
|
69
69
|
response.status = payload.at("status").get_string();
|
@@ -74,18 +74,18 @@ make_response(error_context::http&& ctx,
|
|
74
74
|
tao::json::value payload{};
|
75
75
|
try {
|
76
76
|
payload = tao::json::from_string(encoded.body);
|
77
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
78
|
-
response.ctx.ec =
|
77
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
78
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
79
79
|
return response;
|
80
80
|
}
|
81
81
|
response.status = payload.at("status").get_string();
|
82
82
|
response.error = payload.at("error").get_string();
|
83
83
|
if (response.error.find("index not found") != std::string::npos) {
|
84
|
-
response.ctx.ec =
|
84
|
+
response.ctx.ec = error::common_errc::index_not_found;
|
85
85
|
return response;
|
86
86
|
}
|
87
87
|
}
|
88
|
-
response.ctx.ec =
|
88
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
89
89
|
}
|
90
90
|
return response;
|
91
91
|
}
|
@@ -43,7 +43,7 @@ struct search_index_control_plan_freeze_request {
|
|
43
43
|
std::string index_name;
|
44
44
|
bool freeze;
|
45
45
|
|
46
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
47
47
|
{
|
48
48
|
encoded.method = "POST";
|
49
49
|
encoded.path = fmt::format("/api/index/{}/planFreezeControl/{}", index_name, freeze ? "freeze" : "unfreeze");
|
@@ -53,17 +53,17 @@ struct search_index_control_plan_freeze_request {
|
|
53
53
|
|
54
54
|
search_index_control_plan_freeze_response
|
55
55
|
make_response(error_context::http&& ctx,
|
56
|
-
search_index_control_plan_freeze_request
|
56
|
+
const search_index_control_plan_freeze_request& /* request */,
|
57
57
|
search_index_control_plan_freeze_request::encoded_response_type&& encoded)
|
58
58
|
{
|
59
|
-
search_index_control_plan_freeze_response response{ ctx };
|
59
|
+
search_index_control_plan_freeze_response response{ std::move(ctx) };
|
60
60
|
if (!response.ctx.ec) {
|
61
61
|
if (encoded.status_code == 200) {
|
62
62
|
tao::json::value payload{};
|
63
63
|
try {
|
64
64
|
payload = tao::json::from_string(encoded.body);
|
65
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
66
|
-
response.ctx.ec =
|
65
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
66
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
67
67
|
return response;
|
68
68
|
}
|
69
69
|
response.status = payload.at("status").get_string();
|
@@ -74,18 +74,18 @@ make_response(error_context::http&& ctx,
|
|
74
74
|
tao::json::value payload{};
|
75
75
|
try {
|
76
76
|
payload = tao::json::from_string(encoded.body);
|
77
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
78
|
-
response.ctx.ec =
|
77
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
78
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
79
79
|
return response;
|
80
80
|
}
|
81
81
|
response.status = payload.at("status").get_string();
|
82
82
|
response.error = payload.at("error").get_string();
|
83
83
|
if (response.error.find("index not found") != std::string::npos) {
|
84
|
-
response.ctx.ec =
|
84
|
+
response.ctx.ec = error::common_errc::index_not_found;
|
85
85
|
return response;
|
86
86
|
}
|
87
87
|
}
|
88
|
-
response.ctx.ec =
|
88
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
89
89
|
}
|
90
90
|
return response;
|
91
91
|
}
|
@@ -43,7 +43,7 @@ struct search_index_control_query_request {
|
|
43
43
|
std::string index_name;
|
44
44
|
bool allow;
|
45
45
|
|
46
|
-
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
47
47
|
{
|
48
48
|
encoded.method = "POST";
|
49
49
|
encoded.path = fmt::format("/api/index/{}/queryControl/{}", index_name, allow ? "allow" : "disallow");
|
@@ -53,17 +53,17 @@ struct search_index_control_query_request {
|
|
53
53
|
|
54
54
|
search_index_control_query_response
|
55
55
|
make_response(error_context::http&& ctx,
|
56
|
-
search_index_control_query_request
|
56
|
+
const search_index_control_query_request& /* request */,
|
57
57
|
search_index_control_query_request::encoded_response_type&& encoded)
|
58
58
|
{
|
59
|
-
search_index_control_query_response response{ ctx };
|
59
|
+
search_index_control_query_response response{ std::move(ctx) };
|
60
60
|
if (!response.ctx.ec) {
|
61
61
|
if (encoded.status_code == 200) {
|
62
62
|
tao::json::value payload{};
|
63
63
|
try {
|
64
64
|
payload = tao::json::from_string(encoded.body);
|
65
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
66
|
-
response.ctx.ec =
|
65
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
66
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
67
67
|
return response;
|
68
68
|
}
|
69
69
|
response.status = payload.at("status").get_string();
|
@@ -74,18 +74,18 @@ make_response(error_context::http&& ctx,
|
|
74
74
|
tao::json::value payload{};
|
75
75
|
try {
|
76
76
|
payload = tao::json::from_string(encoded.body);
|
77
|
-
} catch (tao::json::pegtl::parse_error& e) {
|
78
|
-
response.ctx.ec =
|
77
|
+
} catch (const tao::json::pegtl::parse_error& e) {
|
78
|
+
response.ctx.ec = error::common_errc::parsing_failure;
|
79
79
|
return response;
|
80
80
|
}
|
81
81
|
response.status = payload.at("status").get_string();
|
82
82
|
response.error = payload.at("error").get_string();
|
83
83
|
if (response.error.find("index not found") != std::string::npos) {
|
84
|
-
response.ctx.ec =
|
84
|
+
response.ctx.ec = error::common_errc::index_not_found;
|
85
85
|
return response;
|
86
86
|
}
|
87
87
|
}
|
88
|
-
response.ctx.ec =
|
88
|
+
response.ctx.ec = error::common_errc::internal_server_failure;
|
89
89
|
}
|
90
90
|
return response;
|
91
91
|
}
|