couchbase 3.0.1 → 3.0.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 +73 -4
- data/ext/build_config.hxx.in +2 -0
- data/ext/build_version.hxx.in +11 -8
- data/ext/cmake/BuildTracing.cmake +1 -1
- data/ext/cmake/CompilerWarnings.cmake +5 -0
- data/ext/cmake/Testing.cmake +3 -6
- data/ext/couchbase/bucket.hxx +9 -1
- data/ext/couchbase/cbsasl/client.h +1 -1
- data/ext/couchbase/cluster.hxx +89 -6
- data/ext/couchbase/configuration.hxx +2 -0
- data/ext/couchbase/couchbase.cxx +1647 -507
- data/ext/couchbase/diagnostics.hxx +0 -3
- data/ext/couchbase/io/dns_client.hxx +2 -2
- data/ext/couchbase/io/http_command.hxx +6 -3
- data/ext/couchbase/io/http_session.hxx +14 -18
- data/ext/couchbase/io/http_session_manager.hxx +83 -2
- data/ext/couchbase/io/mcbp_command.hxx +4 -1
- data/ext/couchbase/io/mcbp_context.hxx +37 -0
- data/ext/couchbase/io/mcbp_session.hxx +91 -30
- data/ext/couchbase/operations.hxx +5 -0
- data/ext/couchbase/operations/analytics_dataset_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataset_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataset_get_all.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataverse_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataverse_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_get_all.hxx +5 -2
- data/ext/couchbase/operations/analytics_link_connect.hxx +3 -2
- data/ext/couchbase/operations/analytics_link_disconnect.hxx +3 -2
- data/ext/couchbase/operations/bucket_create.hxx +3 -2
- data/ext/couchbase/operations/bucket_drop.hxx +3 -2
- data/ext/couchbase/operations/bucket_flush.hxx +3 -2
- data/ext/couchbase/operations/bucket_get.hxx +3 -2
- data/ext/couchbase/operations/bucket_get_all.hxx +3 -2
- data/ext/couchbase/operations/bucket_update.hxx +3 -2
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +3 -2
- data/ext/couchbase/operations/collection_create.hxx +3 -2
- data/ext/couchbase/operations/collection_drop.hxx +3 -2
- data/ext/couchbase/operations/collections_manifest_get.hxx +3 -2
- data/ext/couchbase/operations/document_analytics.hxx +3 -2
- data/ext/couchbase/operations/document_append.hxx +77 -0
- data/ext/couchbase/operations/document_decrement.hxx +3 -2
- data/ext/couchbase/operations/document_exists.hxx +3 -2
- data/ext/couchbase/operations/document_get.hxx +3 -2
- data/ext/couchbase/operations/document_get_and_lock.hxx +3 -2
- data/ext/couchbase/operations/document_get_and_touch.hxx +3 -2
- data/ext/couchbase/operations/document_get_projected.hxx +3 -2
- data/ext/couchbase/operations/document_increment.hxx +3 -2
- data/ext/couchbase/operations/document_insert.hxx +3 -2
- data/ext/couchbase/operations/document_lookup_in.hxx +8 -2
- data/ext/couchbase/operations/document_mutate_in.hxx +13 -2
- data/ext/couchbase/operations/document_prepend.hxx +77 -0
- data/ext/couchbase/operations/document_query.hxx +3 -2
- data/ext/couchbase/operations/document_remove.hxx +5 -2
- data/ext/couchbase/operations/document_replace.hxx +3 -2
- data/ext/couchbase/operations/document_search.hxx +3 -2
- data/ext/couchbase/operations/document_touch.hxx +3 -2
- data/ext/couchbase/operations/document_unlock.hxx +3 -2
- data/ext/couchbase/operations/document_upsert.hxx +3 -2
- data/ext/couchbase/operations/document_view.hxx +3 -2
- data/ext/couchbase/operations/group_drop.hxx +3 -2
- data/ext/couchbase/operations/group_get.hxx +3 -2
- data/ext/couchbase/operations/group_get_all.hxx +3 -2
- data/ext/couchbase/operations/group_upsert.hxx +3 -2
- data/ext/couchbase/operations/http_noop.hxx +78 -0
- data/ext/couchbase/operations/mcbp_noop.hxx +61 -0
- data/ext/couchbase/operations/query_index_build_deferred.hxx +3 -2
- data/ext/couchbase/operations/query_index_create.hxx +3 -2
- data/ext/couchbase/operations/query_index_drop.hxx +3 -2
- data/ext/couchbase/operations/query_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/role_get_all.hxx +3 -2
- data/ext/couchbase/operations/scope_create.hxx +3 -2
- data/ext/couchbase/operations/scope_drop.hxx +3 -2
- data/ext/couchbase/operations/scope_get_all.hxx +3 -2
- data/ext/couchbase/operations/search_get_stats.hxx +3 -2
- data/ext/couchbase/operations/search_index_analyze_document.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_ingest.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_query.hxx +3 -2
- data/ext/couchbase/operations/search_index_drop.hxx +3 -2
- data/ext/couchbase/operations/search_index_get.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_stats.hxx +3 -2
- data/ext/couchbase/operations/search_index_upsert.hxx +3 -2
- data/ext/couchbase/operations/user_drop.hxx +3 -2
- data/ext/couchbase/operations/user_get.hxx +3 -2
- data/ext/couchbase/operations/user_get_all.hxx +3 -2
- data/ext/couchbase/operations/user_upsert.hxx +3 -2
- data/ext/couchbase/operations/view_index_drop.hxx +3 -2
- data/ext/couchbase/operations/view_index_get.hxx +3 -2
- data/ext/couchbase/operations/view_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/view_index_upsert.hxx +3 -2
- data/ext/couchbase/platform/terminate_handler.cc +5 -2
- data/ext/couchbase/protocol/client_opcode.hxx +368 -0
- data/ext/couchbase/protocol/cmd_append.hxx +145 -0
- data/ext/couchbase/protocol/cmd_hello.hxx +1 -0
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +11 -3
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +46 -4
- data/ext/couchbase/protocol/cmd_noop.hxx +82 -0
- data/ext/couchbase/protocol/cmd_prepend.hxx +145 -0
- data/ext/couchbase/protocol/durability_level.hxx +16 -0
- data/ext/couchbase/protocol/hello_feature.hxx +9 -0
- data/ext/couchbase/protocol/unsigned_leb128.h +2 -2
- data/ext/couchbase/service_type.hxx +1 -1
- data/ext/couchbase/version.hxx +18 -4
- data/ext/extconf.rb +9 -6
- data/ext/test/CMakeLists.txt +5 -0
- data/ext/test/test_helper.hxx +3 -3
- data/ext/test/test_helper_native.hxx +2 -5
- data/ext/test/test_native_binary_operations.cxx +186 -0
- data/ext/test/test_native_diagnostics.cxx +54 -3
- data/ext/test/test_ruby_trivial_crud.cxx +1 -1
- data/lib/couchbase.rb +1 -0
- data/lib/couchbase/analytics_options.rb +1 -71
- data/lib/couchbase/binary_collection.rb +60 -22
- data/lib/couchbase/binary_collection_options.rb +0 -76
- data/lib/couchbase/bucket.rb +40 -36
- data/lib/couchbase/cluster.rb +89 -156
- data/lib/couchbase/collection.rb +290 -72
- data/lib/couchbase/collection_options.rb +30 -243
- data/lib/couchbase/datastructures/couchbase_list.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_map.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_queue.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_set.rb +5 -16
- data/lib/couchbase/diagnostics.rb +181 -0
- data/lib/couchbase/json_transcoder.rb +1 -1
- data/lib/couchbase/{common_options.rb → logger.rb} +24 -11
- data/lib/couchbase/management/query_index_manager.rb +1 -1
- data/lib/couchbase/management/user_manager.rb +3 -0
- data/lib/couchbase/options.rb +2094 -0
- data/lib/couchbase/query_options.rb +1 -144
- data/lib/couchbase/scope.rb +8 -25
- data/lib/couchbase/search_options.rb +0 -93
- data/lib/couchbase/version.rb +20 -1
- data/lib/couchbase/view_options.rb +1 -91
- metadata +19 -7
|
@@ -51,7 +51,7 @@ struct query_index_drop_request {
|
|
|
51
51
|
bool ignore_if_does_not_exist{ false };
|
|
52
52
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
55
55
|
{
|
|
56
56
|
encoded.headers["content-type"] = "application/json";
|
|
57
57
|
std::string keyspace = fmt::format("`{}`", bucket_name);
|
|
@@ -68,11 +68,12 @@ struct query_index_drop_request {
|
|
|
68
68
|
encoded.method = "POST";
|
|
69
69
|
encoded.path = "/query/service";
|
|
70
70
|
encoded.body = tao::json::to_string(body);
|
|
71
|
+
return {};
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
query_index_drop_response
|
|
75
|
-
make_response(std::error_code ec, query_index_drop_request& request, query_index_drop_request::encoded_response_type encoded)
|
|
76
|
+
make_response(std::error_code ec, query_index_drop_request& request, query_index_drop_request::encoded_response_type&& encoded)
|
|
76
77
|
{
|
|
77
78
|
query_index_drop_response response{ request.client_context_id, ec };
|
|
78
79
|
if (!ec) {
|
|
@@ -56,7 +56,7 @@ struct query_index_get_all_request {
|
|
|
56
56
|
std::string bucket_name;
|
|
57
57
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
60
60
|
{
|
|
61
61
|
encoded.headers["content-type"] = "application/json";
|
|
62
62
|
tao::json::value body{
|
|
@@ -70,11 +70,12 @@ struct query_index_get_all_request {
|
|
|
70
70
|
encoded.method = "POST";
|
|
71
71
|
encoded.path = "/query/service";
|
|
72
72
|
encoded.body = tao::json::to_string(body);
|
|
73
|
+
return {};
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
query_index_get_all_response
|
|
77
|
-
make_response(std::error_code ec, query_index_get_all_request& request, query_index_get_all_request::encoded_response_type encoded)
|
|
78
|
+
make_response(std::error_code ec, query_index_get_all_request& request, query_index_get_all_request::encoded_response_type&& encoded)
|
|
78
79
|
{
|
|
79
80
|
query_index_get_all_response response{ request.client_context_id, ec };
|
|
80
81
|
if (!ec) {
|
|
@@ -42,16 +42,17 @@ 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
|
-
|
|
45
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
46
46
|
{
|
|
47
47
|
encoded.method = "GET";
|
|
48
48
|
encoded.path = "/settings/rbac/roles";
|
|
49
49
|
encoded.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
role_get_all_response
|
|
54
|
-
make_response(std::error_code ec, role_get_all_request& request, role_get_all_request::encoded_response_type encoded)
|
|
55
|
+
make_response(std::error_code ec, role_get_all_request& request, role_get_all_request::encoded_response_type&& encoded)
|
|
55
56
|
{
|
|
56
57
|
role_get_all_response response{ request.client_context_id, ec };
|
|
57
58
|
if (!ec) {
|
|
@@ -44,17 +44,18 @@ struct scope_create_request {
|
|
|
44
44
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
45
45
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "POST";
|
|
50
50
|
encoded.path = fmt::format("/pools/default/buckets/{}/collections", bucket_name);
|
|
51
51
|
encoded.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
52
52
|
encoded.body = fmt::format("name={}", utils::string_codec::form_encode(scope_name));
|
|
53
|
+
return {};
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
scope_create_response
|
|
57
|
-
make_response(std::error_code ec, scope_create_request& request, scope_create_request::encoded_response_type encoded)
|
|
58
|
+
make_response(std::error_code ec, scope_create_request& request, scope_create_request::encoded_response_type&& encoded)
|
|
58
59
|
{
|
|
59
60
|
scope_create_response response{ request.client_context_id, ec };
|
|
60
61
|
if (!ec) {
|
|
@@ -44,15 +44,16 @@ struct scope_drop_request {
|
|
|
44
44
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
45
45
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "DELETE";
|
|
50
50
|
encoded.path = fmt::format("/pools/default/buckets/{}/collections/{}", bucket_name, scope_name);
|
|
51
|
+
return {};
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
scope_drop_response
|
|
55
|
-
make_response(std::error_code ec, scope_drop_request& request, scope_drop_request::encoded_response_type encoded)
|
|
56
|
+
make_response(std::error_code ec, scope_drop_request& request, scope_drop_request::encoded_response_type&& encoded)
|
|
56
57
|
{
|
|
57
58
|
scope_drop_response response{ request.client_context_id, ec };
|
|
58
59
|
if (!ec) {
|
|
@@ -43,15 +43,16 @@ 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
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "GET";
|
|
49
49
|
encoded.path = fmt::format("/pools/default/buckets/{}/collections", bucket_name);
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
scope_get_all_response
|
|
54
|
-
make_response(std::error_code ec, scope_get_all_request& request, scope_get_all_request::encoded_response_type encoded)
|
|
55
|
+
make_response(std::error_code ec, scope_get_all_request& request, scope_get_all_request::encoded_response_type&& encoded)
|
|
55
56
|
{
|
|
56
57
|
scope_get_all_response response{ request.client_context_id, ec };
|
|
57
58
|
if (!ec) {
|
|
@@ -39,15 +39,16 @@ 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
|
-
|
|
42
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
43
43
|
{
|
|
44
44
|
encoded.method = "GET";
|
|
45
45
|
encoded.path = "/api/nsstats";
|
|
46
|
+
return {};
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
search_index_stats_response
|
|
50
|
-
make_response(std::error_code ec, search_index_stats_request& request, search_index_stats_request::encoded_response_type encoded)
|
|
51
|
+
make_response(std::error_code ec, search_index_stats_request& request, search_index_stats_request::encoded_response_type&& encoded)
|
|
51
52
|
{
|
|
52
53
|
search_index_stats_response response{ request.client_context_id, ec };
|
|
53
54
|
if (!ec) {
|
|
@@ -44,20 +44,21 @@ struct search_index_analyze_document_request {
|
|
|
44
44
|
std::string index_name;
|
|
45
45
|
std::string encoded_document;
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "POST";
|
|
50
50
|
encoded.headers["cache-control"] = "no-cache";
|
|
51
51
|
encoded.headers["content-type"] = "application/json";
|
|
52
52
|
encoded.path = fmt::format("/api/index/{}/analyzeDoc", index_name);
|
|
53
53
|
encoded.body = encoded_document;
|
|
54
|
+
return {};
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
search_index_analyze_document_response
|
|
58
59
|
make_response(std::error_code ec,
|
|
59
60
|
search_index_analyze_document_request& request,
|
|
60
|
-
search_index_analyze_document_request::encoded_response_type encoded)
|
|
61
|
+
search_index_analyze_document_request::encoded_response_type&& encoded)
|
|
61
62
|
{
|
|
62
63
|
search_index_analyze_document_response response{ request.client_context_id, ec };
|
|
63
64
|
if (!ec) {
|
|
@@ -43,17 +43,18 @@ struct search_index_control_ingest_request {
|
|
|
43
43
|
std::string index_name;
|
|
44
44
|
bool pause;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "POST";
|
|
49
49
|
encoded.path = fmt::format("/api/index/{}/ingestControl/{}", index_name, pause ? "pause" : "resume");
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
search_index_control_ingest_response
|
|
54
55
|
make_response(std::error_code ec,
|
|
55
56
|
search_index_control_ingest_request& request,
|
|
56
|
-
search_index_control_ingest_request::encoded_response_type encoded)
|
|
57
|
+
search_index_control_ingest_request::encoded_response_type&& encoded)
|
|
57
58
|
{
|
|
58
59
|
search_index_control_ingest_response response{ request.client_context_id, ec };
|
|
59
60
|
if (!ec) {
|
|
@@ -43,17 +43,18 @@ struct search_index_control_plan_freeze_request {
|
|
|
43
43
|
std::string index_name;
|
|
44
44
|
bool freeze;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "POST";
|
|
49
49
|
encoded.path = fmt::format("/api/index/{}/planFreezeControl/{}", index_name, freeze ? "freeze" : "unfreeze");
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
search_index_control_plan_freeze_response
|
|
54
55
|
make_response(std::error_code ec,
|
|
55
56
|
search_index_control_plan_freeze_request& request,
|
|
56
|
-
search_index_control_plan_freeze_request::encoded_response_type encoded)
|
|
57
|
+
search_index_control_plan_freeze_request::encoded_response_type&& encoded)
|
|
57
58
|
{
|
|
58
59
|
search_index_control_plan_freeze_response response{ request.client_context_id, ec };
|
|
59
60
|
if (!ec) {
|
|
@@ -43,17 +43,18 @@ struct search_index_control_query_request {
|
|
|
43
43
|
std::string index_name;
|
|
44
44
|
bool allow;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "POST";
|
|
49
49
|
encoded.path = fmt::format("/api/index/{}/queryControl/{}", index_name, allow ? "allow" : "disallow");
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
search_index_control_query_response
|
|
54
55
|
make_response(std::error_code ec,
|
|
55
56
|
search_index_control_query_request& request,
|
|
56
|
-
search_index_control_query_request::encoded_response_type encoded)
|
|
57
|
+
search_index_control_query_request::encoded_response_type&& encoded)
|
|
57
58
|
{
|
|
58
59
|
search_index_control_query_response response{ request.client_context_id, ec };
|
|
59
60
|
if (!ec) {
|
|
@@ -42,15 +42,16 @@ struct search_index_drop_request {
|
|
|
42
42
|
|
|
43
43
|
std::string index_name;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
46
46
|
{
|
|
47
47
|
encoded.method = "DELETE";
|
|
48
48
|
encoded.path = fmt::format("/api/index/{}", index_name);
|
|
49
|
+
return {};
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
search_index_drop_response
|
|
53
|
-
make_response(std::error_code ec, search_index_drop_request& request, search_index_drop_request::encoded_response_type encoded)
|
|
54
|
+
make_response(std::error_code ec, search_index_drop_request& request, search_index_drop_request::encoded_response_type&& encoded)
|
|
54
55
|
{
|
|
55
56
|
search_index_drop_response response{ request.client_context_id, ec };
|
|
56
57
|
if (!ec) {
|
|
@@ -44,15 +44,16 @@ struct search_index_get_request {
|
|
|
44
44
|
|
|
45
45
|
std::string index_name;
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "GET";
|
|
50
50
|
encoded.path = fmt::format("/api/index/{}", index_name);
|
|
51
|
+
return {};
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
search_index_get_response
|
|
55
|
-
make_response(std::error_code ec, search_index_get_request& request, search_index_get_request::encoded_response_type encoded)
|
|
56
|
+
make_response(std::error_code ec, search_index_get_request& request, search_index_get_request::encoded_response_type&& encoded)
|
|
56
57
|
{
|
|
57
58
|
search_index_get_response response{ request.client_context_id, ec };
|
|
58
59
|
if (!ec) {
|
|
@@ -44,15 +44,16 @@ struct search_index_get_all_request {
|
|
|
44
44
|
|
|
45
45
|
std::string index_name;
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "GET";
|
|
50
50
|
encoded.path = fmt::format("/api/index");
|
|
51
|
+
return {};
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
search_index_get_all_response
|
|
55
|
-
make_response(std::error_code ec, search_index_get_all_request& request, search_index_get_all_request::encoded_response_type encoded)
|
|
56
|
+
make_response(std::error_code ec, search_index_get_all_request& request, search_index_get_all_request::encoded_response_type&& encoded)
|
|
56
57
|
{
|
|
57
58
|
search_index_get_all_response response{ request.client_context_id, ec };
|
|
58
59
|
if (!ec) {
|
|
@@ -43,17 +43,18 @@ struct search_index_get_documents_count_request {
|
|
|
43
43
|
|
|
44
44
|
std::string index_name;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "GET";
|
|
49
49
|
encoded.path = fmt::format("/api/index/{}/count", index_name);
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
search_index_get_documents_count_response
|
|
54
55
|
make_response(std::error_code ec,
|
|
55
56
|
search_index_get_documents_count_request& request,
|
|
56
|
-
search_index_get_documents_count_request::encoded_response_type encoded)
|
|
57
|
+
search_index_get_documents_count_request::encoded_response_type&& encoded)
|
|
57
58
|
{
|
|
58
59
|
search_index_get_documents_count_response response{ request.client_context_id, ec };
|
|
59
60
|
if (!ec) {
|
|
@@ -43,15 +43,16 @@ struct search_index_get_stats_request {
|
|
|
43
43
|
|
|
44
44
|
std::string index_name;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "GET";
|
|
49
49
|
encoded.path = fmt::format("/api/stats/index/{}", index_name);
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
search_index_get_stats_response
|
|
54
|
-
make_response(std::error_code ec, search_index_get_stats_request& request, search_index_get_stats_request::encoded_response_type encoded)
|
|
55
|
+
make_response(std::error_code ec, search_index_get_stats_request& request, search_index_get_stats_request::encoded_response_type&& encoded)
|
|
55
56
|
{
|
|
56
57
|
search_index_get_stats_response response{ request.client_context_id, ec };
|
|
57
58
|
if (!ec) {
|
|
@@ -42,7 +42,7 @@ struct search_index_upsert_request {
|
|
|
42
42
|
|
|
43
43
|
search_index index;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
46
46
|
{
|
|
47
47
|
encoded.method = "PUT";
|
|
48
48
|
encoded.headers["cache-control"] = "no-cache";
|
|
@@ -72,11 +72,12 @@ struct search_index_upsert_request {
|
|
|
72
72
|
body["planParams"] = tao::json::from_string(index.plan_params_json);
|
|
73
73
|
}
|
|
74
74
|
encoded.body = tao::json::to_string(body);
|
|
75
|
+
return {};
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
search_index_upsert_response
|
|
79
|
-
make_response(std::error_code ec, search_index_upsert_request& request, search_index_upsert_request::encoded_response_type encoded)
|
|
80
|
+
make_response(std::error_code ec, search_index_upsert_request& request, search_index_upsert_request::encoded_response_type&& encoded)
|
|
80
81
|
{
|
|
81
82
|
search_index_upsert_response response{ request.client_context_id, ec };
|
|
82
83
|
if (!ec) {
|
|
@@ -43,15 +43,16 @@ struct user_drop_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
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "DELETE";
|
|
49
49
|
encoded.path = fmt::format("/settings/rbac/users/{}/{}", domain, username);
|
|
50
|
+
return {};
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
user_drop_response
|
|
54
|
-
make_response(std::error_code ec, user_drop_request& request, user_drop_request::encoded_response_type encoded)
|
|
55
|
+
make_response(std::error_code ec, user_drop_request& request, user_drop_request::encoded_response_type&& encoded)
|
|
55
56
|
{
|
|
56
57
|
user_drop_response response{ request.client_context_id, ec };
|
|
57
58
|
if (!ec) {
|
|
@@ -44,16 +44,17 @@ struct user_get_request {
|
|
|
44
44
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
45
45
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
48
48
|
{
|
|
49
49
|
encoded.method = "GET";
|
|
50
50
|
encoded.path = fmt::format("/settings/rbac/users/{}/{}", domain, username);
|
|
51
51
|
encoded.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
52
|
+
return {};
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
user_get_response
|
|
56
|
-
make_response(std::error_code ec, user_get_request& request, user_get_request::encoded_response_type encoded)
|
|
57
|
+
make_response(std::error_code ec, user_get_request& request, user_get_request::encoded_response_type&& encoded)
|
|
57
58
|
{
|
|
58
59
|
user_get_response response{ request.client_context_id, ec };
|
|
59
60
|
if (!ec) {
|
|
@@ -43,16 +43,17 @@ struct user_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
|
-
|
|
46
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
47
47
|
{
|
|
48
48
|
encoded.method = "GET";
|
|
49
49
|
encoded.path = fmt::format("/settings/rbac/users/{}", domain);
|
|
50
50
|
encoded.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
51
|
+
return {};
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
user_get_all_response
|
|
55
|
-
make_response(std::error_code ec, user_get_all_request& request, user_get_all_request::encoded_response_type encoded)
|
|
56
|
+
make_response(std::error_code ec, user_get_all_request& request, user_get_all_request::encoded_response_type&& encoded)
|
|
56
57
|
{
|
|
57
58
|
user_get_all_response response{ request.client_context_id, ec };
|
|
58
59
|
if (!ec) {
|
|
@@ -48,7 +48,7 @@ struct user_upsert_request {
|
|
|
48
48
|
std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
|
|
49
49
|
std::string client_context_id{ uuid::to_string(uuid::random()) };
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
52
52
|
{
|
|
53
53
|
encoded.method = "PUT";
|
|
54
54
|
encoded.path = fmt::format("/settings/rbac/users/{}/{}", domain, user.username);
|
|
@@ -93,11 +93,12 @@ struct user_upsert_request {
|
|
|
93
93
|
}
|
|
94
94
|
encoded.body = fmt::format("{}", fmt::join(params, "&"));
|
|
95
95
|
encoded.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
96
|
+
return {};
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
user_upsert_response
|
|
100
|
-
make_response(std::error_code ec, user_upsert_request& request, user_upsert_request::encoded_response_type encoded)
|
|
101
|
+
make_response(std::error_code ec, user_upsert_request& request, user_upsert_request::encoded_response_type&& encoded)
|
|
101
102
|
{
|
|
102
103
|
user_upsert_response response{ request.client_context_id, ec };
|
|
103
104
|
if (!ec) {
|
|
@@ -40,16 +40,17 @@ struct view_index_drop_request {
|
|
|
40
40
|
std::string document_name;
|
|
41
41
|
design_document::name_space name_space;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, http_context&)
|
|
44
44
|
{
|
|
45
45
|
encoded.method = "DELETE";
|
|
46
46
|
encoded.path =
|
|
47
47
|
fmt::format("/{}/_design/{}{}", bucket_name, name_space == design_document::name_space::development ? "dev_" : "", document_name);
|
|
48
|
+
return {};
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
view_index_drop_response
|
|
52
|
-
make_response(std::error_code ec, view_index_drop_request& request, view_index_drop_request::encoded_response_type encoded)
|
|
53
|
+
make_response(std::error_code ec, view_index_drop_request& request, view_index_drop_request::encoded_response_type&& encoded)
|
|
53
54
|
{
|
|
54
55
|
view_index_drop_response response{ request.client_context_id, ec };
|
|
55
56
|
if (!ec) {
|