couchbase 3.0.0.alpha.5-universal-darwin-19 → 3.0.0.beta.1-universal-darwin-19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +12 -3
  3. data/README.md +4 -2
  4. data/Rakefile +1 -1
  5. data/couchbase.gemspec +17 -12
  6. data/ext/.idea/misc.xml +12 -0
  7. data/ext/CMakeLists.txt +10 -1
  8. data/ext/build_config.hxx.in +20 -0
  9. data/ext/build_version.hxx.in +1 -1
  10. data/ext/couchbase/bucket.hxx +90 -24
  11. data/ext/couchbase/cluster.hxx +125 -84
  12. data/ext/couchbase/cluster_options.hxx +53 -0
  13. data/ext/couchbase/configuration.hxx +220 -2
  14. data/ext/couchbase/couchbase.cxx +134 -127
  15. data/ext/couchbase/io/dns_client.hxx +3 -1
  16. data/ext/couchbase/io/http_command.hxx +91 -0
  17. data/ext/couchbase/io/http_session.hxx +58 -19
  18. data/ext/couchbase/io/http_session_manager.hxx +26 -31
  19. data/ext/couchbase/io/mcbp_command.hxx +180 -0
  20. data/ext/couchbase/io/mcbp_message.hxx +5 -0
  21. data/ext/couchbase/io/mcbp_session.hxx +213 -98
  22. data/ext/couchbase/io/streams.hxx +165 -0
  23. data/ext/couchbase/operations.hxx +1 -1
  24. data/ext/couchbase/operations/analytics_dataset_create.hxx +1 -1
  25. data/ext/couchbase/operations/bucket_create.hxx +4 -2
  26. data/ext/couchbase/operations/bucket_drop.hxx +4 -2
  27. data/ext/couchbase/operations/bucket_flush.hxx +4 -2
  28. data/ext/couchbase/operations/bucket_get.hxx +4 -2
  29. data/ext/couchbase/operations/bucket_get_all.hxx +4 -2
  30. data/ext/couchbase/operations/bucket_update.hxx +4 -2
  31. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +4 -2
  32. data/ext/couchbase/operations/collection_create.hxx +4 -2
  33. data/ext/couchbase/operations/collection_drop.hxx +4 -2
  34. data/ext/couchbase/operations/document_analytics.hxx +0 -4
  35. data/ext/couchbase/operations/document_decrement.hxx +6 -3
  36. data/ext/couchbase/operations/document_get.hxx +3 -0
  37. data/ext/couchbase/operations/document_get_and_lock.hxx +3 -0
  38. data/ext/couchbase/operations/document_get_and_touch.hxx +5 -2
  39. data/ext/couchbase/operations/document_get_projected.hxx +12 -9
  40. data/ext/couchbase/operations/document_increment.hxx +6 -3
  41. data/ext/couchbase/operations/document_insert.hxx +5 -2
  42. data/ext/couchbase/operations/document_lookup_in.hxx +3 -0
  43. data/ext/couchbase/operations/document_mutate_in.hxx +6 -3
  44. data/ext/couchbase/operations/document_remove.hxx +3 -0
  45. data/ext/couchbase/operations/document_replace.hxx +5 -2
  46. data/ext/couchbase/operations/document_search.hxx +6 -7
  47. data/ext/couchbase/operations/document_touch.hxx +5 -2
  48. data/ext/couchbase/operations/document_unlock.hxx +3 -0
  49. data/ext/couchbase/operations/document_upsert.hxx +5 -2
  50. data/ext/couchbase/operations/query_index_build_deferred.hxx +3 -3
  51. data/ext/couchbase/operations/query_index_create.hxx +3 -3
  52. data/ext/couchbase/operations/query_index_drop.hxx +3 -3
  53. data/ext/couchbase/operations/query_index_get_all.hxx +3 -3
  54. data/ext/couchbase/operations/scope_create.hxx +4 -2
  55. data/ext/couchbase/operations/scope_drop.hxx +4 -2
  56. data/ext/couchbase/operations/scope_get_all.hxx +4 -2
  57. data/ext/couchbase/operations/search_index_analyze_document.hxx +2 -2
  58. data/ext/couchbase/operations/search_index_control_ingest.hxx +2 -2
  59. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +2 -2
  60. data/ext/couchbase/operations/search_index_control_query.hxx +2 -2
  61. data/ext/couchbase/operations/search_index_drop.hxx +2 -2
  62. data/ext/couchbase/operations/search_index_get.hxx +2 -2
  63. data/ext/couchbase/operations/search_index_get_all.hxx +2 -2
  64. data/ext/couchbase/operations/search_index_get_documents_count.hxx +2 -2
  65. data/ext/couchbase/operations/search_index_upsert.hxx +2 -2
  66. data/ext/couchbase/origin.hxx +148 -0
  67. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +1 -6
  68. data/ext/couchbase/protocol/cmd_decrement.hxx +5 -5
  69. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +5 -5
  70. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +1 -6
  71. data/ext/couchbase/protocol/cmd_increment.hxx +5 -5
  72. data/ext/couchbase/protocol/cmd_info.hxx +0 -11
  73. data/ext/couchbase/protocol/cmd_insert.hxx +5 -5
  74. data/ext/couchbase/protocol/cmd_mutate_in.hxx +6 -6
  75. data/ext/couchbase/protocol/cmd_replace.hxx +5 -5
  76. data/ext/couchbase/protocol/cmd_touch.hxx +1 -1
  77. data/ext/couchbase/protocol/cmd_upsert.hxx +5 -5
  78. data/ext/couchbase/timeout_defaults.hxx +7 -0
  79. data/ext/couchbase/utils/connection_string.hxx +139 -0
  80. data/ext/extconf.rb +44 -11
  81. data/ext/test/main.cxx +93 -15
  82. data/ext/third_party/http_parser/Makefile +160 -0
  83. data/ext/third_party/json/Makefile +77 -0
  84. data/lib/couchbase/analytics_options.rb +18 -4
  85. data/lib/couchbase/binary_collection.rb +2 -2
  86. data/lib/couchbase/binary_collection_options.rb +2 -2
  87. data/lib/couchbase/bucket.rb +4 -4
  88. data/lib/couchbase/cluster.rb +60 -46
  89. data/lib/couchbase/collection.rb +13 -13
  90. data/lib/couchbase/collection_options.rb +15 -9
  91. data/{bin/console → lib/couchbase/datastructures.rb} +4 -7
  92. data/lib/couchbase/datastructures/couchbase_list.rb +171 -0
  93. data/lib/couchbase/datastructures/couchbase_map.rb +205 -0
  94. data/lib/couchbase/datastructures/couchbase_queue.rb +145 -0
  95. data/lib/couchbase/datastructures/couchbase_set.rb +138 -0
  96. data/lib/couchbase/errors.rb +66 -63
  97. data/lib/couchbase/libcouchbase.bundle +0 -0
  98. data/lib/couchbase/management/user_manager.rb +1 -1
  99. data/lib/couchbase/mutation_state.rb +1 -0
  100. data/lib/couchbase/query_options.rb +25 -2
  101. data/lib/couchbase/scope.rb +0 -7
  102. data/lib/couchbase/search_options.rb +7 -0
  103. data/lib/couchbase/version.rb +1 -1
  104. data/lib/couchbase/view_options.rb +4 -3
  105. metadata +20 -82
  106. data/.github/workflows/tests-6.0.3.yml +0 -52
  107. data/.github/workflows/tests-dev-preview.yml +0 -55
  108. data/.github/workflows/tests.yml +0 -50
  109. data/.gitignore +0 -20
  110. data/.gitmodules +0 -21
  111. data/.idea/.gitignore +0 -5
  112. data/.idea/dictionaries/gem_terms.xml +0 -18
  113. data/.idea/inspectionProfiles/Project_Default.xml +0 -8
  114. data/.idea/vcs.xml +0 -13
  115. data/bin/check-cluster +0 -31
  116. data/bin/fetch-stats +0 -19
  117. data/bin/init-cluster +0 -82
  118. data/bin/jenkins/build-extension +0 -35
  119. data/bin/jenkins/install-dependencies +0 -47
  120. data/bin/jenkins/test-with-cbdyncluster +0 -58
  121. data/bin/setup +0 -24
  122. data/ext/couchbase/configuration_monitor.hxx +0 -93
  123. data/ext/couchbase/operations/command.hxx +0 -163
  124. data/rbi/couchbase.rbi +0 -79
@@ -39,7 +39,7 @@ struct decrement_request {
39
39
  document_id id;
40
40
  std::uint16_t partition{};
41
41
  std::uint32_t opaque{};
42
- std::uint32_t expiration{ 0 };
42
+ std::uint32_t expiry{ 0 };
43
43
  std::uint64_t delta{ 1 };
44
44
  std::optional<std::uint64_t> initial_value{};
45
45
  protocol::durability_level durability_level{ protocol::durability_level::none };
@@ -54,10 +54,10 @@ struct decrement_request {
54
54
  encoded.body().delta(delta);
55
55
  if (initial_value) {
56
56
  encoded.body().initial_value(initial_value.value());
57
- encoded.body().expiration(expiration);
57
+ encoded.body().expiry(expiry);
58
58
  } else {
59
59
  encoded.body().initial_value(0);
60
- encoded.body().expiration(0xffff'ffff);
60
+ encoded.body().expiry(0xffff'ffff);
61
61
  }
62
62
  if (durability_level != protocol::durability_level::none) {
63
63
  encoded.body().durability(durability_level, durability_timeout);
@@ -69,6 +69,9 @@ decrement_response
69
69
  make_response(std::error_code ec, decrement_request& request, decrement_request::encoded_response_type encoded)
70
70
  {
71
71
  decrement_response response{ request.id, encoded.opaque(), ec };
72
+ if (ec && response.opaque == 0) {
73
+ response.opaque = request.opaque;
74
+ }
72
75
  if (!ec) {
73
76
  response.cas = encoded.cas();
74
77
  response.content = encoded.body().content();
@@ -53,6 +53,9 @@ get_response
53
53
  make_response(std::error_code ec, get_request& request, get_request::encoded_response_type encoded)
54
54
  {
55
55
  get_response response{ request.id, encoded.opaque(), ec };
56
+ if (ec && response.opaque == 0) {
57
+ response.opaque = request.opaque;
58
+ }
56
59
  if (!ec) {
57
60
  response.value = std::move(encoded.body().value());
58
61
  response.cas = encoded.cas();
@@ -55,6 +55,9 @@ get_and_lock_response
55
55
  make_response(std::error_code ec, get_and_lock_request& request, get_and_lock_request::encoded_response_type encoded)
56
56
  {
57
57
  get_and_lock_response response{ request.id, encoded.opaque(), ec };
58
+ if (ec && response.opaque == 0) {
59
+ response.opaque = request.opaque;
60
+ }
58
61
  if (!ec) {
59
62
  response.value = std::move(encoded.body().value());
60
63
  response.cas = encoded.cas();
@@ -39,7 +39,7 @@ struct get_and_touch_request {
39
39
  document_id id;
40
40
  uint16_t partition{};
41
41
  uint32_t opaque{};
42
- uint32_t expiration{};
42
+ uint32_t expiry{};
43
43
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_timeout };
44
44
 
45
45
  void encode_to(encoded_request_type& encoded)
@@ -47,7 +47,7 @@ struct get_and_touch_request {
47
47
  encoded.opaque(opaque);
48
48
  encoded.partition(partition);
49
49
  encoded.body().id(id);
50
- encoded.body().expiration(expiration);
50
+ encoded.body().expiry(expiry);
51
51
  }
52
52
  };
53
53
 
@@ -55,6 +55,9 @@ get_and_touch_response
55
55
  make_response(std::error_code ec, get_and_touch_request& request, get_and_touch_request::encoded_response_type encoded)
56
56
  {
57
57
  get_and_touch_response response{ request.id, encoded.opaque(), ec };
58
+ if (ec && response.opaque == 0) {
59
+ response.opaque = request.opaque;
60
+ }
58
61
  if (!ec) {
59
62
  response.value = std::move(encoded.body().value());
60
63
  response.cas = encoded.cas();
@@ -30,7 +30,7 @@ struct get_projected_response {
30
30
  std::string value{};
31
31
  std::uint64_t cas{};
32
32
  std::uint32_t flags{};
33
- std::optional<std::uint32_t> expiration{};
33
+ std::optional<std::uint32_t> expiry{};
34
34
  };
35
35
 
36
36
  struct get_projected_request {
@@ -41,7 +41,7 @@ struct get_projected_request {
41
41
  std::uint16_t partition{};
42
42
  std::uint32_t opaque{};
43
43
  std::vector<std::string> projections{};
44
- bool with_expiration{ false };
44
+ bool with_expiry{ false };
45
45
  std::vector<std::string> effective_projections{};
46
46
  bool preserve_array_indexes{ false };
47
47
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_timeout };
@@ -54,7 +54,7 @@ struct get_projected_request {
54
54
 
55
55
  effective_projections = projections;
56
56
  std::size_t num_projections = effective_projections.size();
57
- if (with_expiration) {
57
+ if (with_expiry) {
58
58
  num_projections++;
59
59
  }
60
60
  if (num_projections > 16) {
@@ -63,7 +63,7 @@ struct get_projected_request {
63
63
  }
64
64
 
65
65
  protocol::lookup_in_request_body::lookup_in_specs specs{};
66
- if (with_expiration) {
66
+ if (with_expiry) {
67
67
  specs.add_spec(protocol::subdoc_opcode::get, true, "$document.exptime");
68
68
  }
69
69
  if (effective_projections.empty()) {
@@ -198,18 +198,21 @@ get_projected_response
198
198
  make_response(std::error_code ec, get_projected_request& request, get_projected_request::encoded_response_type encoded)
199
199
  {
200
200
  get_projected_response response{ request.id, encoded.opaque(), ec };
201
+ if (ec && response.opaque == 0) {
202
+ response.opaque = request.opaque;
203
+ }
201
204
  if (!ec) {
202
205
  response.cas = encoded.cas();
203
- if (request.with_expiration) {
204
- response.expiration = gsl::narrow_cast<std::uint32_t>(std::stoul(encoded.body().fields()[0].value));
206
+ if (request.with_expiry) {
207
+ response.expiry = gsl::narrow_cast<std::uint32_t>(std::stoul(encoded.body().fields()[0].value));
205
208
  }
206
209
  if (request.effective_projections.empty()) {
207
210
  // from full document
208
- if (request.projections.empty() && request.with_expiration) {
211
+ if (request.projections.empty() && request.with_expiry) {
209
212
  // special case when user only wanted full+expiration
210
213
  response.value = encoded.body().fields()[1].value;
211
214
  } else {
212
- tao::json::value full_doc = tao::json::from_string(encoded.body().fields()[request.with_expiration ? 1 : 0].value);
215
+ tao::json::value full_doc = tao::json::from_string(encoded.body().fields()[request.with_expiry ? 1 : 0].value);
213
216
  tao::json::value new_doc;
214
217
  for (const auto& projection : request.projections) {
215
218
  auto value_to_apply = priv::subdoc_lookup(full_doc, projection);
@@ -224,7 +227,7 @@ make_response(std::error_code ec, get_projected_request& request, get_projected_
224
227
  }
225
228
  } else {
226
229
  tao::json::value new_doc = tao::json::empty_object;
227
- std::size_t offset = request.with_expiration ? 1 : 0;
230
+ std::size_t offset = request.with_expiry ? 1 : 0;
228
231
  for (const auto& projection : request.projections) {
229
232
  auto& field = encoded.body().fields()[offset++];
230
233
  if (field.status == protocol::status::success && !field.value.empty()) {
@@ -41,7 +41,7 @@ struct increment_request {
41
41
  document_id id;
42
42
  std::uint16_t partition{};
43
43
  std::uint32_t opaque{};
44
- std::uint32_t expiration{ 0 };
44
+ std::uint32_t expiry{ 0 };
45
45
  std::uint64_t delta{ 1 };
46
46
  std::optional<std::uint64_t> initial_value{};
47
47
  protocol::durability_level durability_level{ protocol::durability_level::none };
@@ -56,10 +56,10 @@ struct increment_request {
56
56
  encoded.body().delta(delta);
57
57
  if (initial_value) {
58
58
  encoded.body().initial_value(initial_value.value());
59
- encoded.body().expiration(expiration);
59
+ encoded.body().expiry(expiry);
60
60
  } else {
61
61
  encoded.body().initial_value(0);
62
- encoded.body().expiration(0xffff'ffff);
62
+ encoded.body().expiry(0xffff'ffff);
63
63
  }
64
64
  if (durability_level != protocol::durability_level::none) {
65
65
  encoded.body().durability(durability_level, durability_timeout);
@@ -71,6 +71,9 @@ increment_response
71
71
  make_response(std::error_code ec, increment_request& request, increment_request::encoded_response_type encoded)
72
72
  {
73
73
  increment_response response{ request.id, encoded.opaque(), ec };
74
+ if (ec && response.opaque == 0) {
75
+ response.opaque = request.opaque;
76
+ }
74
77
  if (!ec) {
75
78
  response.cas = encoded.cas();
76
79
  response.content = encoded.body().content();
@@ -41,7 +41,7 @@ struct insert_request {
41
41
  uint16_t partition{};
42
42
  uint32_t opaque{};
43
43
  uint32_t flags{ 0 };
44
- uint32_t expiration{ 0 };
44
+ uint32_t expiry{ 0 };
45
45
  protocol::durability_level durability_level{ protocol::durability_level::none };
46
46
  std::optional<std::uint16_t> durability_timeout{};
47
47
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_timeout };
@@ -51,7 +51,7 @@ struct insert_request {
51
51
  encoded.opaque(opaque);
52
52
  encoded.partition(partition);
53
53
  encoded.body().id(id);
54
- encoded.body().expiration(expiration);
54
+ encoded.body().expiry(expiry);
55
55
  encoded.body().flags(flags);
56
56
  encoded.body().content(value);
57
57
  if (durability_level != protocol::durability_level::none) {
@@ -64,6 +64,9 @@ insert_response
64
64
  make_response(std::error_code ec, insert_request& request, insert_request::encoded_response_type encoded)
65
65
  {
66
66
  insert_response response{ request.id, encoded.opaque(), ec };
67
+ if (ec && response.opaque == 0) {
68
+ response.opaque = request.opaque;
69
+ }
67
70
  if (!ec) {
68
71
  response.cas = encoded.cas();
69
72
  response.token = encoded.body().token();
@@ -77,6 +77,9 @@ lookup_in_response
77
77
  make_response(std::error_code ec, lookup_in_request& request, lookup_in_request::encoded_response_type encoded)
78
78
  {
79
79
  lookup_in_response response{ request.id, encoded.opaque(), ec };
80
+ if (ec && response.opaque == 0) {
81
+ response.opaque = request.opaque;
82
+ }
80
83
  if (!ec) {
81
84
  response.cas = encoded.cas();
82
85
  response.fields.resize(request.specs.entries.size());
@@ -59,7 +59,7 @@ struct mutate_in_request {
59
59
  uint32_t opaque{};
60
60
  uint64_t cas{ 0 };
61
61
  bool access_deleted{ false };
62
- std::optional<std::uint32_t> expiration{};
62
+ std::optional<std::uint32_t> expiry{};
63
63
  protocol::mutate_in_request_body::store_semantics_type store_semantics{
64
64
  protocol::mutate_in_request_body::store_semantics_type::replace
65
65
  };
@@ -86,8 +86,8 @@ struct mutate_in_request {
86
86
  encoded.partition(partition);
87
87
  encoded.body().id(id);
88
88
  encoded.cas(cas);
89
- if (expiration) {
90
- encoded.body().expiration(*expiration);
89
+ if (expiry) {
90
+ encoded.body().expiry(*expiry);
91
91
  }
92
92
  encoded.body().access_deleted(access_deleted);
93
93
  encoded.body().store_semantics(store_semantics);
@@ -102,6 +102,9 @@ mutate_in_response
102
102
  make_response(std::error_code ec, mutate_in_request& request, mutate_in_request::encoded_response_type encoded)
103
103
  {
104
104
  mutate_in_response response{ request.id, encoded.opaque(), ec };
105
+ if (ec && response.opaque == 0) {
106
+ response.opaque = request.opaque;
107
+ }
105
108
  if (!ec) {
106
109
  response.cas = encoded.cas();
107
110
  response.token = encoded.body().token();
@@ -57,6 +57,9 @@ remove_response
57
57
  make_response(std::error_code ec, remove_request& request, remove_request::encoded_response_type encoded)
58
58
  {
59
59
  remove_response response{ request.id, encoded.opaque(), ec };
60
+ if (ec && response.opaque == 0) {
61
+ response.opaque = request.opaque;
62
+ }
60
63
  if (!ec) {
61
64
  response.cas = encoded.cas();
62
65
  response.token = encoded.body().token();
@@ -41,7 +41,7 @@ struct replace_request {
41
41
  uint16_t partition{};
42
42
  uint32_t opaque{};
43
43
  uint32_t flags{ 0 };
44
- uint32_t expiration{ 0 };
44
+ uint32_t expiry{ 0 };
45
45
  uint64_t cas{ 0 };
46
46
  protocol::durability_level durability_level{ protocol::durability_level::none };
47
47
  std::optional<std::uint16_t> durability_timeout{};
@@ -53,7 +53,7 @@ struct replace_request {
53
53
  encoded.partition(partition);
54
54
  encoded.cas(cas);
55
55
  encoded.body().id(id);
56
- encoded.body().expiration(expiration);
56
+ encoded.body().expiry(expiry);
57
57
  encoded.body().flags(flags);
58
58
  encoded.body().content(value);
59
59
  if (durability_level != protocol::durability_level::none) {
@@ -66,6 +66,9 @@ replace_response
66
66
  make_response(std::error_code ec, replace_request& request, replace_request::encoded_response_type encoded)
67
67
  {
68
68
  replace_response response{ request.id, encoded.opaque(), ec };
69
+ if (ec && response.opaque == 0) {
70
+ response.opaque = request.opaque;
71
+ }
69
72
  if (!ec) {
70
73
  response.cas = encoded.cas();
71
74
  response.token = encoded.body().token();
@@ -59,20 +59,20 @@ struct search_response {
59
59
 
60
60
  struct search_facet {
61
61
  struct term_facet {
62
- std::string term;
63
- std::uint64_t count;
62
+ std::string term{};
63
+ std::uint64_t count{};
64
64
  };
65
65
 
66
66
  struct date_range_facet {
67
- std::string name;
68
- std::uint64_t count;
67
+ std::string name{};
68
+ std::uint64_t count{};
69
69
  std::optional<std::string> start{};
70
70
  std::optional<std::string> end{};
71
71
  };
72
72
 
73
73
  struct numeric_range_facet {
74
- std::string name;
75
- std::uint64_t count;
74
+ std::string name{};
75
+ std::uint64_t count{};
76
76
  std::variant<std::monostate, std::uint64_t, double> min{};
77
77
  std::variant<std::monostate, std::uint64_t, double> max{};
78
78
  };
@@ -189,7 +189,6 @@ struct search_request {
189
189
 
190
190
  encoded.type = type;
191
191
  encoded.headers["content-type"] = "application/json";
192
- encoded.headers["client-context-id"] = client_context_id;
193
192
  encoded.method = "POST";
194
193
  encoded.path = fmt::format("/api/index/{}/query", index_name);
195
194
  encoded.body = tao::json::to_string(body);
@@ -37,7 +37,7 @@ struct touch_request {
37
37
  document_id id;
38
38
  std::uint16_t partition{};
39
39
  std::uint32_t opaque{};
40
- std::uint32_t expiration{};
40
+ std::uint32_t expiry{};
41
41
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_timeout };
42
42
 
43
43
  void encode_to(encoded_request_type& encoded)
@@ -45,7 +45,7 @@ struct touch_request {
45
45
  encoded.opaque(opaque);
46
46
  encoded.partition(partition);
47
47
  encoded.body().id(id);
48
- encoded.body().expiration(expiration);
48
+ encoded.body().expiry(expiry);
49
49
  }
50
50
  };
51
51
 
@@ -53,6 +53,9 @@ touch_response
53
53
  make_response(std::error_code ec, touch_request& request, touch_request::encoded_response_type encoded)
54
54
  {
55
55
  touch_response response{ request.id, encoded.opaque(), ec };
56
+ if (ec && response.opaque == 0) {
57
+ response.opaque = request.opaque;
58
+ }
56
59
  if (!ec) {
57
60
  response.cas = encoded.cas();
58
61
  }
@@ -53,6 +53,9 @@ unlock_response
53
53
  make_response(std::error_code ec, unlock_request& request, unlock_request::encoded_response_type encoded)
54
54
  {
55
55
  unlock_response response{ request.id, encoded.opaque(), ec };
56
+ if (ec && response.opaque == 0) {
57
+ response.opaque = request.opaque;
58
+ }
56
59
  if (!ec) {
57
60
  response.cas = encoded.cas();
58
61
  }
@@ -41,7 +41,7 @@ struct upsert_request {
41
41
  uint16_t partition{};
42
42
  uint32_t opaque{};
43
43
  uint32_t flags{ 0 };
44
- uint32_t expiration{ 0 };
44
+ uint32_t expiry{ 0 };
45
45
  protocol::durability_level durability_level{ protocol::durability_level::none };
46
46
  std::optional<std::uint16_t> durability_timeout{};
47
47
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_timeout };
@@ -51,7 +51,7 @@ struct upsert_request {
51
51
  encoded.opaque(opaque);
52
52
  encoded.partition(partition);
53
53
  encoded.body().id(id);
54
- encoded.body().expiration(expiration);
54
+ encoded.body().expiry(expiry);
55
55
  encoded.body().flags(flags);
56
56
  encoded.body().content(value);
57
57
  if (durability_level != protocol::durability_level::none) {
@@ -64,6 +64,9 @@ upsert_response
64
64
  make_response(std::error_code ec, upsert_request& request, upsert_request::encoded_response_type encoded)
65
65
  {
66
66
  upsert_response response{ request.id, encoded.opaque(), ec };
67
+ if (ec && response.opaque == 0) {
68
+ response.opaque = request.opaque;
69
+ }
67
70
  if (!ec) {
68
71
  response.cas = encoded.cas();
69
72
  response.token = encoded.body().token();
@@ -28,7 +28,7 @@ struct query_index_build_deferred_response {
28
28
  std::uint64_t code;
29
29
  std::string message;
30
30
  };
31
- uuid::uuid_t client_context_id;
31
+ std::string client_context_id;
32
32
  std::error_code ec;
33
33
  std::string status{};
34
34
  std::vector<query_problem> errors{};
@@ -41,7 +41,7 @@ struct query_index_build_deferred_request {
41
41
 
42
42
  static const inline service_type type = service_type::query;
43
43
 
44
- uuid::uuid_t client_context_id{ uuid::random() };
44
+ std::string client_context_id{ uuid::to_string(uuid::random()) };
45
45
  std::string bucket_name;
46
46
  std::chrono::milliseconds timeout{ timeout_defaults::management_timeout };
47
47
 
@@ -53,7 +53,7 @@ struct query_index_build_deferred_request {
53
53
  fmt::format(R"(BUILD INDEX ON `{}` ((SELECT RAW name FROM system:indexes WHERE keyspace_id = "{}" AND state = "deferred")))",
54
54
  bucket_name,
55
55
  bucket_name) },
56
- { "client_context_id", uuid::to_string(client_context_id) }
56
+ { "client_context_id", client_context_id }
57
57
  };
58
58
  encoded.method = "POST";
59
59
  encoded.path = "/query/service";
@@ -28,7 +28,7 @@ struct query_index_create_response {
28
28
  std::uint64_t code;
29
29
  std::string message;
30
30
  };
31
- uuid::uuid_t client_context_id;
31
+ std::string client_context_id;
32
32
  std::error_code ec;
33
33
  std::string status{};
34
34
  std::vector<query_problem> errors{};
@@ -41,7 +41,7 @@ struct query_index_create_request {
41
41
 
42
42
  static const inline service_type type = service_type::query;
43
43
 
44
- uuid::uuid_t client_context_id{ uuid::random() };
44
+ std::string client_context_id{ uuid::to_string(uuid::random()) };
45
45
  std::string bucket_name;
46
46
  std::string index_name{};
47
47
  std::vector<std::string> fields;
@@ -81,7 +81,7 @@ struct query_index_create_request {
81
81
  fmt::join(fields, ", "),
82
82
  where_clause,
83
83
  with_clause) },
84
- { "client_context_id", uuid::to_string(client_context_id) } };
84
+ { "client_context_id", client_context_id } };
85
85
  encoded.method = "POST";
86
86
  encoded.path = "/query/service";
87
87
  encoded.body = tao::json::to_string(body);
@@ -28,7 +28,7 @@ struct query_index_drop_response {
28
28
  std::uint64_t code;
29
29
  std::string message;
30
30
  };
31
- uuid::uuid_t client_context_id;
31
+ std::string client_context_id;
32
32
  std::error_code ec;
33
33
  std::string status{};
34
34
  std::vector<query_problem> errors{};
@@ -41,7 +41,7 @@ struct query_index_drop_request {
41
41
 
42
42
  static const inline service_type type = service_type::query;
43
43
 
44
- uuid::uuid_t client_context_id{ uuid::random() };
44
+ std::string client_context_id{ uuid::to_string(uuid::random()) };
45
45
  std::string bucket_name;
46
46
  std::string index_name;
47
47
  bool is_primary{ false };
@@ -54,7 +54,7 @@ struct query_index_drop_request {
54
54
  tao::json::value body{ { "statement",
55
55
  is_primary ? fmt::format(R"(DROP PRIMARY INDEX ON `{}` USING GSI)", bucket_name)
56
56
  : fmt::format(R"(DROP INDEX `{}`.`{}` USING GSI)", bucket_name, index_name) },
57
- { "client_context_id", uuid::to_string(client_context_id) } };
57
+ { "client_context_id", client_context_id } };
58
58
  encoded.method = "POST";
59
59
  encoded.path = "/query/service";
60
60
  encoded.body = tao::json::to_string(body);