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.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/CMakeLists.txt +3 -1
  4. data/ext/build_version.hxx.in +1 -1
  5. data/ext/cmake/Testing.cmake +1 -0
  6. data/ext/cmake/ThirdPartyDependencies.cmake +6 -0
  7. data/ext/cmake/VersionInfo.cmake +3 -0
  8. data/ext/couchbase/bucket.hxx +47 -28
  9. data/ext/couchbase/cbsasl/client.h +1 -1
  10. data/ext/couchbase/cbsasl/context.cc +1 -1
  11. data/ext/couchbase/cbsasl/context.h +3 -3
  12. data/ext/couchbase/cbsasl/mechanism.cc +5 -8
  13. data/ext/couchbase/cbsasl/mechanism.h +1 -4
  14. data/ext/couchbase/cbsasl/plain/plain.cc +1 -1
  15. data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +30 -36
  16. data/ext/couchbase/cluster.hxx +40 -22
  17. data/ext/couchbase/cluster_options.hxx +7 -1
  18. data/ext/couchbase/configuration.hxx +37 -16
  19. data/ext/couchbase/couchbase.cxx +1145 -291
  20. data/ext/couchbase/error_map.hxx +1 -1
  21. data/ext/couchbase/errors.hxx +25 -17
  22. data/ext/couchbase/io/dns_client.hxx +3 -3
  23. data/ext/couchbase/io/dns_codec.hxx +4 -5
  24. data/ext/couchbase/io/dns_config.hxx +5 -6
  25. data/ext/couchbase/io/dns_message.hxx +3 -3
  26. data/ext/couchbase/io/http_command.hxx +70 -35
  27. data/ext/couchbase/io/http_session.hxx +4 -3
  28. data/ext/couchbase/io/http_session_manager.hxx +28 -19
  29. data/ext/couchbase/io/mcbp_command.hxx +51 -19
  30. data/ext/couchbase/io/mcbp_context.hxx +1 -1
  31. data/ext/couchbase/io/mcbp_parser.hxx +4 -4
  32. data/ext/couchbase/io/mcbp_session.hxx +91 -101
  33. data/ext/couchbase/io/query_cache.hxx +2 -2
  34. data/ext/couchbase/io/retry_orchestrator.hxx +2 -4
  35. data/ext/couchbase/io/retry_reason.hxx +2 -2
  36. data/ext/couchbase/io/retry_strategy.hxx +1 -6
  37. data/ext/couchbase/io/streams.hxx +7 -7
  38. data/ext/couchbase/metrics/logging_meter.hxx +228 -0
  39. data/ext/couchbase/metrics/logging_meter_options.hxx +28 -0
  40. data/ext/couchbase/metrics/meter.hxx +49 -0
  41. data/ext/couchbase/metrics/noop_meter.hxx +43 -0
  42. data/ext/couchbase/operations.hxx +4 -0
  43. data/ext/couchbase/operations/analytics_dataset_create.hxx +16 -12
  44. data/ext/couchbase/operations/analytics_dataset_drop.hxx +11 -11
  45. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +6 -6
  46. data/ext/couchbase/operations/analytics_dataverse_create.hxx +10 -11
  47. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +10 -11
  48. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +9 -11
  49. data/ext/couchbase/operations/analytics_index_create.hxx +14 -13
  50. data/ext/couchbase/operations/analytics_index_drop.hxx +18 -12
  51. data/ext/couchbase/operations/analytics_index_get_all.hxx +8 -6
  52. data/ext/couchbase/operations/analytics_link.hxx +39 -0
  53. data/ext/couchbase/operations/analytics_link_azure_blob_external.hxx +145 -0
  54. data/ext/couchbase/operations/analytics_link_connect.hxx +14 -12
  55. data/ext/couchbase/operations/analytics_link_couchbase_remote.hxx +220 -0
  56. data/ext/couchbase/operations/analytics_link_create.hxx +128 -0
  57. data/ext/couchbase/operations/analytics_link_disconnect.hxx +11 -12
  58. data/ext/couchbase/operations/analytics_link_drop.hxx +130 -0
  59. data/ext/couchbase/operations/analytics_link_get_all.hxx +160 -0
  60. data/ext/couchbase/operations/analytics_link_replace.hxx +128 -0
  61. data/ext/couchbase/operations/analytics_link_s3_external.hxx +122 -0
  62. data/ext/couchbase/operations/bucket_create.hxx +8 -8
  63. data/ext/couchbase/operations/bucket_drop.hxx +5 -5
  64. data/ext/couchbase/operations/bucket_flush.hxx +5 -5
  65. data/ext/couchbase/operations/bucket_get.hxx +7 -7
  66. data/ext/couchbase/operations/bucket_get_all.hxx +7 -5
  67. data/ext/couchbase/operations/bucket_settings.hxx +40 -49
  68. data/ext/couchbase/operations/bucket_update.hxx +8 -8
  69. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +7 -7
  70. data/ext/couchbase/operations/collection_create.hxx +11 -11
  71. data/ext/couchbase/operations/collection_drop.hxx +12 -10
  72. data/ext/couchbase/operations/collections_manifest_get.hxx +3 -3
  73. data/ext/couchbase/operations/design_document.hxx +2 -2
  74. data/ext/couchbase/operations/document_analytics.hxx +29 -36
  75. data/ext/couchbase/operations/document_append.hxx +3 -3
  76. data/ext/couchbase/operations/document_decrement.hxx +3 -3
  77. data/ext/couchbase/operations/document_exists.hxx +2 -2
  78. data/ext/couchbase/operations/document_get.hxx +3 -3
  79. data/ext/couchbase/operations/document_get_and_lock.hxx +5 -3
  80. data/ext/couchbase/operations/document_get_and_touch.hxx +5 -3
  81. data/ext/couchbase/operations/document_get_projected.hxx +10 -11
  82. data/ext/couchbase/operations/document_increment.hxx +3 -3
  83. data/ext/couchbase/operations/document_insert.hxx +3 -3
  84. data/ext/couchbase/operations/document_lookup_in.hxx +12 -18
  85. data/ext/couchbase/operations/document_mutate_in.hxx +13 -18
  86. data/ext/couchbase/operations/document_prepend.hxx +3 -3
  87. data/ext/couchbase/operations/document_query.hxx +39 -41
  88. data/ext/couchbase/operations/document_remove.hxx +3 -3
  89. data/ext/couchbase/operations/document_replace.hxx +3 -3
  90. data/ext/couchbase/operations/document_search.hxx +56 -61
  91. data/ext/couchbase/operations/document_touch.hxx +3 -3
  92. data/ext/couchbase/operations/document_unlock.hxx +3 -3
  93. data/ext/couchbase/operations/document_upsert.hxx +3 -3
  94. data/ext/couchbase/operations/document_view.hxx +23 -23
  95. data/ext/couchbase/operations/group_drop.hxx +5 -5
  96. data/ext/couchbase/operations/group_get.hxx +7 -7
  97. data/ext/couchbase/operations/group_get_all.hxx +6 -6
  98. data/ext/couchbase/operations/group_upsert.hxx +11 -11
  99. data/ext/couchbase/operations/http_noop.hxx +6 -6
  100. data/ext/couchbase/operations/mcbp_noop.hxx +3 -3
  101. data/ext/couchbase/operations/query_index_build_deferred.hxx +6 -6
  102. data/ext/couchbase/operations/query_index_create.hxx +10 -8
  103. data/ext/couchbase/operations/query_index_drop.hxx +8 -8
  104. data/ext/couchbase/operations/query_index_get_all.hxx +43 -39
  105. data/ext/couchbase/operations/rbac.hxx +40 -63
  106. data/ext/couchbase/operations/role_get_all.hxx +6 -6
  107. data/ext/couchbase/operations/scope_create.hxx +10 -10
  108. data/ext/couchbase/operations/scope_drop.hxx +9 -9
  109. data/ext/couchbase/operations/scope_get_all.hxx +8 -8
  110. data/ext/couchbase/operations/search_get_stats.hxx +5 -3
  111. data/ext/couchbase/operations/search_index.hxx +6 -15
  112. data/ext/couchbase/operations/search_index_analyze_document.hxx +11 -11
  113. data/ext/couchbase/operations/search_index_control_ingest.hxx +9 -9
  114. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +9 -9
  115. data/ext/couchbase/operations/search_index_control_query.hxx +9 -9
  116. data/ext/couchbase/operations/search_index_drop.hxx +11 -9
  117. data/ext/couchbase/operations/search_index_get.hxx +11 -9
  118. data/ext/couchbase/operations/search_index_get_all.hxx +11 -11
  119. data/ext/couchbase/operations/search_index_get_documents_count.hxx +10 -10
  120. data/ext/couchbase/operations/search_index_get_stats.hxx +10 -8
  121. data/ext/couchbase/operations/search_index_upsert.hxx +12 -10
  122. data/ext/couchbase/operations/user_drop.hxx +5 -5
  123. data/ext/couchbase/operations/user_get.hxx +7 -7
  124. data/ext/couchbase/operations/user_get_all.hxx +6 -6
  125. data/ext/couchbase/operations/user_upsert.hxx +9 -9
  126. data/ext/couchbase/operations/view_index_drop.hxx +10 -10
  127. data/ext/couchbase/operations/view_index_get.hxx +13 -15
  128. data/ext/couchbase/operations/view_index_get_all.hxx +17 -20
  129. data/ext/couchbase/operations/view_index_upsert.hxx +9 -7
  130. data/ext/couchbase/origin.hxx +14 -10
  131. data/ext/couchbase/platform/backtrace.c +1 -1
  132. data/ext/couchbase/platform/base64.cc +5 -5
  133. data/ext/couchbase/platform/base64.h +2 -5
  134. data/ext/couchbase/protocol/client_opcode.hxx +7 -4
  135. data/ext/couchbase/protocol/client_request.hxx +2 -2
  136. data/ext/couchbase/protocol/client_response.hxx +41 -16
  137. data/ext/couchbase/protocol/cmd_append.hxx +17 -16
  138. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +4 -4
  139. data/ext/couchbase/protocol/cmd_decrement.hxx +10 -11
  140. data/ext/couchbase/protocol/cmd_exists.hxx +12 -15
  141. data/ext/couchbase/protocol/cmd_get.hxx +11 -14
  142. data/ext/couchbase/protocol/cmd_get_and_lock.hxx +10 -12
  143. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +10 -12
  144. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +13 -18
  145. data/ext/couchbase/protocol/cmd_get_collection_id.hxx +12 -15
  146. data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +12 -16
  147. data/ext/couchbase/protocol/cmd_get_error_map.hxx +14 -17
  148. data/ext/couchbase/protocol/cmd_hello.hxx +8 -10
  149. data/ext/couchbase/protocol/cmd_increment.hxx +9 -10
  150. data/ext/couchbase/protocol/cmd_insert.hxx +9 -9
  151. data/ext/couchbase/protocol/cmd_lookup_in.hxx +12 -13
  152. data/ext/couchbase/protocol/cmd_mutate_in.hxx +11 -11
  153. data/ext/couchbase/protocol/cmd_noop.hxx +16 -20
  154. data/ext/couchbase/protocol/cmd_prepend.hxx +9 -10
  155. data/ext/couchbase/protocol/cmd_remove.hxx +10 -13
  156. data/ext/couchbase/protocol/cmd_replace.hxx +7 -7
  157. data/ext/couchbase/protocol/cmd_sasl_auth.hxx +8 -10
  158. data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +10 -15
  159. data/ext/couchbase/protocol/cmd_sasl_step.hxx +10 -12
  160. data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -18
  161. data/ext/couchbase/protocol/cmd_touch.hxx +8 -11
  162. data/ext/couchbase/protocol/cmd_unlock.hxx +10 -14
  163. data/ext/couchbase/protocol/cmd_upsert.hxx +8 -8
  164. data/ext/couchbase/protocol/datatype.hxx +3 -3
  165. data/ext/couchbase/protocol/durability_level.hxx +2 -2
  166. data/ext/couchbase/protocol/frame_info_id.hxx +4 -4
  167. data/ext/couchbase/protocol/hello_feature.hxx +2 -2
  168. data/ext/couchbase/protocol/magic.hxx +2 -2
  169. data/ext/couchbase/protocol/server_opcode.hxx +2 -2
  170. data/ext/couchbase/protocol/server_request.hxx +1 -1
  171. data/ext/couchbase/protocol/status.hxx +4 -7
  172. data/ext/couchbase/protocol/unsigned_leb128.h +5 -20
  173. data/ext/couchbase/service_type.hxx +4 -4
  174. data/ext/couchbase/tracing/constants.hxx +261 -0
  175. data/ext/couchbase/tracing/noop_tracer.hxx +50 -0
  176. data/ext/couchbase/tracing/request_tracer.hxx +77 -0
  177. data/ext/couchbase/tracing/threshold_logging_options.hxx +64 -0
  178. data/ext/couchbase/tracing/threshold_logging_tracer.hxx +366 -0
  179. data/ext/couchbase/utils/byteswap.hxx +1 -1
  180. data/ext/couchbase/utils/connection_string.hxx +21 -1
  181. data/ext/couchbase/utils/name_codec.hxx +41 -0
  182. data/ext/couchbase/utils/url_codec.hxx +236 -0
  183. data/ext/couchbase/version.hxx +1 -1
  184. data/ext/test/CMakeLists.txt +1 -0
  185. data/ext/test/test_native_trivial_query.cxx +60 -0
  186. data/ext/third_party/hdr_histogram_c/CMakeLists.txt +84 -0
  187. data/ext/third_party/hdr_histogram_c/COPYING.txt +121 -0
  188. data/ext/third_party/hdr_histogram_c/LICENSE.txt +41 -0
  189. data/ext/third_party/hdr_histogram_c/config.cmake.in +6 -0
  190. data/ext/third_party/hdr_histogram_c/src/CMakeLists.txt +83 -0
  191. data/ext/third_party/hdr_histogram_c/src/hdr_atomic.h +146 -0
  192. data/ext/third_party/hdr_histogram_c/src/hdr_encoding.c +322 -0
  193. data/ext/third_party/hdr_histogram_c/src/hdr_encoding.h +79 -0
  194. data/ext/third_party/hdr_histogram_c/src/hdr_endian.h +116 -0
  195. data/ext/third_party/hdr_histogram_c/src/hdr_histogram.c +1196 -0
  196. data/ext/third_party/hdr_histogram_c/src/hdr_histogram.h +516 -0
  197. data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.c +1290 -0
  198. data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.h +236 -0
  199. data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log_no_op.c +171 -0
  200. data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.c +227 -0
  201. data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.h +109 -0
  202. data/ext/third_party/hdr_histogram_c/src/hdr_malloc.h +19 -0
  203. data/ext/third_party/hdr_histogram_c/src/hdr_tests.h +22 -0
  204. data/ext/third_party/hdr_histogram_c/src/hdr_thread.c +108 -0
  205. data/ext/third_party/hdr_histogram_c/src/hdr_thread.h +55 -0
  206. data/ext/third_party/hdr_histogram_c/src/hdr_time.c +98 -0
  207. data/ext/third_party/hdr_histogram_c/src/hdr_time.h +49 -0
  208. data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.c +143 -0
  209. data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.h +51 -0
  210. data/lib/couchbase/cluster.rb +1 -0
  211. data/lib/couchbase/errors.rb +3 -0
  212. data/lib/couchbase/libcouchbase.bundle +0 -0
  213. data/lib/couchbase/management/analytics_index_manager.rb +920 -226
  214. data/lib/couchbase/management/bucket_manager.rb +207 -69
  215. data/lib/couchbase/management/collection_manager.rb +173 -61
  216. data/lib/couchbase/management/query_index_manager.rb +357 -169
  217. data/lib/couchbase/options.rb +75 -3
  218. data/lib/couchbase/scope.rb +102 -0
  219. data/lib/couchbase/utils/time.rb +4 -0
  220. data/lib/couchbase/version.rb +6 -6
  221. metadata +48 -5
@@ -19,8 +19,8 @@
19
19
 
20
20
  #include <protocol/unsigned_leb128.h>
21
21
 
22
- #include <protocol/client_opcode.hxx>
23
22
  #include <document_id.hxx>
23
+ #include <protocol/client_opcode.hxx>
24
24
 
25
25
  namespace couchbase::protocol
26
26
  {
@@ -31,7 +31,7 @@ class lookup_in_response_body
31
31
  static const inline client_opcode opcode = client_opcode::subdoc_multi_lookup;
32
32
 
33
33
  struct lookup_in_field {
34
- protocol::status status;
34
+ protocol::status status{};
35
35
  std::string value;
36
36
  };
37
37
 
@@ -39,7 +39,7 @@ class lookup_in_response_body
39
39
  std::vector<lookup_in_field> fields_;
40
40
 
41
41
  public:
42
- std::vector<lookup_in_field>& fields()
42
+ [[nodiscard]] const std::vector<lookup_in_field>& fields() const
43
43
  {
44
44
  return fields_;
45
45
  }
@@ -50,7 +50,7 @@ class lookup_in_response_body
50
50
  std::uint16_t key_size,
51
51
  std::uint8_t extras_size,
52
52
  const std::vector<uint8_t>& body,
53
- const cmd_info&)
53
+ const cmd_info& /* info */)
54
54
  {
55
55
  Expects(header[1] == static_cast<uint8_t>(opcode));
56
56
  if (status == protocol::status::success || status == protocol::status::subdoc_multi_path_failure ||
@@ -65,7 +65,7 @@ class lookup_in_response_body
65
65
  memcpy(&entry_status, body.data() + offset, sizeof(entry_status));
66
66
  entry_status = ntohs(entry_status);
67
67
  Expects(is_valid_status(entry_status));
68
- field.status = static_cast<protocol::status>(entry_status);
68
+ field.status = protocol::status(entry_status);
69
69
  offset += static_cast<offset_type>(sizeof(entry_status));
70
70
 
71
71
  std::uint32_t entry_size = 0;
@@ -156,18 +156,17 @@ class lookup_in_request_body
156
156
  specs_ = specs;
157
157
  }
158
158
 
159
- const std::string& key()
159
+ [[nodiscard]] const std::string& key() const
160
160
  {
161
161
  return key_;
162
162
  }
163
163
 
164
- const std::vector<std::uint8_t>& framing_extras()
164
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
165
165
  {
166
- static std::vector<std::uint8_t> empty;
167
- return empty;
166
+ return empty_buffer;
168
167
  }
169
168
 
170
- const std::vector<std::uint8_t>& extras()
169
+ [[nodiscard]] const std::vector<std::uint8_t>& extras()
171
170
  {
172
171
  if (extras_.empty()) {
173
172
  fill_extention();
@@ -175,7 +174,7 @@ class lookup_in_request_body
175
174
  return extras_;
176
175
  }
177
176
 
178
- const std::vector<std::uint8_t>& value()
177
+ [[nodiscard]] const std::vector<std::uint8_t>& value()
179
178
  {
180
179
  if (value_.empty()) {
181
180
  fill_value();
@@ -183,7 +182,7 @@ class lookup_in_request_body
183
182
  return value_;
184
183
  }
185
184
 
186
- std::size_t size()
185
+ [[nodiscard]] std::size_t size()
187
186
  {
188
187
  if (extras_.empty()) {
189
188
  fill_extention();
@@ -206,7 +205,7 @@ class lookup_in_request_body
206
205
  void fill_value()
207
206
  {
208
207
  size_t value_size = 0;
209
- for (auto& spec : specs_.entries) {
208
+ for (const auto& spec : specs_.entries) {
210
209
  value_size += sizeof(spec.opcode) + sizeof(spec.flags) + sizeof(std::uint16_t) + spec.path.size();
211
210
  }
212
211
  Expects(value_size > 0);
@@ -19,8 +19,8 @@
19
19
 
20
20
  #include <protocol/unsigned_leb128.h>
21
21
 
22
- #include <protocol/client_opcode.hxx>
23
22
  #include <document_id.hxx>
23
+ #include <protocol/client_opcode.hxx>
24
24
 
25
25
  namespace couchbase::protocol
26
26
  {
@@ -41,12 +41,12 @@ class mutate_in_response_body
41
41
  mutation_token token_;
42
42
 
43
43
  public:
44
- std::vector<mutate_in_field>& fields()
44
+ [[nodiscard]] const std::vector<mutate_in_field>& fields() const
45
45
  {
46
46
  return fields_;
47
47
  }
48
48
 
49
- mutation_token& token()
49
+ [[nodiscard]] const mutation_token& token() const
50
50
  {
51
51
  return token_;
52
52
  }
@@ -57,7 +57,7 @@ class mutate_in_response_body
57
57
  std::uint16_t key_size,
58
58
  std::uint8_t extras_size,
59
59
  const std::vector<uint8_t>& body,
60
- const cmd_info&)
60
+ const cmd_info& /* info */)
61
61
  {
62
62
  Expects(header[1] == static_cast<uint8_t>(opcode));
63
63
  if (status == protocol::status::success || status == protocol::status::subdoc_multi_path_failure) {
@@ -86,7 +86,7 @@ class mutate_in_response_body
86
86
  memcpy(&entry_status, body.data() + offset, sizeof(entry_status));
87
87
  entry_status = ntohs(entry_status);
88
88
  Expects(is_valid_status(entry_status));
89
- field.status = static_cast<protocol::status>(entry_status);
89
+ field.status = protocol::status(entry_status);
90
90
  offset += static_cast<offset_type>(sizeof(entry_status));
91
91
 
92
92
  if (field.status == protocol::status::success) {
@@ -327,17 +327,17 @@ class mutate_in_request_body
327
327
  framing_extras_[extras_size + 0] = static_cast<std::uint8_t>(static_cast<std::uint32_t>(frame_id) << 4U | 0U);
328
328
  }
329
329
 
330
- const std::string& key()
330
+ [[nodiscard]] const std::string& key() const
331
331
  {
332
332
  return key_;
333
333
  }
334
334
 
335
- const std::vector<std::uint8_t>& framing_extras()
335
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
336
336
  {
337
337
  return framing_extras_;
338
338
  }
339
339
 
340
- const std::vector<std::uint8_t>& extras()
340
+ [[nodiscard]] const std::vector<std::uint8_t>& extras()
341
341
  {
342
342
  if (extras_.empty()) {
343
343
  fill_extention();
@@ -345,7 +345,7 @@ class mutate_in_request_body
345
345
  return extras_;
346
346
  }
347
347
 
348
- const std::vector<std::uint8_t>& value()
348
+ [[nodiscard]] const std::vector<std::uint8_t>& value()
349
349
  {
350
350
  if (value_.empty()) {
351
351
  fill_value();
@@ -353,7 +353,7 @@ class mutate_in_request_body
353
353
  return value_;
354
354
  }
355
355
 
356
- std::size_t size()
356
+ [[nodiscard]] std::size_t size()
357
357
  {
358
358
  if (extras_.empty()) {
359
359
  fill_extention();
@@ -382,7 +382,7 @@ class mutate_in_request_body
382
382
  void fill_value()
383
383
  {
384
384
  size_t value_size = 0;
385
- for (auto& spec : specs_.entries) {
385
+ for (const auto& spec : specs_.entries) {
386
386
  value_size += sizeof(spec.opcode) + sizeof(spec.flags) + sizeof(std::uint16_t) + spec.path.size() + sizeof(std::uint32_t) +
387
387
  spec.param.size();
388
388
  }
@@ -19,8 +19,8 @@
19
19
 
20
20
  #include <protocol/unsigned_leb128.h>
21
21
 
22
- #include <protocol/client_opcode.hxx>
23
22
  #include <document_id.hxx>
23
+ #include <protocol/client_opcode.hxx>
24
24
 
25
25
  namespace couchbase::protocol
26
26
  {
@@ -30,13 +30,13 @@ class mcbp_noop_response_body
30
30
  public:
31
31
  static const inline client_opcode opcode = client_opcode::noop;
32
32
 
33
- bool parse(protocol::status,
33
+ bool parse(protocol::status /* status */,
34
34
  const header_buffer& header,
35
- std::uint8_t,
36
- std::uint16_t,
37
- std::uint8_t,
38
- const std::vector<uint8_t>&,
39
- const cmd_info&)
35
+ std::uint8_t /* framing_extras_size */,
36
+ std::uint16_t /* key_size */,
37
+ std::uint8_t /* extras_size */,
38
+ const std::vector<uint8_t>& /* body */,
39
+ const cmd_info& /* info */)
40
40
  {
41
41
  Expects(header[1] == static_cast<uint8_t>(opcode));
42
42
  return false;
@@ -49,31 +49,27 @@ class mcbp_noop_request_body
49
49
  using response_body_type = mcbp_noop_response_body;
50
50
  static const inline client_opcode opcode = client_opcode::noop;
51
51
 
52
- const std::string& key()
52
+ [[nodiscard]] const std::string& key() const
53
53
  {
54
- static std::string empty;
55
- return empty;
54
+ return empty_string;
56
55
  }
57
56
 
58
- const std::vector<std::uint8_t>& framing_extras()
57
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
59
58
  {
60
- static std::vector<std::uint8_t> empty;
61
- return empty;
59
+ return empty_buffer;
62
60
  }
63
61
 
64
- const std::vector<std::uint8_t>& extras()
62
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
65
63
  {
66
- static std::vector<std::uint8_t> empty;
67
- return empty;
64
+ return empty_buffer;
68
65
  }
69
66
 
70
- const std::vector<std::uint8_t>& value()
67
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
71
68
  {
72
- static std::vector<std::uint8_t> empty;
73
- return empty;
69
+ return empty_buffer;
74
70
  }
75
71
 
76
- std::size_t size()
72
+ [[nodiscard]] std::size_t size() const
77
73
  {
78
74
  return 0;
79
75
  }
@@ -39,7 +39,7 @@ class prepend_response_body
39
39
  mutation_token token_;
40
40
 
41
41
  public:
42
- mutation_token& token()
42
+ [[nodiscard]] const mutation_token& token() const
43
43
  {
44
44
  return token_;
45
45
  }
@@ -50,7 +50,7 @@ class prepend_response_body
50
50
  std::uint16_t,
51
51
  std::uint8_t extras_size,
52
52
  const std::vector<uint8_t>& body,
53
- const cmd_info&)
53
+ const cmd_info& /* info */)
54
54
  {
55
55
  Expects(header[1] == static_cast<uint8_t>(opcode));
56
56
  if (status == protocol::status::success) {
@@ -110,33 +110,32 @@ class prepend_request_body
110
110
  }
111
111
  }
112
112
 
113
- void content(const std::string& content)
113
+ void content(const std::string_view& content)
114
114
  {
115
115
  content_ = { content.begin(), content.end() };
116
116
  }
117
117
 
118
- const std::string& key()
118
+ [[nodiscard]] const std::string& key() const
119
119
  {
120
120
  return key_;
121
121
  }
122
122
 
123
- const std::vector<std::uint8_t>& framing_extras()
123
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
124
124
  {
125
125
  return framing_extras_;
126
126
  }
127
127
 
128
- const std::vector<std::uint8_t>& extras()
128
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
129
129
  {
130
- static std::vector<std::uint8_t> empty;
131
- return empty;
130
+ return empty_buffer;
132
131
  }
133
132
 
134
- const std::vector<std::uint8_t>& value()
133
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
135
134
  {
136
135
  return content_;
137
136
  }
138
137
 
139
- std::size_t size()
138
+ [[nodiscard]] std::size_t size() const
140
139
  {
141
140
  return framing_extras_.size() + key_.size() + content_.size();
142
141
  }
@@ -19,8 +19,8 @@
19
19
 
20
20
  #include <protocol/unsigned_leb128.h>
21
21
 
22
- #include <protocol/client_opcode.hxx>
23
22
  #include <document_id.hxx>
23
+ #include <protocol/client_opcode.hxx>
24
24
 
25
25
  namespace couchbase::protocol
26
26
  {
@@ -32,8 +32,7 @@ class remove_response_body
32
32
 
33
33
  mutation_token token_;
34
34
 
35
- public:
36
- mutation_token& token()
35
+ [[nodiscard]] const mutation_token& token() const
37
36
  {
38
37
  return token_;
39
38
  }
@@ -44,7 +43,7 @@ class remove_response_body
44
43
  std::uint16_t /* key_size */,
45
44
  std::uint8_t extras_size,
46
45
  const std::vector<uint8_t>& body,
47
- const cmd_info&)
46
+ const cmd_info& /* info */)
48
47
  {
49
48
  Expects(header[1] == static_cast<uint8_t>(opcode));
50
49
  if (status == protocol::status::success) {
@@ -103,29 +102,27 @@ class remove_request_body
103
102
  }
104
103
  }
105
104
 
106
- const std::string& key()
105
+ [[nodiscard]] const std::string& key() const
107
106
  {
108
107
  return key_;
109
108
  }
110
109
 
111
- const std::vector<std::uint8_t>& framing_extras()
110
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
112
111
  {
113
112
  return framing_extras_;
114
113
  }
115
114
 
116
- const std::vector<std::uint8_t>& extras()
115
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
117
116
  {
118
- static std::vector<std::uint8_t> empty;
119
- return empty;
117
+ return empty_buffer;
120
118
  }
121
119
 
122
- const std::vector<std::uint8_t>& value()
120
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
123
121
  {
124
- static std::vector<std::uint8_t> empty;
125
- return empty;
122
+ return empty_buffer;
126
123
  }
127
124
 
128
- std::size_t size()
125
+ [[nodiscard]] std::size_t size() const
129
126
  {
130
127
  return key_.size();
131
128
  }
@@ -48,7 +48,7 @@ class replace_response_body
48
48
  std::uint16_t,
49
49
  std::uint8_t extras_size,
50
50
  const std::vector<uint8_t>& body,
51
- const cmd_info&)
51
+ const cmd_info& /* info */)
52
52
  {
53
53
  Expects(header[1] == static_cast<uint8_t>(opcode));
54
54
  if (status == protocol::status::success) {
@@ -119,7 +119,7 @@ class replace_request_body
119
119
  framing_extras_[extras_size + 0] = static_cast<std::uint8_t>(static_cast<std::uint32_t>(frame_id) << 4U | 0U);
120
120
  }
121
121
 
122
- void content(const std::string& content)
122
+ void content(const std::string_view& content)
123
123
  {
124
124
  content_ = { content.begin(), content.end() };
125
125
  }
@@ -134,17 +134,17 @@ class replace_request_body
134
134
  expiry_ = value;
135
135
  }
136
136
 
137
- const std::string& key()
137
+ [[nodiscard]] const std::string& key() const
138
138
  {
139
139
  return key_;
140
140
  }
141
141
 
142
- const std::vector<std::uint8_t>& framing_extras()
142
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
143
143
  {
144
144
  return framing_extras_;
145
145
  }
146
146
 
147
- const std::vector<std::uint8_t>& extras()
147
+ [[nodiscard]] const std::vector<std::uint8_t>& extras()
148
148
  {
149
149
  if (extras_.empty()) {
150
150
  fill_extention();
@@ -152,12 +152,12 @@ class replace_request_body
152
152
  return extras_;
153
153
  }
154
154
 
155
- const std::vector<std::uint8_t>& value()
155
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
156
156
  {
157
157
  return content_;
158
158
  }
159
159
 
160
- std::size_t size()
160
+ [[nodiscard]] std::size_t size()
161
161
  {
162
162
  if (extras_.empty()) {
163
163
  fill_extention();
@@ -38,7 +38,7 @@ class sasl_auth_response_body
38
38
  std::uint16_t key_size,
39
39
  std::uint8_t extras_size,
40
40
  const std::vector<uint8_t>& body,
41
- const cmd_info&)
41
+ const cmd_info& /* info */)
42
42
  {
43
43
  Expects(header[1] == static_cast<uint8_t>(opcode));
44
44
  if (status == protocol::status::success || status == protocol::status::auth_continue) {
@@ -75,29 +75,27 @@ class sasl_auth_request_body
75
75
  value_.assign(data.begin(), data.end());
76
76
  }
77
77
 
78
- const std::string& key()
78
+ [[nodiscard]] const std::string& key() const
79
79
  {
80
80
  return key_;
81
81
  }
82
82
 
83
- const std::vector<std::uint8_t>& framing_extras()
83
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
84
84
  {
85
- static std::vector<std::uint8_t> empty;
86
- return empty;
85
+ return empty_buffer;
87
86
  }
88
87
 
89
- const std::vector<std::uint8_t>& extras()
88
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
90
89
  {
91
- static std::vector<std::uint8_t> empty;
92
- return empty;
90
+ return empty_buffer;
93
91
  }
94
92
 
95
- const std::vector<std::uint8_t>& value()
93
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
96
94
  {
97
95
  return value_;
98
96
  }
99
97
 
100
- std::size_t size()
98
+ [[nodiscard]] std::size_t size() const
101
99
  {
102
100
  return key_.size() + value_.size();
103
101
  }