couchbase 4.2.9 → 4.2.10

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.
Files changed (93) hide show
  1. package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
  2. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
  3. package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
  4. package/deps/couchbase-cxx-client/core/bucket.cxx +52 -2
  5. package/deps/couchbase-cxx-client/core/bucket.hxx +1 -1
  6. package/deps/couchbase-cxx-client/core/cluster.cxx +38 -0
  7. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
  8. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
  9. package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
  10. package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
  11. package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
  12. package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
  13. package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
  14. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
  15. package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
  16. package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
  17. package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
  18. package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
  19. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +24 -32
  20. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
  21. package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
  22. package/deps/couchbase-cxx-client/core/meta/features.hxx +10 -0
  23. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +6 -1
  24. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
  25. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
  26. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +7 -6
  27. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
  28. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
  29. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
  30. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -0
  31. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +17 -1
  32. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
  33. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
  34. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
  35. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
  36. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
  37. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
  38. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
  39. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
  40. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
  41. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
  42. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
  43. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
  44. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
  45. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
  46. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
  47. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
  48. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
  49. package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
  50. package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
  51. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +4 -0
  52. package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
  53. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
  54. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
  55. package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
  56. package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
  57. package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
  58. package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
  59. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
  60. package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
  61. package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
  62. package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
  63. package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
  64. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
  65. package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
  66. package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
  67. package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
  68. package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
  69. package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
  70. package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
  71. package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
  72. package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
  73. package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
  74. package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
  75. package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
  76. package/dist/binding.d.ts +9 -0
  77. package/dist/binding.js +4 -1
  78. package/dist/bindingutilities.d.ts +6 -1
  79. package/dist/bindingutilities.js +15 -1
  80. package/dist/cluster.d.ts +12 -1
  81. package/dist/cluster.js +22 -0
  82. package/dist/couchbase.d.ts +1 -0
  83. package/dist/couchbase.js +1 -0
  84. package/dist/searchexecutor.d.ts +2 -2
  85. package/dist/searchexecutor.js +19 -3
  86. package/dist/searchtypes.d.ts +46 -0
  87. package/dist/searchtypes.js +81 -1
  88. package/dist/vectorsearch.d.ts +99 -0
  89. package/dist/vectorsearch.js +132 -0
  90. package/package.json +7 -7
  91. package/src/constants.cpp +11 -0
  92. package/src/jstocbpp_autogen.hpp +24 -7
  93. package/tools/gen-bindings-json.py +2 -0
@@ -31,7 +31,15 @@ search_index_control_ingest_request::encode_to(encoded_request_type& encoded, ht
31
31
  return errc::common::invalid_argument;
32
32
  }
33
33
  encoded.method = "POST";
34
- encoded.path = fmt::format("/api/index/{}/ingestControl/{}", index_name, pause ? "pause" : "resume");
34
+ if (bucket_name.has_value() && scope_name.has_value()) {
35
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}/ingestControl/{}",
36
+ bucket_name.value(),
37
+ scope_name.value(),
38
+ index_name,
39
+ pause ? "pause" : "resume");
40
+ } else {
41
+ encoded.path = fmt::format("/api/index/{}/ingestControl/{}", index_name, pause ? "pause" : "resume");
42
+ }
35
43
  return {};
36
44
  }
37
45
 
@@ -66,6 +74,18 @@ search_index_control_ingest_request::make_response(error_context::http&& ctx, co
66
74
  response.ctx.ec = errc::common::index_not_found;
67
75
  return response;
68
76
  }
77
+ } else if (encoded.status_code == 404) {
78
+ tao::json::value payload{};
79
+ try {
80
+ payload = utils::json::parse(encoded.body.data());
81
+ } catch (const tao::pegtl::parse_error&) {
82
+ response.ctx.ec = errc::common::parsing_failure;
83
+ return response;
84
+ }
85
+ response.status = payload.at("status").get_string();
86
+ response.error = payload.at("error").get_string();
87
+ response.ctx.ec = errc::common::feature_not_available;
88
+ return response;
69
89
  }
70
90
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
71
91
  }
@@ -42,6 +42,9 @@ struct search_index_control_ingest_request {
42
42
  std::string index_name;
43
43
  bool pause;
44
44
 
45
+ std::optional<std::string> bucket_name;
46
+ std::optional<std::string> scope_name;
47
+
45
48
  std::optional<std::string> client_context_id{};
46
49
  std::optional<std::chrono::milliseconds> timeout{};
47
50
 
@@ -31,7 +31,15 @@ search_index_control_plan_freeze_request::encode_to(encoded_request_type& encode
31
31
  return errc::common::invalid_argument;
32
32
  }
33
33
  encoded.method = "POST";
34
- encoded.path = fmt::format("/api/index/{}/planFreezeControl/{}", index_name, freeze ? "freeze" : "unfreeze");
34
+ if (bucket_name.has_value() && scope_name.has_value()) {
35
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}/planFreezeControl/{}",
36
+ bucket_name.value(),
37
+ scope_name.value(),
38
+ index_name,
39
+ freeze ? "freeze" : "unfreeze");
40
+ } else {
41
+ encoded.path = fmt::format("/api/index/{}/planFreezeControl/{}", index_name, freeze ? "freeze" : "unfreeze");
42
+ }
35
43
  return {};
36
44
  }
37
45
 
@@ -66,6 +74,18 @@ search_index_control_plan_freeze_request::make_response(error_context::http&& ct
66
74
  response.ctx.ec = errc::common::index_not_found;
67
75
  return response;
68
76
  }
77
+ } else if (encoded.status_code == 404) {
78
+ tao::json::value payload{};
79
+ try {
80
+ payload = utils::json::parse(encoded.body.data());
81
+ } catch (const tao::pegtl::parse_error&) {
82
+ response.ctx.ec = errc::common::parsing_failure;
83
+ return response;
84
+ }
85
+ response.status = payload.at("status").get_string();
86
+ response.error = payload.at("error").get_string();
87
+ response.ctx.ec = errc::common::feature_not_available;
88
+ return response;
69
89
  }
70
90
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
71
91
  }
@@ -44,6 +44,9 @@ struct search_index_control_plan_freeze_request {
44
44
  std::string index_name;
45
45
  bool freeze;
46
46
 
47
+ std::optional<std::string> bucket_name;
48
+ std::optional<std::string> scope_name;
49
+
47
50
  std::optional<std::string> client_context_id{};
48
51
  std::optional<std::chrono::milliseconds> timeout{};
49
52
 
@@ -31,7 +31,15 @@ search_index_control_query_request::encode_to(encoded_request_type& encoded, htt
31
31
  return errc::common::invalid_argument;
32
32
  }
33
33
  encoded.method = "POST";
34
- encoded.path = fmt::format("/api/index/{}/queryControl/{}", index_name, allow ? "allow" : "disallow");
34
+ if (bucket_name.has_value() && scope_name.has_value()) {
35
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}/queryControl/{}",
36
+ bucket_name.value(),
37
+ scope_name.value(),
38
+ index_name,
39
+ allow ? "allow" : "disallow");
40
+ } else {
41
+ encoded.path = fmt::format("/api/index/{}/queryControl/{}", index_name, allow ? "allow" : "disallow");
42
+ }
35
43
  return {};
36
44
  }
37
45
 
@@ -66,6 +74,18 @@ search_index_control_query_request::make_response(error_context::http&& ctx, con
66
74
  response.ctx.ec = errc::common::index_not_found;
67
75
  return response;
68
76
  }
77
+ } else if (encoded.status_code == 404) {
78
+ tao::json::value payload{};
79
+ try {
80
+ payload = utils::json::parse(encoded.body.data());
81
+ } catch (const tao::pegtl::parse_error&) {
82
+ response.ctx.ec = errc::common::parsing_failure;
83
+ return response;
84
+ }
85
+ response.status = payload.at("status").get_string();
86
+ response.error = payload.at("error").get_string();
87
+ response.ctx.ec = errc::common::feature_not_available;
88
+ return response;
69
89
  }
70
90
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
71
91
  }
@@ -42,6 +42,9 @@ struct search_index_control_query_request {
42
42
  std::string index_name;
43
43
  bool allow;
44
44
 
45
+ std::optional<std::string> bucket_name;
46
+ std::optional<std::string> scope_name;
47
+
45
48
  std::optional<std::string> client_context_id{};
46
49
  std::optional<std::chrono::milliseconds> timeout{};
47
50
 
@@ -31,7 +31,11 @@ search_index_drop_request::encode_to(encoded_request_type& encoded, http_context
31
31
  return errc::common::invalid_argument;
32
32
  }
33
33
  encoded.method = "DELETE";
34
- encoded.path = fmt::format("/api/index/{}", index_name);
34
+ if (bucket_name.has_value() && scope_name.has_value()) {
35
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}", bucket_name.value(), scope_name.value(), index_name);
36
+ } else {
37
+ encoded.path = fmt::format("/api/index/{}", index_name);
38
+ }
35
39
  return {};
36
40
  }
37
41
  search_index_drop_response
@@ -65,6 +69,18 @@ search_index_drop_request::make_response(error_context::http&& ctx, const encode
65
69
  response.ctx.ec = errc::common::index_not_found;
66
70
  return response;
67
71
  }
72
+ } else if (encoded.status_code == 404) {
73
+ tao::json::value payload{};
74
+ try {
75
+ payload = utils::json::parse(encoded.body.data());
76
+ } catch (const tao::pegtl::parse_error&) {
77
+ response.ctx.ec = errc::common::parsing_failure;
78
+ return response;
79
+ }
80
+ response.status = payload.at("status").get_string();
81
+ response.error = payload.at("error").get_string();
82
+ response.ctx.ec = errc::common::feature_not_available;
83
+ return response;
68
84
  }
69
85
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
70
86
  }
@@ -41,6 +41,9 @@ struct search_index_drop_request {
41
41
 
42
42
  std::string index_name;
43
43
 
44
+ std::optional<std::string> bucket_name;
45
+ std::optional<std::string> scope_name;
46
+
44
47
  std::optional<std::string> client_context_id{};
45
48
  std::optional<std::chrono::milliseconds> timeout{};
46
49
 
@@ -32,7 +32,11 @@ search_index_get_request::encode_to(encoded_request_type& encoded, http_context&
32
32
  return errc::common::invalid_argument;
33
33
  }
34
34
  encoded.method = "GET";
35
- encoded.path = fmt::format("/api/index/{}", index_name);
35
+ if (bucket_name.has_value() && scope_name.has_value()) {
36
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}", bucket_name.value(), scope_name.value(), index_name);
37
+ } else {
38
+ encoded.path = fmt::format("/api/index/{}", index_name);
39
+ }
36
40
  return {};
37
41
  }
38
42
 
@@ -68,6 +72,18 @@ search_index_get_request::make_response(error_context::http&& ctx, const encoded
68
72
  response.ctx.ec = errc::common::index_not_found;
69
73
  return response;
70
74
  }
75
+ } else if (encoded.status_code == 404) {
76
+ tao::json::value payload{};
77
+ try {
78
+ payload = utils::json::parse(encoded.body.data());
79
+ } catch (const tao::pegtl::parse_error&) {
80
+ response.ctx.ec = errc::common::parsing_failure;
81
+ return response;
82
+ }
83
+ response.status = payload.at("status").get_string();
84
+ response.error = payload.at("error").get_string();
85
+ response.ctx.ec = errc::common::feature_not_available;
86
+ return response;
71
87
  }
72
88
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
73
89
  }
@@ -42,6 +42,8 @@ struct search_index_get_request {
42
42
  static const inline service_type type = service_type::search;
43
43
 
44
44
  std::string index_name;
45
+ std::optional<std::string> bucket_name;
46
+ std::optional<std::string> scope_name;
45
47
 
46
48
  std::optional<std::string> client_context_id{};
47
49
  std::optional<std::chrono::milliseconds> timeout{};
@@ -21,13 +21,19 @@
21
21
  #include "core/utils/json.hxx"
22
22
  #include "error_utils.hxx"
23
23
 
24
+ #include <fmt/core.h>
25
+
24
26
  namespace couchbase::core::operations::management
25
27
  {
26
28
  std::error_code
27
29
  search_index_get_all_request::encode_to(encoded_request_type& encoded, http_context& /* context */) const
28
30
  {
29
31
  encoded.method = "GET";
30
- encoded.path = "/api/index";
32
+ if (bucket_name.has_value() && scope_name.has_value()) {
33
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index", bucket_name.value(), scope_name.value());
34
+ } else {
35
+ encoded.path = "/api/index";
36
+ }
31
37
  return {};
32
38
  }
33
39
 
@@ -36,30 +42,41 @@ search_index_get_all_request::make_response(error_context::http&& ctx, const enc
36
42
  {
37
43
  search_index_get_all_response response{ std::move(ctx) };
38
44
  if (!response.ctx.ec) {
39
- if (encoded.status_code != 200) {
40
- response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
41
- return response;
42
- }
43
- tao::json::value payload{};
44
- try {
45
- payload = utils::json::parse(encoded.body.data());
46
- } catch (const tao::pegtl::parse_error&) {
47
- response.ctx.ec = errc::common::parsing_failure;
48
- return response;
49
- }
50
- response.status = payload.at("status").get_string();
51
- if (response.status != "ok") {
52
- return response;
53
- }
54
- if (const auto* indexDefs = payload.find("indexDefs"); indexDefs != nullptr && indexDefs->is_object()) {
55
- if (const auto* impl_ver = indexDefs->find("implVersion"); impl_ver != nullptr && impl_ver->is_string()) {
56
- response.impl_version = impl_ver->get_string();
45
+ if (encoded.status_code == 200) {
46
+ tao::json::value payload{};
47
+ try {
48
+ payload = utils::json::parse(encoded.body.data());
49
+ } catch (const tao::pegtl::parse_error&) {
50
+ response.ctx.ec = errc::common::parsing_failure;
51
+ return response;
52
+ }
53
+ response.status = payload.at("status").get_string();
54
+ if (response.status != "ok") {
55
+ return response;
57
56
  }
58
- const auto* indexes = indexDefs->find("indexDefs");
59
- for (const auto& [name, index] : indexes->get_object()) {
60
- response.indexes.emplace_back(index.as<couchbase::core::management::search::index>());
57
+ if (const auto* indexDefs = payload.find("indexDefs"); indexDefs != nullptr && indexDefs->is_object()) {
58
+ if (const auto* impl_ver = indexDefs->find("implVersion"); impl_ver != nullptr && impl_ver->is_string()) {
59
+ response.impl_version = impl_ver->get_string();
60
+ }
61
+ const auto* indexes = indexDefs->find("indexDefs");
62
+ for (const auto& [name, index] : indexes->get_object()) {
63
+ response.indexes.emplace_back(index.as<couchbase::core::management::search::index>());
64
+ }
65
+ return response;
61
66
  }
67
+ } else if (encoded.status_code == 404) {
68
+ tao::json::value payload{};
69
+ try {
70
+ payload = utils::json::parse(encoded.body.data());
71
+ } catch (const tao::pegtl::parse_error&) {
72
+ response.ctx.ec = errc::common::parsing_failure;
73
+ return response;
74
+ }
75
+ response.status = payload.at("status").get_string();
76
+ response.ctx.ec = errc::common::feature_not_available;
77
+ return response;
62
78
  }
79
+ response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
63
80
  }
64
81
  return response;
65
82
  }
@@ -41,6 +41,9 @@ struct search_index_get_all_request {
41
41
 
42
42
  static const inline service_type type = service_type::search;
43
43
 
44
+ std::optional<std::string> bucket_name;
45
+ std::optional<std::string> scope_name;
46
+
44
47
  std::optional<std::string> client_context_id{};
45
48
  std::optional<std::chrono::milliseconds> timeout{};
46
49
 
@@ -28,7 +28,11 @@ std::error_code
28
28
  search_index_get_documents_count_request::encode_to(encoded_request_type& encoded, http_context& /* context */) const
29
29
  {
30
30
  encoded.method = "GET";
31
- encoded.path = fmt::format("/api/index/{}/count", index_name);
31
+ if (bucket_name.has_value() && scope_name.has_value()) {
32
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}/count", bucket_name.value(), scope_name.value(), index_name);
33
+ } else {
34
+ encoded.path = fmt::format("/api/index/{}/count", index_name);
35
+ }
32
36
  return {};
33
37
  }
34
38
 
@@ -52,6 +56,19 @@ search_index_get_documents_count_request::make_response(error_context::http&& ct
52
56
  return response;
53
57
  }
54
58
  } break;
59
+ case 404: {
60
+ tao::json::value payload{};
61
+ try {
62
+ payload = utils::json::parse(encoded.body.data());
63
+ } catch (const tao::pegtl::parse_error&) {
64
+ response.ctx.ec = errc::common::parsing_failure;
65
+ return response;
66
+ }
67
+ response.status = payload.at("status").get_string();
68
+ response.error = payload.at("error").get_string();
69
+ response.ctx.ec = errc::common::feature_not_available;
70
+ return response;
71
+ }
55
72
  case 400:
56
73
  case 500: {
57
74
  tao::json::value payload{};
@@ -42,6 +42,9 @@ struct search_index_get_documents_count_request {
42
42
 
43
43
  std::string index_name;
44
44
 
45
+ std::optional<std::string> bucket_name;
46
+ std::optional<std::string> scope_name;
47
+
45
48
  std::optional<std::string> client_context_id{};
46
49
  std::optional<std::chrono::milliseconds> timeout{};
47
50
 
@@ -34,7 +34,11 @@ search_index_upsert_request::encode_to(encoded_request_type& encoded, http_conte
34
34
  encoded.method = "PUT";
35
35
  encoded.headers["cache-control"] = "no-cache";
36
36
  encoded.headers["content-type"] = "application/json";
37
- encoded.path = fmt::format("/api/index/{}", index.name);
37
+ if (bucket_name.has_value() && scope_name.has_value()) {
38
+ encoded.path = fmt::format("/api/bucket/{}/scope/{}/index/{}", bucket_name.value(), scope_name.value(), index.name);
39
+ } else {
40
+ encoded.path = fmt::format("/api/index/{}", index.name);
41
+ }
38
42
  tao::json::value body{
39
43
  { "name", index.name },
40
44
  { "type", index.type },
@@ -108,6 +112,18 @@ search_index_upsert_request::make_response(error_context::http&& ctx, const enco
108
112
  response.ctx.ec = errc::common::quota_limited;
109
113
  return response;
110
114
  }
115
+ } else if (encoded.status_code == 404) {
116
+ tao::json::value payload{};
117
+ try {
118
+ payload = utils::json::parse(encoded.body.data());
119
+ } catch (const tao::pegtl::parse_error&) {
120
+ response.ctx.ec = errc::common::parsing_failure;
121
+ return response;
122
+ }
123
+ response.status = payload.at("status").get_string();
124
+ response.error = payload.at("error").get_string();
125
+ response.ctx.ec = errc::common::feature_not_available;
126
+ return response;
111
127
  }
112
128
  response.ctx.ec = extract_common_error_code(encoded.status_code, encoded.body.data());
113
129
  }
@@ -44,6 +44,9 @@ struct search_index_upsert_request {
44
44
 
45
45
  couchbase::core::management::search::index index;
46
46
 
47
+ std::optional<std::string> bucket_name;
48
+ std::optional<std::string> scope_name;
49
+
47
50
  std::optional<std::string> client_context_id{};
48
51
  std::optional<std::chrono::milliseconds> timeout{};
49
52
 
@@ -28,7 +28,7 @@ struct collections_manifest {
28
28
  struct collection {
29
29
  std::uint64_t uid;
30
30
  std::string name;
31
- std::uint32_t max_expiry{ 0 };
31
+ std::int32_t max_expiry{ 0 };
32
32
  std::optional<bool> history{};
33
33
  };
34
34
 
@@ -41,7 +41,7 @@ struct traits<couchbase::core::topology::collections_manifest> {
41
41
  collection.uid = std::stoull(c.at("uid").get_string(), nullptr, 16);
42
42
  collection.name = c.at("name").get_string();
43
43
  if (const auto* max_ttl = c.find("maxTTL"); max_ttl != nullptr) {
44
- collection.max_expiry = max_ttl->template as<std::uint32_t>();
44
+ collection.max_expiry = max_ttl->template as<std::int32_t>();
45
45
  }
46
46
  if (const auto* history = c.find("history"); history != nullptr) {
47
47
  collection.history = history->template as<std::optional<bool>>();
@@ -242,6 +242,7 @@ struct exp_delay {
242
242
  std::chrono::nanoseconds timeout;
243
243
  mutable std::uint32_t retries;
244
244
  mutable std::optional<std::chrono::time_point<std::chrono::steady_clock>> end_time;
245
+ std::size_t max_retries{ 100 };
245
246
 
246
247
  template<typename R1, typename P1, typename R2, typename P2, typename R3, typename P3>
247
248
  exp_delay(std::chrono::duration<R1, P1> initial, std::chrono::duration<R2, P2> max, std::chrono::duration<R3, P3> limit)
@@ -255,6 +256,9 @@ struct exp_delay {
255
256
  void operator()() const
256
257
  {
257
258
  auto now = std::chrono::steady_clock::now();
259
+ if (retries >= max_retries) {
260
+ throw retry_operation_retries_exhausted("retries exhausted");
261
+ }
258
262
  if (!end_time) {
259
263
  end_time = std::chrono::steady_clock::now() + timeout;
260
264
  return;
@@ -0,0 +1,23 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-2021 Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ namespace couchbase::core
21
+ {
22
+ enum class vector_query_combination { combination_and, combination_or };
23
+ } // namespace couchbase::core
@@ -19,6 +19,7 @@
19
19
 
20
20
  #include <couchbase/collection.hxx>
21
21
  #include <couchbase/collection_manager.hxx>
22
+ #include <couchbase/ping_options.hxx>
22
23
  #include <couchbase/scope.hxx>
23
24
 
24
25
  #include <memory>
@@ -74,6 +75,34 @@ class bucket
74
75
  */
75
76
  [[nodiscard]] auto scope(std::string_view scope_name) const -> scope;
76
77
 
78
+ /**
79
+ * Performs application-level ping requests against services in the Couchbase cluster.
80
+ *
81
+ * @note This operation performs active I/O against services and endpoints to assess their health. If you do not
82
+ * wish to performs I/O, consider using @ref diagnostics() instead.
83
+ *
84
+ * @param options custom options to change the default behavior.
85
+ * @param handler the handler that implements @ref ping_handler.
86
+ *
87
+ * @since 1.0.0
88
+ * @committed
89
+ */
90
+ void ping(const ping_options& options, ping_handler&& handler) const;
91
+
92
+ /**
93
+ * Performs application-level ping requests against services in the Couchbase cluster.
94
+ *
95
+ * @note This operation performs active I/O against services and endpoints to assess their health. If you do not
96
+ * wish to performs I/O, consider using @ref diagnostics() instead.
97
+ *
98
+ * @param options custom options to change the default behavior.
99
+ * @return future object that carries result of the operation.
100
+ *
101
+ * @since 1.0.0
102
+ * @committed
103
+ */
104
+ [[nodiscard]] auto ping(const ping_options& options = {}) const -> std::future<ping_result>;
105
+
77
106
  /**
78
107
  * Provides access to the collection management services.
79
108
  *