couchbase 3.1.1-universal-darwin-20 → 3.2.0-universal-darwin-20

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -60,12 +60,12 @@ class get_cluster_config_response_body
60
60
  static const inline client_opcode opcode = client_opcode::get_cluster_config;
61
61
 
62
62
  private:
63
- configuration config_;
63
+ configuration config_{};
64
64
 
65
65
  public:
66
- [[nodiscard]] configuration config()
66
+ [[nodiscard]] configuration&& config()
67
67
  {
68
- return config_;
68
+ return std::move(config_);
69
69
  }
70
70
 
71
71
  bool parse(protocol::status status,
@@ -74,7 +74,7 @@ class get_cluster_config_response_body
74
74
  std::uint16_t key_size,
75
75
  std::uint8_t extras_size,
76
76
  const std::vector<uint8_t>& body,
77
- const cmd_info&)
77
+ const cmd_info& /* info */)
78
78
  {
79
79
  Expects(header[1] == static_cast<uint8_t>(opcode));
80
80
  if (status == protocol::status::success) {
@@ -92,32 +92,27 @@ class get_cluster_config_request_body
92
92
  using response_body_type = get_cluster_config_response_body;
93
93
  static const inline client_opcode opcode = client_opcode::get_cluster_config;
94
94
 
95
- public:
96
- const std::string& key()
95
+ [[nodiscard]] const std::string& key() const
97
96
  {
98
- static std::string empty;
99
- return empty;
97
+ return empty_string;
100
98
  }
101
99
 
102
- const std::vector<std::uint8_t>& framing_extras()
100
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
103
101
  {
104
- static std::vector<std::uint8_t> empty;
105
- return empty;
102
+ return empty_buffer;
106
103
  }
107
104
 
108
- const std::vector<std::uint8_t>& extras()
105
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
109
106
  {
110
- static std::vector<std::uint8_t> empty;
111
- return empty;
107
+ return empty_buffer;
112
108
  }
113
109
 
114
- const std::vector<std::uint8_t>& value()
110
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
115
111
  {
116
- static std::vector<std::uint8_t> empty;
117
- return empty;
112
+ return empty_buffer;
118
113
  }
119
114
 
120
- std::size_t size()
115
+ [[nodiscard]] std::size_t size() const
121
116
  {
122
117
  return 0;
123
118
  }
@@ -36,12 +36,12 @@ class get_collection_id_response_body
36
36
  std::uint32_t collection_uid_;
37
37
 
38
38
  public:
39
- [[nodiscard]] std::uint64_t manifest_uid()
39
+ [[nodiscard]] std::uint64_t manifest_uid() const
40
40
  {
41
41
  return manifest_uid_;
42
42
  }
43
43
 
44
- [[nodiscard]] std::uint32_t collection_uid()
44
+ [[nodiscard]] std::uint32_t collection_uid() const
45
45
  {
46
46
  return collection_uid_;
47
47
  }
@@ -52,7 +52,7 @@ class get_collection_id_response_body
52
52
  std::uint16_t key_size,
53
53
  std::uint8_t extras_size,
54
54
  const std::vector<uint8_t>& body,
55
- const cmd_info&)
55
+ const cmd_info& /* info */)
56
56
  {
57
57
  Expects(header[1] == static_cast<uint8_t>(opcode));
58
58
  if (status == protocol::status::success && extras_size == 12) {
@@ -80,35 +80,32 @@ class get_collection_id_request_body
80
80
  std::vector<std::uint8_t> value_{};
81
81
 
82
82
  public:
83
- void collection_path(const std::string& path)
83
+ void collection_path(const std::string_view& path)
84
84
  {
85
85
  value_.assign(path.begin(), path.end());
86
86
  }
87
87
 
88
- const std::string& key()
88
+ [[nodiscard]] const std::string& key() const
89
89
  {
90
- static std::string empty;
91
- return empty;
90
+ return empty_string;
92
91
  }
93
92
 
94
- const std::vector<std::uint8_t>& framing_extras()
93
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
95
94
  {
96
- static std::vector<std::uint8_t> empty;
97
- return empty;
95
+ return empty_buffer;
98
96
  }
99
97
 
100
- const std::vector<std::uint8_t>& extras()
98
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
101
99
  {
102
- static std::vector<std::uint8_t> empty;
103
- return empty;
100
+ return empty_buffer;
104
101
  }
105
102
 
106
- const std::vector<std::uint8_t>& value()
103
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
107
104
  {
108
105
  return value_;
109
106
  }
110
107
 
111
- std::size_t size()
108
+ [[nodiscard]] std::size_t size() const
112
109
  {
113
110
  return value_.size();
114
111
  }
@@ -20,8 +20,8 @@
20
20
  #include <gsl/gsl_assert>
21
21
 
22
22
  #include <protocol/client_opcode.hxx>
23
- #include <protocol/status.hxx>
24
23
  #include <protocol/cmd_info.hxx>
24
+ #include <protocol/status.hxx>
25
25
 
26
26
  #include <collections_manifest.hxx>
27
27
 
@@ -37,7 +37,7 @@ class get_collections_manifest_response_body
37
37
  collections_manifest manifest_;
38
38
 
39
39
  public:
40
- [[nodiscard]] couchbase::collections_manifest manifest()
40
+ [[nodiscard]] const couchbase::collections_manifest& manifest() const
41
41
  {
42
42
  return manifest_;
43
43
  }
@@ -48,7 +48,7 @@ class get_collections_manifest_response_body
48
48
  std::uint16_t key_size,
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) {
@@ -66,31 +66,27 @@ class get_collections_manifest_request_body
66
66
  using response_body_type = get_collections_manifest_response_body;
67
67
  static const inline client_opcode opcode = client_opcode::get_collections_manifest;
68
68
 
69
- const std::string& key()
69
+ [[nodiscard]] const std::string& key() const
70
70
  {
71
- static std::string empty;
72
- return empty;
71
+ return empty_string;
73
72
  }
74
73
 
75
- const std::vector<std::uint8_t>& framing_extras()
74
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
76
75
  {
77
- static std::vector<std::uint8_t> empty;
78
- return empty;
76
+ return empty_buffer;
79
77
  }
80
78
 
81
- const std::vector<std::uint8_t>& extras()
79
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
82
80
  {
83
- static std::vector<std::uint8_t> empty;
84
- return empty;
81
+ return empty_buffer;
85
82
  }
86
83
 
87
- const std::vector<std::uint8_t>& value()
84
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
88
85
  {
89
- static std::vector<std::uint8_t> empty;
90
- return empty;
86
+ return empty_buffer;
91
87
  }
92
88
 
93
- std::size_t size()
89
+ [[nodiscard]] std::size_t size() const
94
90
  {
95
91
  return 0;
96
92
  }
@@ -20,8 +20,8 @@
20
20
  #include <gsl/gsl_assert>
21
21
 
22
22
  #include <protocol/client_opcode.hxx>
23
- #include <protocol/status.hxx>
24
23
  #include <protocol/cmd_info.hxx>
24
+ #include <protocol/status.hxx>
25
25
 
26
26
  #include <error_map.hxx>
27
27
 
@@ -34,10 +34,10 @@ class get_error_map_response_body
34
34
  static const inline client_opcode opcode = client_opcode::get_error_map;
35
35
 
36
36
  private:
37
- error_map errmap_;
37
+ error_map errmap_{};
38
38
 
39
39
  public:
40
- [[nodiscard]] couchbase::error_map errmap()
40
+ [[nodiscard]] const couchbase::error_map& errmap() const
41
41
  {
42
42
  return errmap_;
43
43
  }
@@ -48,15 +48,15 @@ class get_error_map_response_body
48
48
  std::uint16_t key_size,
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) {
55
55
  try {
56
56
  std::vector<uint8_t>::difference_type offset = framing_extras_size + key_size + extras_size;
57
57
  errmap_ = tao::json::from_string(std::string(body.begin() + offset, body.end())).as<error_map>();
58
- } catch (tao::json::pegtl::parse_error& e) {
59
- spdlog::critical("unable to parse JSON: {}", std::string(body.begin(), body.end()));
58
+ } catch (const tao::json::pegtl::parse_error& e) {
59
+ spdlog::critical("unable to parse JSON: {}, {}", e.message(), std::string(body.begin(), body.end()));
60
60
  }
61
61
  return true;
62
62
  }
@@ -80,25 +80,22 @@ class get_error_map_request_body
80
80
  version_ = version;
81
81
  }
82
82
 
83
- const std::string& key()
83
+ [[nodiscard]] const std::string& key() const
84
84
  {
85
- static std::string empty;
86
- return empty;
85
+ return empty_string;
87
86
  }
88
87
 
89
- const std::vector<std::uint8_t>& framing_extras()
88
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_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>& extras()
93
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
96
94
  {
97
- static std::vector<std::uint8_t> empty;
98
- return empty;
95
+ return empty_buffer;
99
96
  }
100
97
 
101
- const std::vector<std::uint8_t>& value()
98
+ [[nodiscard]] const std::vector<std::uint8_t>& value()
102
99
  {
103
100
  if (value_.empty()) {
104
101
  fill_body();
@@ -106,7 +103,7 @@ class get_error_map_request_body
106
103
  return value_;
107
104
  }
108
105
 
109
- std::size_t size()
106
+ [[nodiscard]] std::size_t size()
110
107
  {
111
108
  if (value_.empty()) {
112
109
  fill_body();
@@ -42,7 +42,7 @@ class hello_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) {
@@ -123,24 +123,22 @@ class hello_request_body
123
123
  return features_;
124
124
  }
125
125
 
126
- const std::string& key()
126
+ [[nodiscard]] const std::string& key() const
127
127
  {
128
128
  return key_;
129
129
  }
130
130
 
131
- const std::vector<std::uint8_t>& framing_extras()
131
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
132
132
  {
133
- static std::vector<std::uint8_t> empty;
134
- return empty;
133
+ return empty_buffer;
135
134
  }
136
135
 
137
- const std::vector<std::uint8_t>& extras()
136
+ [[nodiscard]] const std::vector<std::uint8_t>& extras() const
138
137
  {
139
- static std::vector<std::uint8_t> empty;
140
- return empty;
138
+ return empty_buffer;
141
139
  }
142
140
 
143
- const std::vector<std::uint8_t>& value()
141
+ [[nodiscard]] const std::vector<std::uint8_t>& value()
144
142
  {
145
143
  if (value_.empty()) {
146
144
  fill_body();
@@ -148,7 +146,7 @@ class hello_request_body
148
146
  return value_;
149
147
  }
150
148
 
151
- std::size_t size()
149
+ [[nodiscard]] std::size_t size()
152
150
  {
153
151
  if (value_.empty()) {
154
152
  fill_body();
@@ -31,16 +31,16 @@ class increment_response_body
31
31
  static const inline client_opcode opcode = client_opcode::increment;
32
32
 
33
33
  private:
34
- mutation_token token_;
34
+ mutation_token token_{};
35
35
  std::uint64_t content_;
36
36
 
37
37
  public:
38
- std::uint64_t content()
38
+ [[nodiscard]] std::uint64_t content() const
39
39
  {
40
40
  return content_;
41
41
  }
42
42
 
43
- mutation_token& token()
43
+ [[nodiscard]] const mutation_token& token() const
44
44
  {
45
45
  return token_;
46
46
  }
@@ -51,7 +51,7 @@ class increment_response_body
51
51
  std::uint16_t key_size,
52
52
  std::uint8_t extras_size,
53
53
  const std::vector<uint8_t>& body,
54
- const cmd_info&)
54
+ const cmd_info& /* info */)
55
55
  {
56
56
  Expects(header[1] == static_cast<uint8_t>(opcode));
57
57
  if (status == protocol::status::success) {
@@ -142,17 +142,17 @@ class increment_request_body
142
142
  framing_extras_[extras_size + 0] = static_cast<std::uint8_t>(static_cast<std::uint32_t>(frame_id) << 4U | 0U);
143
143
  }
144
144
 
145
- const std::string& key()
145
+ [[nodiscard]] const std::string& key() const
146
146
  {
147
147
  return key_;
148
148
  }
149
149
 
150
- const std::vector<std::uint8_t>& framing_extras()
150
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
151
151
  {
152
152
  return framing_extras_;
153
153
  }
154
154
 
155
- const std::vector<std::uint8_t>& extras()
155
+ [[nodiscard]] const std::vector<std::uint8_t>& extras()
156
156
  {
157
157
  if (extras_.empty()) {
158
158
  fill_extras();
@@ -160,10 +160,9 @@ class increment_request_body
160
160
  return extras_;
161
161
  }
162
162
 
163
- const std::vector<std::uint8_t>& value()
163
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
164
164
  {
165
- static std::vector<std::uint8_t> empty;
166
- return empty;
165
+ return empty_buffer;
167
166
  }
168
167
 
169
168
  [[nodiscard]] std::size_t size()
@@ -37,7 +37,7 @@ class insert_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
  }
@@ -45,10 +45,10 @@ class insert_response_body
45
45
  bool parse(protocol::status status,
46
46
  const header_buffer& header,
47
47
  std::uint8_t framing_extras_size,
48
- std::uint16_t,
48
+ std::uint16_t /* key_size */,
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) {
@@ -110,7 +110,7 @@ class insert_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
  }
@@ -125,17 +125,17 @@ class insert_request_body
125
125
  expiry_ = value;
126
126
  }
127
127
 
128
- const std::string& key()
128
+ [[nodiscard]] const std::string& key() const
129
129
  {
130
130
  return key_;
131
131
  }
132
132
 
133
- const std::vector<std::uint8_t>& framing_extras()
133
+ [[nodiscard]] const std::vector<std::uint8_t>& framing_extras() const
134
134
  {
135
135
  return framing_extras_;
136
136
  }
137
137
 
138
- const std::vector<std::uint8_t>& extras()
138
+ [[nodiscard]] const std::vector<std::uint8_t>& extras()
139
139
  {
140
140
  if (extras_.empty()) {
141
141
  fill_extention();
@@ -143,12 +143,12 @@ class insert_request_body
143
143
  return extras_;
144
144
  }
145
145
 
146
- const std::vector<std::uint8_t>& value()
146
+ [[nodiscard]] const std::vector<std::uint8_t>& value() const
147
147
  {
148
148
  return content_;
149
149
  }
150
150
 
151
- std::size_t size()
151
+ [[nodiscard]] std::size_t size()
152
152
  {
153
153
  if (extras_.empty()) {
154
154
  fill_extention();