couchbase 3.4.0 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/couchbase/CMakeLists.txt +10 -3
  4. data/ext/couchbase/cmake/CompilerWarnings.cmake +12 -4
  5. data/ext/couchbase/cmake/Documentation.cmake +4 -3
  6. data/ext/couchbase/cmake/OpenSSL.cmake +52 -7
  7. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
  8. data/ext/couchbase/cmake/VersionInfo.cmake +39 -3
  9. data/ext/couchbase/cmake/test_openssl.cxx +7 -0
  10. data/ext/couchbase/core/cluster_options.hxx +0 -1
  11. data/ext/couchbase/core/config_profile.cxx +23 -1
  12. data/ext/couchbase/core/config_profile.hxx +2 -12
  13. data/ext/couchbase/core/crypto/CMakeLists.txt +5 -1
  14. data/ext/couchbase/core/impl/analytics.cxx +236 -0
  15. data/ext/couchbase/core/impl/cluster.cxx +0 -1
  16. data/ext/couchbase/core/impl/collection_query_index_manager.cxx +3 -3
  17. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
  18. data/ext/couchbase/core/impl/get_all_query_indexes.cxx +3 -3
  19. data/ext/couchbase/core/impl/query.cxx +5 -5
  20. data/ext/couchbase/core/impl/transaction_get_result.cxx +54 -0
  21. data/ext/couchbase/core/io/dns_client.cxx +225 -0
  22. data/ext/couchbase/core/io/dns_client.hxx +19 -188
  23. data/ext/couchbase/core/meta/CMakeLists.txt +7 -5
  24. data/ext/couchbase/core/meta/version.cxx +19 -0
  25. data/ext/couchbase/core/operations/document_search.cxx +5 -2
  26. data/ext/couchbase/core/operations/document_search.hxx +0 -1
  27. data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
  28. data/ext/couchbase/core/transactions/atr_cleanup_entry.cxx +1 -0
  29. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +65 -31
  30. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +44 -23
  31. data/ext/couchbase/core/transactions/forward_compat.hxx +2 -2
  32. data/ext/couchbase/core/transactions/internal/transaction_context.hxx +13 -13
  33. data/ext/couchbase/core/transactions/internal/transaction_fields.hxx +1 -0
  34. data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
  35. data/ext/couchbase/core/transactions/staged_mutation.cxx +1 -1
  36. data/ext/couchbase/core/transactions/staged_mutation.hxx +12 -2
  37. data/ext/couchbase/core/transactions/transaction_context.cxx +9 -11
  38. data/ext/couchbase/core/transactions/transaction_get_result.cxx +41 -31
  39. data/ext/couchbase/core/transactions/transaction_get_result.hxx +7 -3
  40. data/ext/couchbase/core/transactions/transaction_links.hxx +13 -1
  41. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
  42. data/ext/couchbase/core/transactions/waitable_op_list.hxx +1 -0
  43. data/ext/couchbase/core/utils/connection_string.cxx +10 -3
  44. data/ext/couchbase/core/utils/connection_string.hxx +3 -3
  45. data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
  46. data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
  47. data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
  48. data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
  49. data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
  50. data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
  51. data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
  52. data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
  53. data/ext/couchbase/couchbase/cluster.hxx +35 -2
  54. data/ext/couchbase/couchbase/cluster_options.hxx +10 -10
  55. data/ext/couchbase/couchbase/collection.hxx +22 -17
  56. data/ext/couchbase/couchbase/collection_query_index_manager.hxx +1 -1
  57. data/ext/couchbase/couchbase/common_options.hxx +1 -1
  58. data/ext/couchbase/couchbase/configuration_profile.hxx +1 -1
  59. data/ext/couchbase/couchbase/configuration_profiles_registry.hxx +0 -1
  60. data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +1 -1
  61. data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +1 -1
  62. data/ext/couchbase/couchbase/drop_query_index_options.hxx +1 -1
  63. data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
  64. data/ext/couchbase/couchbase/fmt/cas.hxx +12 -0
  65. data/ext/couchbase/couchbase/fmt/durability_level.hxx +6 -0
  66. data/ext/couchbase/couchbase/fmt/key_value_extended_error_info.hxx +6 -0
  67. data/ext/couchbase/couchbase/fmt/key_value_status_code.hxx +6 -0
  68. data/ext/couchbase/couchbase/fmt/mutation_token.hxx +6 -0
  69. data/ext/couchbase/couchbase/fmt/query_scan_consistency.hxx +6 -0
  70. data/ext/couchbase/couchbase/fmt/query_status.hxx +6 -0
  71. data/ext/couchbase/couchbase/fmt/retry_reason.hxx +6 -0
  72. data/ext/couchbase/couchbase/fmt/tls_verify_mode.hxx +6 -0
  73. data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +5 -4
  74. data/ext/couchbase/couchbase/query_index_manager.hxx +4 -2
  75. data/ext/couchbase/couchbase/query_options.hxx +0 -1
  76. data/ext/couchbase/couchbase/scope.hxx +34 -1
  77. data/ext/couchbase/couchbase/subdoc/array_add_unique.hxx +2 -0
  78. data/ext/couchbase/couchbase/subdoc/array_append.hxx +2 -0
  79. data/ext/couchbase/couchbase/subdoc/array_insert.hxx +2 -0
  80. data/ext/couchbase/couchbase/subdoc/array_prepend.hxx +2 -0
  81. data/ext/couchbase/couchbase/subdoc/count.hxx +2 -0
  82. data/ext/couchbase/couchbase/subdoc/counter.hxx +2 -0
  83. data/ext/couchbase/couchbase/subdoc/exists.hxx +2 -0
  84. data/ext/couchbase/couchbase/subdoc/get.hxx +2 -0
  85. data/ext/couchbase/couchbase/subdoc/insert.hxx +2 -0
  86. data/ext/couchbase/couchbase/subdoc/remove.hxx +2 -0
  87. data/ext/couchbase/couchbase/subdoc/replace.hxx +3 -1
  88. data/ext/couchbase/couchbase/subdoc/upsert.hxx +2 -0
  89. data/ext/couchbase/couchbase/transaction_op_error_context.hxx +4 -4
  90. data/ext/couchbase/couchbase/transactions/attempt_context.hxx +1 -1
  91. data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +36 -51
  92. data/ext/couchbase/couchbase/transactions/transactions_config.hxx +1 -1
  93. data/ext/couchbase/test/CMakeLists.txt +3 -2
  94. data/ext/couchbase/test/test_helper.hxx +1 -1
  95. data/ext/couchbase/test/test_integration_analytics.cxx +289 -13
  96. data/ext/couchbase/test/test_integration_crud.cxx +8 -1
  97. data/ext/couchbase/test/test_integration_examples.cxx +182 -0
  98. data/ext/couchbase/test/test_integration_management.cxx +15 -3
  99. data/ext/couchbase/test/test_integration_search.cxx +601 -0
  100. data/ext/couchbase/test/test_transaction_transaction_simple.cxx +73 -0
  101. data/ext/couchbase/test/test_unit_config_profiles.cxx +12 -12
  102. data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
  103. data/ext/couchbase/test/test_unit_transaction_utils.cxx +76 -19
  104. data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
  105. data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
  106. data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
  107. data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
  108. data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
  109. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
  110. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
  111. data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
  112. data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
  113. data/ext/couchbase/third_party/snappy/snappy.h +19 -4
  114. data/ext/couchbase.cxx +506 -26
  115. data/ext/extconf.rb +2 -1
  116. data/ext/revisions.rb +3 -2
  117. data/lib/couchbase/binary_collection.rb +4 -4
  118. data/lib/couchbase/cluster.rb +13 -9
  119. data/lib/couchbase/cluster_registry.rb +7 -2
  120. data/lib/couchbase/collection.rb +5 -0
  121. data/lib/couchbase/configuration.rb +3 -4
  122. data/lib/couchbase/errors.rb +10 -0
  123. data/lib/couchbase/management/collection_query_index_manager.rb +183 -0
  124. data/lib/couchbase/management/query_index_manager.rb +35 -3
  125. data/lib/couchbase/management.rb +1 -0
  126. data/lib/couchbase/options.rb +87 -5
  127. data/lib/couchbase/search_options.rb +158 -240
  128. data/lib/couchbase/version.rb +1 -1
  129. metadata +21 -6
  130. data/ext/couchbase/core/CMakeLists.txt +0 -0
@@ -51,18 +51,22 @@ using opt_bucket_name = opt_must<one<'/'>, bucket_name>;
51
51
  using opt_params = opt_must<one<'?'>, list_must<param, one<'&'>>>;
52
52
  using opt_nodes = seq<list_must<node, one<',', ';'>>, opt_bucket_name>;
53
53
 
54
- using grammar = must<seq<uri::scheme, one<':'>, uri::dslash, opt_nodes, opt_params, tao::pegtl::eof>>;
54
+ struct scheme : seq<uri::scheme, one<':'>, uri::dslash> {
55
+ };
56
+ using opt_scheme = opt<scheme>;
57
+
58
+ using grammar = must<seq<opt_scheme, opt_nodes, opt_params, tao::pegtl::eof>>;
55
59
 
56
60
  template<typename Rule>
57
61
  struct action {
58
62
  };
59
63
 
60
64
  template<>
61
- struct action<uri::scheme> {
65
+ struct action<scheme> {
62
66
  template<typename ActionInput>
63
67
  static void apply(const ActionInput& in, connection_string& cs, connection_string::node& /* cur_node */)
64
68
  {
65
- cs.scheme = in.string();
69
+ cs.scheme = in.string().substr(0, in.string().rfind(':'));
66
70
  if (cs.scheme == "couchbase") {
67
71
  cs.default_port = 11210;
68
72
  cs.default_mode = connection_string::bootstrap_mode::gcccp;
@@ -79,6 +83,9 @@ struct action<uri::scheme> {
79
83
  cs.default_port = 18091;
80
84
  cs.default_mode = connection_string::bootstrap_mode::http;
81
85
  cs.tls = true;
86
+ } else {
87
+ cs.default_mode = connection_string::bootstrap_mode::unspecified;
88
+ cs.default_port = 0;
82
89
  }
83
90
  }
84
91
  };
@@ -57,7 +57,7 @@ struct connection_string {
57
57
  }
58
58
  };
59
59
 
60
- std::string scheme{};
60
+ std::string scheme{ "couchbase" };
61
61
  bool tls{ false };
62
62
  std::map<std::string, std::string> params{};
63
63
  cluster_options options{};
@@ -65,8 +65,8 @@ struct connection_string {
65
65
  std::vector<node> bootstrap_nodes{};
66
66
 
67
67
  std::optional<std::string> default_bucket_name{};
68
- bootstrap_mode default_mode{ bootstrap_mode::unspecified };
69
- std::uint16_t default_port{ 0 };
68
+ bootstrap_mode default_mode{ connection_string::bootstrap_mode::gcccp };
69
+ std::uint16_t default_port{ 11210 };
70
70
 
71
71
  std::optional<std::string> error{};
72
72
  };
@@ -0,0 +1,143 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ #include <couchbase/error_context.hxx>
21
+
22
+ #include <cstdint>
23
+ #include <optional>
24
+
25
+ namespace couchbase
26
+ {
27
+ /**
28
+ * The error context returned with Query operations.
29
+ *
30
+ * @since 1.0.0
31
+ * @committed
32
+ */
33
+ class analytics_error_context : public error_context
34
+ {
35
+ public:
36
+ /**
37
+ * Creates empty error context
38
+ *
39
+ * @since 1.0.0
40
+ * @committed
41
+ */
42
+ analytics_error_context() = default;
43
+
44
+ analytics_error_context(std::error_code ec,
45
+ std::optional<std::string> last_dispatched_to,
46
+ std::optional<std::string> last_dispatched_from,
47
+ std::size_t retry_attempts,
48
+ std::set<retry_reason> retry_reasons,
49
+ std::uint64_t first_error_code,
50
+ std::string first_error_message,
51
+ std::string client_context_id,
52
+ std::string statement,
53
+ std::optional<std::string> parameters,
54
+ std::string method,
55
+ std::string path,
56
+ std::uint32_t http_status,
57
+ std::string http_body,
58
+ std::string hostname,
59
+ std::uint16_t port)
60
+ : error_context{ ec, std::move(last_dispatched_to), std::move(last_dispatched_from), retry_attempts, std::move(retry_reasons) }
61
+ , first_error_code_{ first_error_code }
62
+ , first_error_message_{ std::move(first_error_message) }
63
+ , client_context_id_{ std::move(client_context_id) }
64
+ , statement_{ std::move(statement) }
65
+ , parameters_{ std::move(parameters) }
66
+ , method_{ std::move(method) }
67
+ , path_{ std::move(path) }
68
+ , http_status_{ http_status }
69
+ , http_body_{ std::move(http_body) }
70
+ , hostname_{ std::move(hostname) }
71
+ , port_{ port }
72
+ {
73
+ }
74
+
75
+ [[nodiscard]] auto first_error_code() const -> std::uint64_t
76
+ {
77
+ return first_error_code_;
78
+ }
79
+
80
+ [[nodiscard]] auto first_error_message() const -> const std::string&
81
+ {
82
+ return first_error_message_;
83
+ }
84
+
85
+ [[nodiscard]] auto client_context_id() const -> const std::string&
86
+ {
87
+ return client_context_id_;
88
+ }
89
+
90
+ [[nodiscard]] auto statement() const -> const std::string&
91
+ {
92
+ return statement_;
93
+ }
94
+
95
+ [[nodiscard]] auto parameters() const -> const std::optional<std::string>&
96
+ {
97
+ return parameters_;
98
+ }
99
+
100
+ [[nodiscard]] auto method() const -> const std::string&
101
+ {
102
+ return method_;
103
+ }
104
+
105
+ [[nodiscard]] auto path() const -> const std::string&
106
+ {
107
+ return path_;
108
+ }
109
+
110
+ [[nodiscard]] auto http_status() const -> std::uint32_t
111
+ {
112
+ return http_status_;
113
+ }
114
+
115
+ [[nodiscard]] auto http_body() const -> const std::string&
116
+ {
117
+ return http_body_;
118
+ }
119
+
120
+ [[nodiscard]] auto hostname() const -> const std::string&
121
+ {
122
+ return hostname_;
123
+ }
124
+
125
+ [[nodiscard]] auto port() const -> std::uint16_t
126
+ {
127
+ return port_;
128
+ }
129
+
130
+ private:
131
+ std::uint64_t first_error_code_{};
132
+ std::string first_error_message_{};
133
+ std::string client_context_id_{};
134
+ std::string statement_{};
135
+ std::optional<std::string> parameters_{};
136
+ std::string method_{};
137
+ std::string path_{};
138
+ std::uint32_t http_status_{};
139
+ std::string http_body_{};
140
+ std::string hostname_{};
141
+ std::uint16_t port_{};
142
+ };
143
+ } // namespace couchbase
@@ -0,0 +1,155 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ #include <couchbase/analytics_metrics.hxx>
21
+ #include <couchbase/analytics_status.hxx>
22
+ #include <couchbase/analytics_warning.hxx>
23
+ #include <couchbase/codec/json_transcoder.hxx>
24
+
25
+ #include <cinttypes>
26
+ #include <optional>
27
+ #include <vector>
28
+
29
+ namespace couchbase
30
+ {
31
+
32
+ /**
33
+ * Stores any non-rows results related to the execution of a particular Analytics query.
34
+ *
35
+ * @since 1.0.0
36
+ * @committed
37
+ */
38
+ class analytics_meta_data
39
+ {
40
+ public:
41
+ /**
42
+ * @since 1.0.0
43
+ * @internal
44
+ */
45
+ analytics_meta_data() = default;
46
+
47
+ /**
48
+ * @since 1.0.0
49
+ * @volatile
50
+ */
51
+ analytics_meta_data(std::string request_id,
52
+ std::string client_context_id,
53
+ analytics_status status,
54
+ std::vector<analytics_warning> warnings,
55
+ analytics_metrics metrics,
56
+ std::optional<codec::binary> signature)
57
+ : request_id_{ std::move(request_id) }
58
+ , client_context_id_{ std::move(client_context_id) }
59
+ , status_{ status }
60
+ , warnings_{ std::move(warnings) }
61
+ , metrics_{ std::move(metrics) }
62
+ , signature_{ std::move(signature) }
63
+ {
64
+ }
65
+
66
+ /**
67
+ * Returns the request identifier string of the query request
68
+ *
69
+ * @return The request identifier string
70
+ *
71
+ * @since 1.0.0
72
+ * @committed
73
+ */
74
+ [[nodiscard]] auto request_id() const -> const std::string&
75
+ {
76
+ return request_id_;
77
+ }
78
+
79
+ /**
80
+ * Returns the client context identifier string set on the query request.
81
+ *
82
+ * @return client context identifier
83
+ *
84
+ * @since 1.0.0
85
+ * @committed
86
+ */
87
+ [[nodiscard]] auto client_context_id() const -> const std::string&
88
+ {
89
+ return client_context_id_;
90
+ }
91
+
92
+ /**
93
+ * Returns the raw query execution status as returned by the query engine
94
+ *
95
+ * @return query execution status
96
+ *
97
+ * @since 1.0.0
98
+ * @committed
99
+ */
100
+ [[nodiscard]] auto status() const -> analytics_status
101
+ {
102
+ return status_;
103
+ }
104
+
105
+ /**
106
+ * Returns any warnings returned by the analytics engine.
107
+ *
108
+ * It returns an empty vector if no warnings were returned.
109
+ *
110
+ * @return vector of the reported warnings.
111
+ *
112
+ * @since 1.0.0
113
+ * @committed
114
+ */
115
+ [[nodiscard]] auto warnings() const -> const std::vector<analytics_warning>&
116
+ {
117
+ return warnings_;
118
+ }
119
+
120
+ /**
121
+ * Returns the {@link analytics_metrics} as returned by the analytics engine if enabled.
122
+ *
123
+ * @return metrics
124
+ *
125
+ * @since 1.0.0
126
+ * @committed
127
+ */
128
+ [[nodiscard]] auto metrics() const -> const analytics_metrics&
129
+ {
130
+ return metrics_;
131
+ }
132
+
133
+ /**
134
+ * Returns the signature as returned by the analytics engine.
135
+ *
136
+ * @return optional byte string containing JSON encoded signature
137
+ *
138
+ * @since 1.0.0
139
+ * @committed
140
+ */
141
+ [[nodiscard]] auto signature() const -> const std::optional<codec::binary>&
142
+ {
143
+ return signature_;
144
+ }
145
+
146
+ private:
147
+ std::string request_id_{};
148
+ std::string client_context_id_{};
149
+ analytics_status status_{};
150
+ std::vector<analytics_warning> warnings_{};
151
+ analytics_metrics metrics_{};
152
+ std::optional<codec::binary> signature_{};
153
+ };
154
+
155
+ } // namespace couchbase
@@ -0,0 +1,163 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ #include <chrono>
21
+ #include <cinttypes>
22
+
23
+ namespace couchbase
24
+ {
25
+
26
+ /**
27
+ * Analytics Metrics contains the query result metrics containing counts and timings
28
+ *
29
+ * @since 1.0.0
30
+ * @committed
31
+ */
32
+ class analytics_metrics
33
+ {
34
+ public:
35
+ /**
36
+ * @since 1.0.0
37
+ * @internal
38
+ */
39
+ analytics_metrics() = default;
40
+
41
+ /**
42
+ * @since 1.0.0
43
+ * @volatile
44
+ */
45
+ analytics_metrics(std::chrono::nanoseconds elapsed_time,
46
+ std::chrono::nanoseconds execution_time,
47
+ std::uint64_t result_count,
48
+ std::uint64_t result_size,
49
+ std::uint64_t processed_objects,
50
+ std::uint64_t error_count,
51
+ std::uint64_t warning_count)
52
+ : elapsed_time_{ elapsed_time }
53
+ , execution_time_{ execution_time }
54
+ , result_count_{ result_count }
55
+ , result_size_{ result_size }
56
+ , processed_objects_{ processed_objects }
57
+ , error_count_{ error_count }
58
+ , warning_count_{ warning_count }
59
+ {
60
+ }
61
+
62
+ /**
63
+ * The total time taken for the request, that is the time from when the request was received until the results were returned.
64
+ *
65
+ * @return total time duration
66
+ *
67
+ * @since 1.0.0
68
+ * @committed
69
+ */
70
+ [[nodiscard]] auto elapsed_time() const -> std::chrono::nanoseconds
71
+ {
72
+ return elapsed_time_;
73
+ }
74
+
75
+ /**
76
+ * The time taken for the execution of the request, that is the time from when query execution started until the results were returned.
77
+ *
78
+ * @return the execution time duration
79
+ *
80
+ * @since 1.0.0
81
+ * @committed
82
+ */
83
+ [[nodiscard]] auto execution_time() const -> std::chrono::nanoseconds
84
+ {
85
+ return execution_time_;
86
+ }
87
+
88
+ /**
89
+ * The total number of objects in the results.
90
+ *
91
+ * @return number of results
92
+ *
93
+ * @since 1.0.0
94
+ * @committed
95
+ */
96
+ [[nodiscard]] auto result_count() const -> std::uint64_t
97
+ {
98
+ return result_count_;
99
+ }
100
+
101
+ /**
102
+ * The total number of bytes in the results
103
+ *
104
+ * @return number of bytes
105
+ *
106
+ * @since 1.0.0
107
+ * @committed
108
+ */
109
+ [[nodiscard]] auto result_size() const -> std::uint64_t
110
+ {
111
+ return result_size_;
112
+ }
113
+
114
+ /**
115
+ * The number of processed objects for the request.
116
+ *
117
+ * @return number of objects
118
+ *
119
+ * @since 1.0.0
120
+ * @committed
121
+ */
122
+ [[nodiscard]] auto processed_objects() const -> std::uint64_t
123
+ {
124
+ return processed_objects_;
125
+ }
126
+
127
+ /**
128
+ * The number of errors that occurred during the request
129
+ *
130
+ * @return number of errors
131
+ *
132
+ * @since 1.0.0
133
+ * @committed
134
+ */
135
+ [[nodiscard]] auto error_count() const -> std::uint64_t
136
+ {
137
+ return error_count_;
138
+ }
139
+
140
+ /**
141
+ * The number of warnings that occurred during the request.
142
+ *
143
+ * @return number of warnings
144
+ *
145
+ * @since 1.0.0
146
+ * @committed
147
+ */
148
+ [[nodiscard]] auto warning_count() const -> std::uint64_t
149
+ {
150
+ return warning_count_;
151
+ }
152
+
153
+ private:
154
+ std::chrono::nanoseconds elapsed_time_{};
155
+ std::chrono::nanoseconds execution_time_{};
156
+ std::uint64_t result_count_{};
157
+ std::uint64_t result_size_{};
158
+ std::uint64_t processed_objects_{};
159
+ std::uint64_t error_count_{};
160
+ std::uint64_t warning_count_{};
161
+ };
162
+
163
+ } // namespace couchbase