couchbase 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) 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/analytics_dataset_create.hxx +16 -12
  43. data/ext/couchbase/operations/analytics_dataset_drop.hxx +11 -11
  44. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +6 -6
  45. data/ext/couchbase/operations/analytics_dataverse_create.hxx +10 -11
  46. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +10 -11
  47. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +9 -11
  48. data/ext/couchbase/operations/analytics_index_create.hxx +14 -13
  49. data/ext/couchbase/operations/analytics_index_drop.hxx +18 -12
  50. data/ext/couchbase/operations/analytics_index_get_all.hxx +8 -6
  51. data/ext/couchbase/operations/analytics_link.hxx +39 -0
  52. data/ext/couchbase/operations/analytics_link_azure_blob_external.hxx +145 -0
  53. data/ext/couchbase/operations/analytics_link_connect.hxx +14 -12
  54. data/ext/couchbase/operations/analytics_link_couchbase_remote.hxx +220 -0
  55. data/ext/couchbase/operations/analytics_link_create.hxx +128 -0
  56. data/ext/couchbase/operations/analytics_link_disconnect.hxx +11 -12
  57. data/ext/couchbase/operations/analytics_link_drop.hxx +130 -0
  58. data/ext/couchbase/operations/analytics_link_get_all.hxx +160 -0
  59. data/ext/couchbase/operations/analytics_link_replace.hxx +128 -0
  60. data/ext/couchbase/operations/analytics_link_s3_external.hxx +122 -0
  61. data/ext/couchbase/operations/bucket_create.hxx +8 -8
  62. data/ext/couchbase/operations/bucket_drop.hxx +5 -5
  63. data/ext/couchbase/operations/bucket_flush.hxx +5 -5
  64. data/ext/couchbase/operations/bucket_get.hxx +7 -7
  65. data/ext/couchbase/operations/bucket_get_all.hxx +7 -5
  66. data/ext/couchbase/operations/bucket_settings.hxx +40 -49
  67. data/ext/couchbase/operations/bucket_update.hxx +8 -8
  68. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +7 -7
  69. data/ext/couchbase/operations/collection_create.hxx +11 -11
  70. data/ext/couchbase/operations/collection_drop.hxx +12 -10
  71. data/ext/couchbase/operations/collections_manifest_get.hxx +3 -3
  72. data/ext/couchbase/operations/design_document.hxx +2 -2
  73. data/ext/couchbase/operations/document_analytics.hxx +29 -36
  74. data/ext/couchbase/operations/document_append.hxx +3 -3
  75. data/ext/couchbase/operations/document_decrement.hxx +3 -3
  76. data/ext/couchbase/operations/document_exists.hxx +2 -2
  77. data/ext/couchbase/operations/document_get.hxx +3 -3
  78. data/ext/couchbase/operations/document_get_and_lock.hxx +5 -3
  79. data/ext/couchbase/operations/document_get_and_touch.hxx +5 -3
  80. data/ext/couchbase/operations/document_get_projected.hxx +10 -11
  81. data/ext/couchbase/operations/document_increment.hxx +3 -3
  82. data/ext/couchbase/operations/document_insert.hxx +3 -3
  83. data/ext/couchbase/operations/document_lookup_in.hxx +12 -18
  84. data/ext/couchbase/operations/document_mutate_in.hxx +13 -18
  85. data/ext/couchbase/operations/document_prepend.hxx +3 -3
  86. data/ext/couchbase/operations/document_query.hxx +39 -41
  87. data/ext/couchbase/operations/document_remove.hxx +3 -3
  88. data/ext/couchbase/operations/document_replace.hxx +3 -3
  89. data/ext/couchbase/operations/document_search.hxx +56 -61
  90. data/ext/couchbase/operations/document_touch.hxx +3 -3
  91. data/ext/couchbase/operations/document_unlock.hxx +3 -3
  92. data/ext/couchbase/operations/document_upsert.hxx +3 -3
  93. data/ext/couchbase/operations/document_view.hxx +23 -23
  94. data/ext/couchbase/operations/group_drop.hxx +5 -5
  95. data/ext/couchbase/operations/group_get.hxx +7 -7
  96. data/ext/couchbase/operations/group_get_all.hxx +6 -6
  97. data/ext/couchbase/operations/group_upsert.hxx +11 -11
  98. data/ext/couchbase/operations/http_noop.hxx +6 -6
  99. data/ext/couchbase/operations/mcbp_noop.hxx +3 -3
  100. data/ext/couchbase/operations/query_index_build_deferred.hxx +6 -6
  101. data/ext/couchbase/operations/query_index_create.hxx +10 -8
  102. data/ext/couchbase/operations/query_index_drop.hxx +8 -8
  103. data/ext/couchbase/operations/query_index_get_all.hxx +43 -39
  104. data/ext/couchbase/operations/rbac.hxx +40 -63
  105. data/ext/couchbase/operations/role_get_all.hxx +6 -6
  106. data/ext/couchbase/operations/scope_create.hxx +10 -10
  107. data/ext/couchbase/operations/scope_drop.hxx +9 -9
  108. data/ext/couchbase/operations/scope_get_all.hxx +8 -8
  109. data/ext/couchbase/operations/search_get_stats.hxx +5 -3
  110. data/ext/couchbase/operations/search_index.hxx +6 -15
  111. data/ext/couchbase/operations/search_index_analyze_document.hxx +11 -11
  112. data/ext/couchbase/operations/search_index_control_ingest.hxx +9 -9
  113. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +9 -9
  114. data/ext/couchbase/operations/search_index_control_query.hxx +9 -9
  115. data/ext/couchbase/operations/search_index_drop.hxx +11 -9
  116. data/ext/couchbase/operations/search_index_get.hxx +11 -9
  117. data/ext/couchbase/operations/search_index_get_all.hxx +11 -11
  118. data/ext/couchbase/operations/search_index_get_documents_count.hxx +10 -10
  119. data/ext/couchbase/operations/search_index_get_stats.hxx +10 -8
  120. data/ext/couchbase/operations/search_index_upsert.hxx +12 -10
  121. data/ext/couchbase/operations/user_drop.hxx +5 -5
  122. data/ext/couchbase/operations/user_get.hxx +7 -7
  123. data/ext/couchbase/operations/user_get_all.hxx +6 -6
  124. data/ext/couchbase/operations/user_upsert.hxx +9 -9
  125. data/ext/couchbase/operations/view_index_drop.hxx +10 -10
  126. data/ext/couchbase/operations/view_index_get.hxx +13 -15
  127. data/ext/couchbase/operations/view_index_get_all.hxx +17 -20
  128. data/ext/couchbase/operations/view_index_upsert.hxx +9 -7
  129. data/ext/couchbase/operations.hxx +4 -0
  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/management/analytics_index_manager.rb +920 -226
  213. data/lib/couchbase/management/bucket_manager.rb +207 -69
  214. data/lib/couchbase/management/collection_manager.rb +173 -61
  215. data/lib/couchbase/management/query_index_manager.rb +357 -169
  216. data/lib/couchbase/options.rb +75 -3
  217. data/lib/couchbase/scope.rb +102 -0
  218. data/lib/couchbase/utils/time.rb +4 -0
  219. data/lib/couchbase/version.rb +6 -6
  220. metadata +50 -7
@@ -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
  }
@@ -42,7 +42,7 @@ class sasl_list_mechs_response_body
42
42
  std::uint16_t key_size,
43
43
  std::uint8_t extras_size,
44
44
  const std::vector<uint8_t>& body,
45
- const cmd_info&)
45
+ const cmd_info& /* info */)
46
46
  {
47
47
  Expects(header[1] == static_cast<uint8_t>(opcode));
48
48
  if (status == protocol::status::success) {
@@ -66,32 +66,27 @@ class sasl_list_mechs_request_body
66
66
  using response_body_type = sasl_list_mechs_response_body;
67
67
  static const inline client_opcode opcode = client_opcode::sasl_list_mechs;
68
68
 
69
- public:
70
- const std::string& key()
69
+ [[nodiscard]] const std::string& key() const
71
70
  {
72
- static std::string empty;
73
- return empty;
71
+ return empty_string;
74
72
  }
75
73
 
76
- const std::vector<std::uint8_t>& framing_extras()
74
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
77
75
  {
78
- static std::vector<std::uint8_t> empty;
79
- return empty;
76
+ return empty_buffer;
80
77
  }
81
78
 
82
- const std::vector<std::uint8_t>& extras()
79
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
83
80
  {
84
- static std::vector<std::uint8_t> empty;
85
- return empty;
81
+ return empty_buffer;
86
82
  }
87
83
 
88
- const std::vector<std::uint8_t>& value()
84
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
89
85
  {
90
- static std::vector<std::uint8_t> empty;
91
- return empty;
86
+ return empty_buffer;
92
87
  }
93
88
 
94
- std::size_t size()
89
+ [[nodiscard]] std::size_t size() const
95
90
  {
96
91
  return 0;
97
92
  }
@@ -36,7 +36,7 @@ class sasl_step_response_body
36
36
  std::uint16_t key_size,
37
37
  std::uint8_t extras_size,
38
38
  const std::vector<uint8_t>& body,
39
- const cmd_info&)
39
+ const cmd_info& /* info */)
40
40
  {
41
41
  Expects(header[1] == static_cast<uint8_t>(opcode));
42
42
  if (status == protocol::status::success) {
@@ -59,8 +59,8 @@ class sasl_step_request_body
59
59
  static const inline client_opcode opcode = client_opcode::sasl_step;
60
60
 
61
61
  private:
62
- std::string key_;
63
- std::vector<std::uint8_t> value_;
62
+ std::string key_{};
63
+ std::vector<std::uint8_t> value_{};
64
64
 
65
65
  public:
66
66
  void mechanism(std::string_view mech)
@@ -73,29 +73,27 @@ class sasl_step_request_body
73
73
  value_.assign(data.begin(), data.end());
74
74
  }
75
75
 
76
- const std::string& key()
76
+ [[nodiscard]] const std::string& key() const
77
77
  {
78
78
  return key_;
79
79
  }
80
80
 
81
- const std::vector<std::uint8_t>& framing_extras()
81
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
82
82
  {
83
- static std::vector<std::uint8_t> empty;
84
- return empty;
83
+ return empty_buffer;
85
84
  }
86
85
 
87
- const std::vector<std::uint8_t>& extras()
86
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
88
87
  {
89
- static std::vector<std::uint8_t> empty;
90
- return empty;
88
+ return empty_buffer;
91
89
  }
92
90
 
93
- const std::vector<std::uint8_t>& value()
91
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
94
92
  {
95
93
  return value_;
96
94
  }
97
95
 
98
- std::size_t size()
96
+ [[nodiscard]] std::size_t size() const
99
97
  {
100
98
  return key_.size() + value_.size();
101
99
  }
@@ -24,14 +24,13 @@ class select_bucket_response_body
24
24
  public:
25
25
  static const inline client_opcode opcode = client_opcode::select_bucket;
26
26
 
27
- public:
28
- bool parse(protocol::status,
27
+ bool parse(protocol::status /* status */,
29
28
  const header_buffer& header,
30
- std::uint8_t,
31
- std::uint16_t,
32
- std::uint8_t,
33
- const std::vector<uint8_t>&,
34
- const cmd_info&)
29
+ std::uint8_t /* framing_extras_size */,
30
+ std::uint16_t /* key_size */,
31
+ std::uint8_t /* extras_size */,
32
+ const std::vector<uint8_t>& /* body */,
33
+ const cmd_info& /* info */)
35
34
  {
36
35
  Expects(header[1] == static_cast<uint8_t>(opcode));
37
36
  return false;
@@ -53,30 +52,27 @@ class select_bucket_request_body
53
52
  key_ = name;
54
53
  }
55
54
 
56
- const std::string& key()
55
+ [[nodiscard]] const std::string& key() const
57
56
  {
58
57
  return key_;
59
58
  }
60
59
 
61
- const std::vector<std::uint8_t>& framing_extras()
60
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
62
61
  {
63
- static std::vector<std::uint8_t> empty;
64
- return empty;
62
+ return empty_buffer;
65
63
  }
66
64
 
67
- const std::vector<std::uint8_t>& extras()
65
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
68
66
  {
69
- static std::vector<std::uint8_t> empty;
70
- return empty;
67
+ return empty_buffer;
71
68
  }
72
69
 
73
- const std::vector<std::uint8_t>& value()
70
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
74
71
  {
75
- static std::vector<std::uint8_t> empty;
76
- return empty;
72
+ return empty_buffer;
77
73
  }
78
74
 
79
- std::size_t size()
75
+ [[nodiscard]] std::size_t size() const
80
76
  {
81
77
  return key_.size();
82
78
  }
@@ -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,7 +30,6 @@ class touch_response_body
30
30
  public:
31
31
  static const inline client_opcode opcode = client_opcode::touch;
32
32
 
33
- public:
34
33
  bool parse(protocol::status /* status */,
35
34
  const header_buffer& header,
36
35
  std::uint8_t /* framing_extras_size */,
@@ -71,29 +70,27 @@ class touch_request_body
71
70
  memcpy(extras_.data(), &seconds, sizeof(seconds));
72
71
  }
73
72
 
74
- const std::string& key()
73
+ [[nodiscard]] const std::string& key() const
75
74
  {
76
75
  return key_;
77
76
  }
78
77
 
79
- const std::vector<std::uint8_t>& framing_extras()
78
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
80
79
  {
81
- static std::vector<std::uint8_t> empty;
82
- return empty;
80
+ return empty_buffer;
83
81
  }
84
82
 
85
- const std::vector<std::uint8_t>& extras()
83
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
86
84
  {
87
85
  return extras_;
88
86
  }
89
87
 
90
- const std::vector<std::uint8_t>& value()
88
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
91
89
  {
92
- static std::vector<std::uint8_t> empty;
93
- return empty;
90
+ return empty_buffer;
94
91
  }
95
92
 
96
- std::size_t size()
93
+ [[nodiscard]] std::size_t size() const
97
94
  {
98
95
  return key_.size() + extras_.size();
99
96
  }
@@ -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,14 +30,13 @@ class unlock_response_body
30
30
  public:
31
31
  static const inline client_opcode opcode = client_opcode::unlock;
32
32
 
33
- public:
34
33
  bool parse(protocol::status /* status */,
35
34
  const header_buffer& header,
36
35
  std::uint8_t /* framing_extras_size */,
37
36
  std::uint16_t /* key_size */,
38
37
  std::uint8_t /* extras_size */,
39
38
  const std::vector<uint8_t>& /* body */,
40
- const cmd_info&)
39
+ const cmd_info& /* info */)
41
40
  {
42
41
  Expects(header[1] == static_cast<uint8_t>(opcode));
43
42
  return false;
@@ -63,30 +62,27 @@ class unlock_request_body
63
62
  }
64
63
  }
65
64
 
66
- const std::string& key()
65
+ [[nodiscard]] const std::string& key() const
67
66
  {
68
67
  return key_;
69
68
  }
70
69
 
71
- const std::vector<std::uint8_t>& framing_extras()
70
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
72
71
  {
73
- static std::vector<std::uint8_t> empty;
74
- return empty;
72
+ return empty_buffer;
75
73
  }
76
74
 
77
- const std::vector<std::uint8_t>& extras()
75
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
78
76
  {
79
- static std::vector<std::uint8_t> empty;
80
- return empty;
77
+ return empty_buffer;
81
78
  }
82
79
 
83
- const std::vector<std::uint8_t>& value()
80
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
84
81
  {
85
- static std::vector<std::uint8_t> empty;
86
- return empty;
82
+ return empty_buffer;
87
83
  }
88
84
 
89
- std::size_t size()
85
+ [[nodiscard]] std::size_t size() const
90
86
  {
91
87
  return key_.size();
92
88
  }
@@ -37,7 +37,7 @@ class upsert_response_body
37
37
  mutation_token token_;
38
38
 
39
39
  public:
40
- mutation_token& token()
40
+ [[nodiscard]] const mutation_token& token() const
41
41
  {
42
42
  return token_;
43
43
  }
@@ -48,7 +48,7 @@ class upsert_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 upsert_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 upsert_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 upsert_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();
@@ -27,10 +27,10 @@ enum class datatype : uint8_t {
27
27
 
28
28
  };
29
29
 
30
- constexpr inline bool
30
+ constexpr bool
31
31
  is_valid_datatype(uint8_t code)
32
32
  {
33
- switch (static_cast<datatype>(code)) {
33
+ switch (datatype(code)) {
34
34
  case datatype::raw:
35
35
  case datatype::json:
36
36
  case datatype::snappy:
@@ -40,7 +40,7 @@ is_valid_datatype(uint8_t code)
40
40
  return false;
41
41
  }
42
42
 
43
- constexpr inline bool
43
+ constexpr bool
44
44
  has_json_datatype(uint8_t code)
45
45
  {
46
46
  return (code & uint8_t(datatype::json)) != 0;
@@ -44,10 +44,10 @@ enum class durability_level : uint8_t {
44
44
  persist_to_majority = 0x03,
45
45
  };
46
46
 
47
- constexpr inline bool
47
+ constexpr bool
48
48
  is_valid_durability_level(uint8_t value)
49
49
  {
50
- switch (static_cast<durability_level>(value)) {
50
+ switch (durability_level(value)) {
51
51
  case durability_level::none:
52
52
  case durability_level::majority:
53
53
  case durability_level::majority_and_persist_to_active:
@@ -93,10 +93,10 @@ enum class request_frame_info_id : uint8_t {
93
93
  preserve_ttl = 0x05,
94
94
  };
95
95
 
96
- constexpr inline bool
96
+ constexpr bool
97
97
  is_valid_request_frame_info_id(uint8_t value)
98
98
  {
99
- switch (static_cast<request_frame_info_id>(value)) {
99
+ switch (request_frame_info_id(value)) {
100
100
  case request_frame_info_id::barrier:
101
101
  case request_frame_info_id::durability_requirement:
102
102
  case request_frame_info_id::dcp_stream_id:
@@ -129,10 +129,10 @@ enum class response_frame_info_id : uint8_t {
129
129
  server_duration = 0x00,
130
130
  };
131
131
 
132
- constexpr inline bool
132
+ constexpr bool
133
133
  is_valid_response_frame_info_id(uint8_t value)
134
134
  {
135
- switch (static_cast<response_frame_info_id>(value)) {
135
+ switch (response_frame_info_id(value)) {
136
136
  case response_frame_info_id::server_duration:
137
137
  return true;
138
138
  }