couchbase 3.4.1 → 3.4.3

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 (278) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/couchbase/CMakeLists.txt +59 -7
  4. data/ext/couchbase/cmake/Documentation.cmake +0 -1
  5. data/ext/couchbase/cmake/OpenSSL.cmake +98 -3
  6. data/ext/couchbase/cmake/Testing.cmake +12 -4
  7. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
  8. data/ext/couchbase/cmake/build_config.hxx.in +3 -0
  9. data/ext/couchbase/core/bucket.cxx +3 -2
  10. data/ext/couchbase/core/bucket.hxx +9 -0
  11. data/ext/couchbase/core/cluster.hxx +17 -0
  12. data/ext/couchbase/core/cluster_options.cxx +2 -2
  13. data/ext/couchbase/core/cluster_options.hxx +4 -7
  14. data/ext/couchbase/core/{config_profile.cxx → cluster_options_fwd.hxx} +7 -6
  15. data/ext/couchbase/core/config_profile.hxx +2 -65
  16. data/ext/couchbase/core/config_profiles.cxx +79 -0
  17. data/ext/couchbase/core/config_profiles.hxx +56 -0
  18. data/ext/couchbase/core/error_context/search.hxx +1 -1
  19. data/ext/couchbase/core/impl/analytics.cxx +237 -0
  20. data/ext/couchbase/core/impl/boolean_field_query.cxx +40 -0
  21. data/ext/couchbase/core/impl/boolean_query.cxx +62 -0
  22. data/ext/couchbase/core/impl/cluster.cxx +2 -1
  23. data/ext/couchbase/core/impl/conjunction_query.cxx +51 -0
  24. data/ext/couchbase/core/impl/date_range.cxx +89 -0
  25. data/ext/couchbase/core/impl/date_range_facet.cxx +54 -0
  26. data/ext/couchbase/core/impl/date_range_facet_result.cxx +64 -0
  27. data/ext/couchbase/core/impl/date_range_query.cxx +125 -0
  28. data/ext/couchbase/core/impl/disjunction_query.cxx +51 -0
  29. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
  30. data/ext/couchbase/core/impl/encoded_search_facet.hxx +29 -0
  31. data/ext/couchbase/core/impl/encoded_search_query.hxx +29 -0
  32. data/ext/couchbase/core/impl/encoded_search_sort.hxx +29 -0
  33. data/ext/couchbase/core/impl/geo_bounding_box_query.cxx +46 -0
  34. data/ext/couchbase/core/impl/geo_distance_query.cxx +43 -0
  35. data/ext/couchbase/core/impl/geo_polygon_query.cxx +46 -0
  36. data/ext/couchbase/core/impl/internal_date_range_facet_result.cxx +80 -0
  37. data/ext/couchbase/core/impl/internal_date_range_facet_result.hxx +48 -0
  38. data/ext/couchbase/core/impl/internal_numeric_range_facet_result.cxx +80 -0
  39. data/ext/couchbase/core/impl/internal_numeric_range_facet_result.hxx +48 -0
  40. data/ext/couchbase/core/impl/internal_search_error_context.cxx +141 -0
  41. data/ext/couchbase/core/impl/internal_search_error_context.hxx +61 -0
  42. data/ext/couchbase/core/impl/internal_search_meta_data.cxx +60 -0
  43. data/ext/couchbase/core/impl/internal_search_meta_data.hxx +41 -0
  44. data/ext/couchbase/core/impl/internal_search_result.cxx +84 -0
  45. data/ext/couchbase/core/impl/internal_search_result.hxx +43 -0
  46. data/ext/couchbase/core/impl/internal_search_row.cxx +82 -0
  47. data/ext/couchbase/core/impl/internal_search_row.hxx +56 -0
  48. data/ext/couchbase/core/impl/internal_search_row_location.hxx +32 -0
  49. data/ext/couchbase/core/impl/internal_search_row_locations.cxx +137 -0
  50. data/ext/couchbase/core/impl/internal_search_row_locations.hxx +45 -0
  51. data/ext/couchbase/core/impl/internal_term_facet_result.cxx +80 -0
  52. data/ext/couchbase/core/impl/internal_term_facet_result.hxx +48 -0
  53. data/ext/couchbase/core/impl/match_all_query.cxx +35 -0
  54. data/ext/couchbase/core/impl/match_none_query.cxx +35 -0
  55. data/ext/couchbase/core/impl/match_phrase_query.cxx +43 -0
  56. data/ext/couchbase/core/impl/match_query.cxx +59 -0
  57. data/ext/couchbase/core/impl/numeric_range.cxx +49 -0
  58. data/ext/couchbase/core/impl/numeric_range_facet.cxx +54 -0
  59. data/ext/couchbase/core/impl/numeric_range_facet_result.cxx +64 -0
  60. data/ext/couchbase/core/impl/numeric_range_query.cxx +56 -0
  61. data/ext/couchbase/core/impl/phrase_query.cxx +42 -0
  62. data/ext/couchbase/core/impl/prefix_query.cxx +40 -0
  63. data/ext/couchbase/core/impl/query.cxx +5 -5
  64. data/ext/couchbase/core/impl/query_string_query.cxx +37 -0
  65. data/ext/couchbase/core/impl/regexp_query.cxx +40 -0
  66. data/ext/couchbase/core/impl/search.cxx +191 -0
  67. data/ext/couchbase/core/impl/search_error_context.cxx +147 -0
  68. data/ext/couchbase/core/impl/search_meta_data.cxx +46 -0
  69. data/ext/couchbase/core/impl/search_result.cxx +66 -0
  70. data/ext/couchbase/core/impl/search_row.cxx +74 -0
  71. data/ext/couchbase/core/impl/search_row_location.cxx +64 -0
  72. data/ext/couchbase/core/impl/search_row_locations.cxx +66 -0
  73. data/ext/couchbase/core/impl/search_sort_field.cxx +104 -0
  74. data/ext/couchbase/core/impl/search_sort_id.cxx +43 -0
  75. data/ext/couchbase/core/impl/search_sort_score.cxx +43 -0
  76. data/ext/couchbase/core/impl/term_facet.cxx +36 -0
  77. data/ext/couchbase/core/impl/term_facet_result.cxx +64 -0
  78. data/ext/couchbase/core/impl/term_query.cxx +56 -0
  79. data/ext/couchbase/core/impl/term_range_query.cxx +57 -0
  80. data/ext/couchbase/core/impl/wildcard_query.cxx +40 -0
  81. data/ext/couchbase/core/io/dns_client.cxx +225 -0
  82. data/ext/couchbase/core/io/dns_client.hxx +19 -188
  83. data/ext/couchbase/core/io/http_context.hxx +1 -1
  84. data/ext/couchbase/core/io/http_session.hxx +10 -0
  85. data/ext/couchbase/core/io/http_session_manager.hxx +5 -3
  86. data/ext/couchbase/core/io/mcbp_session.cxx +28 -1
  87. data/ext/couchbase/core/io/retry_orchestrator.hxx +3 -2
  88. data/ext/couchbase/core/json_string.hxx +5 -0
  89. data/ext/couchbase/core/meta/version.cxx +18 -4
  90. data/ext/couchbase/core/mozilla_ca_bundle.hxx +39 -0
  91. data/ext/couchbase/core/operations/document_analytics.cxx +1 -0
  92. data/ext/couchbase/core/operations/document_analytics.hxx +1 -0
  93. data/ext/couchbase/core/operations/document_append.hxx +1 -1
  94. data/ext/couchbase/core/operations/document_decrement.hxx +1 -1
  95. data/ext/couchbase/core/operations/document_exists.hxx +1 -1
  96. data/ext/couchbase/core/operations/document_get.hxx +1 -1
  97. data/ext/couchbase/core/operations/document_get_and_lock.hxx +1 -1
  98. data/ext/couchbase/core/operations/document_get_and_touch.hxx +1 -1
  99. data/ext/couchbase/core/operations/document_get_projected.hxx +1 -1
  100. data/ext/couchbase/core/operations/document_increment.hxx +1 -1
  101. data/ext/couchbase/core/operations/document_insert.hxx +1 -1
  102. data/ext/couchbase/core/operations/document_lookup_in.hxx +1 -1
  103. data/ext/couchbase/core/operations/document_mutate_in.hxx +1 -1
  104. data/ext/couchbase/core/operations/document_prepend.hxx +1 -1
  105. data/ext/couchbase/core/operations/document_query.cxx +2 -0
  106. data/ext/couchbase/core/operations/document_query.hxx +6 -0
  107. data/ext/couchbase/core/operations/document_remove.hxx +1 -1
  108. data/ext/couchbase/core/operations/document_replace.hxx +1 -1
  109. data/ext/couchbase/core/operations/document_search.cxx +4 -1
  110. data/ext/couchbase/core/operations/document_search.hxx +2 -1
  111. data/ext/couchbase/core/operations/document_touch.hxx +1 -1
  112. data/ext/couchbase/core/operations/document_unlock.hxx +1 -1
  113. data/ext/couchbase/core/operations/document_upsert.hxx +1 -1
  114. data/ext/couchbase/core/operations/document_view.hxx +1 -0
  115. data/ext/couchbase/core/protocol/client_request.hxx +11 -2
  116. data/ext/couchbase/core/public_fwd.hxx +21 -0
  117. data/ext/couchbase/core/tls_verify_mode.hxx +26 -0
  118. data/ext/couchbase/core/topology/configuration.cxx +15 -2
  119. data/ext/couchbase/core/topology/configuration.hxx +5 -1
  120. data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
  121. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +3 -0
  122. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +1 -1
  123. data/ext/couchbase/core/transactions/attempt_context_testing_hooks.cxx +93 -0
  124. data/ext/couchbase/core/transactions/attempt_context_testing_hooks.hxx +48 -75
  125. data/ext/couchbase/core/transactions/cleanup_testing_hooks.cxx +52 -0
  126. data/ext/couchbase/core/transactions/cleanup_testing_hooks.hxx +17 -31
  127. data/ext/couchbase/core/transactions/exceptions.hxx +12 -9
  128. data/ext/couchbase/core/transactions/internal/transaction_context.hxx +12 -12
  129. data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
  130. data/ext/couchbase/core/transactions/transaction_context.cxx +1 -0
  131. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
  132. data/ext/couchbase/core/utils/connection_string.cxx +27 -3
  133. data/ext/couchbase/core/utils/connection_string.hxx +3 -3
  134. data/ext/couchbase/core/utils/json.cxx +4 -1
  135. data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
  136. data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
  137. data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
  138. data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
  139. data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
  140. data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
  141. data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
  142. data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
  143. data/ext/couchbase/couchbase/behavior_options.hxx +10 -1
  144. data/ext/couchbase/couchbase/boolean_field_query.hxx +77 -0
  145. data/ext/couchbase/couchbase/boolean_query.hxx +223 -0
  146. data/ext/couchbase/couchbase/cluster.hxx +75 -1
  147. data/ext/couchbase/couchbase/conjunction_query.hxx +88 -0
  148. data/ext/couchbase/couchbase/date_range.hxx +69 -0
  149. data/ext/couchbase/couchbase/date_range_facet.hxx +56 -0
  150. data/ext/couchbase/couchbase/date_range_facet_result.hxx +55 -0
  151. data/ext/couchbase/couchbase/date_range_query.hxx +265 -0
  152. data/ext/couchbase/couchbase/disjunction_query.hxx +109 -0
  153. data/ext/couchbase/couchbase/doc_id_query.hxx +111 -0
  154. data/ext/couchbase/couchbase/error_context.hxx +7 -6
  155. data/ext/couchbase/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
  156. data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
  157. data/ext/couchbase/couchbase/fmt/search_scan_consistency.hxx +49 -0
  158. data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +107 -0
  159. data/ext/couchbase/couchbase/geo_distance_query.hxx +109 -0
  160. data/ext/couchbase/couchbase/geo_point.hxx +32 -0
  161. data/ext/couchbase/couchbase/geo_polygon_query.hxx +85 -0
  162. data/ext/couchbase/couchbase/highlight_style.hxx +45 -0
  163. data/ext/couchbase/couchbase/match_all_query.hxx +43 -0
  164. data/ext/couchbase/couchbase/match_none_query.hxx +43 -0
  165. data/ext/couchbase/couchbase/match_operator.hxx +45 -0
  166. data/ext/couchbase/couchbase/match_phrase_query.hxx +108 -0
  167. data/ext/couchbase/couchbase/match_query.hxx +163 -0
  168. data/ext/couchbase/couchbase/numeric_range.hxx +58 -0
  169. data/ext/couchbase/couchbase/numeric_range_facet.hxx +56 -0
  170. data/ext/couchbase/couchbase/numeric_range_facet_result.hxx +55 -0
  171. data/ext/couchbase/couchbase/numeric_range_query.hxx +143 -0
  172. data/ext/couchbase/couchbase/phrase_query.hxx +93 -0
  173. data/ext/couchbase/couchbase/prefix_query.hxx +82 -0
  174. data/ext/couchbase/couchbase/query_options.hxx +0 -1
  175. data/ext/couchbase/couchbase/query_string_query.hxx +72 -0
  176. data/ext/couchbase/couchbase/regexp_query.hxx +82 -0
  177. data/ext/couchbase/couchbase/scope.hxx +73 -0
  178. data/ext/couchbase/couchbase/search_date_range.hxx +68 -0
  179. data/ext/couchbase/couchbase/search_error_context.hxx +138 -0
  180. data/ext/couchbase/couchbase/search_facet.hxx +60 -0
  181. data/ext/couchbase/couchbase/search_facet_result.hxx +50 -0
  182. data/ext/couchbase/couchbase/search_meta_data.hxx +85 -0
  183. data/ext/couchbase/couchbase/search_metrics.hxx +127 -0
  184. data/ext/couchbase/couchbase/search_numeric_range.hxx +69 -0
  185. data/ext/couchbase/couchbase/search_options.hxx +509 -0
  186. data/ext/couchbase/couchbase/search_query.hxx +69 -0
  187. data/ext/couchbase/couchbase/search_result.hxx +77 -0
  188. data/ext/couchbase/couchbase/search_row.hxx +104 -0
  189. data/ext/couchbase/couchbase/search_row_location.hxx +55 -0
  190. data/ext/couchbase/couchbase/search_row_locations.hxx +86 -0
  191. data/ext/couchbase/couchbase/search_scan_consistency.hxx +34 -0
  192. data/ext/couchbase/couchbase/search_sort.hxx +58 -0
  193. data/ext/couchbase/couchbase/search_sort_field.hxx +117 -0
  194. data/ext/couchbase/couchbase/search_sort_field_missing.hxx +26 -0
  195. data/ext/couchbase/couchbase/search_sort_field_mode.hxx +27 -0
  196. data/ext/couchbase/couchbase/search_sort_field_type.hxx +28 -0
  197. data/ext/couchbase/couchbase/search_sort_id.hxx +60 -0
  198. data/ext/couchbase/couchbase/search_sort_score.hxx +60 -0
  199. data/ext/couchbase/couchbase/search_term_range.hxx +51 -0
  200. data/ext/couchbase/couchbase/security_options.hxx +3 -0
  201. data/ext/couchbase/couchbase/term_facet.hxx +48 -0
  202. data/ext/couchbase/couchbase/term_facet_result.hxx +55 -0
  203. data/ext/couchbase/couchbase/term_query.hxx +151 -0
  204. data/ext/couchbase/couchbase/term_range_query.hxx +142 -0
  205. data/ext/couchbase/couchbase/tracing/request_span.hxx +63 -0
  206. data/ext/couchbase/couchbase/tracing/request_tracer.hxx +2 -40
  207. data/ext/couchbase/couchbase/transactions/async_attempt_context.hxx +83 -4
  208. data/ext/couchbase/couchbase/transactions/attempt_context.hxx +68 -1
  209. data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +2 -0
  210. data/ext/couchbase/couchbase/transactions/transaction_keyspace.hxx +11 -1
  211. data/ext/couchbase/couchbase/transactions/transaction_options.hxx +79 -8
  212. data/ext/couchbase/couchbase/transactions/transaction_query_options.hxx +128 -15
  213. data/ext/couchbase/couchbase/transactions/transaction_query_result.hxx +4 -0
  214. data/ext/couchbase/couchbase/transactions/transaction_result.hxx +1 -1
  215. data/ext/couchbase/couchbase/transactions/transactions_cleanup_config.hxx +5 -3
  216. data/ext/couchbase/couchbase/transactions/transactions_config.hxx +9 -5
  217. data/ext/couchbase/couchbase/transactions/transactions_query_config.hxx +6 -3
  218. data/ext/couchbase/couchbase/transactions.hxx +34 -1
  219. data/ext/couchbase/couchbase/wildcard_query.hxx +83 -0
  220. data/ext/couchbase/test/CMakeLists.txt +8 -7
  221. data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
  222. data/ext/couchbase/test/test_helper.hxx +6 -6
  223. data/ext/couchbase/test/test_integration_analytics.cxx +314 -16
  224. data/ext/couchbase/test/test_integration_collections.cxx +7 -3
  225. data/ext/couchbase/test/test_integration_connect.cxx +7 -3
  226. data/ext/couchbase/test/test_integration_crud.cxx +19 -2
  227. data/ext/couchbase/test/test_integration_diagnostics.cxx +11 -5
  228. data/ext/couchbase/test/test_integration_durability.cxx +12 -7
  229. data/ext/couchbase/test/test_integration_examples.cxx +324 -11
  230. data/ext/couchbase/test/test_integration_management.cxx +162 -94
  231. data/ext/couchbase/test/test_integration_query.cxx +68 -10
  232. data/ext/couchbase/test/test_integration_range_scan.cxx +12 -12
  233. data/ext/couchbase/test/test_integration_read_replica.cxx +48 -11
  234. data/ext/couchbase/test/test_integration_search.cxx +621 -0
  235. data/ext/couchbase/test/test_integration_subdoc.cxx +62 -11
  236. data/ext/couchbase/test/test_integration_tracer.cxx +5 -0
  237. data/ext/couchbase/test/test_integration_transcoders.cxx +13 -5
  238. data/ext/couchbase/test/{test_transaction_transaction_context.cxx → test_transaction_context.cxx} +1 -1
  239. data/ext/couchbase/test/test_transaction_examples.cxx +195 -0
  240. data/ext/couchbase/test/{test_transaction_transaction_simple.cxx → test_transaction_simple.cxx} +90 -5
  241. data/ext/couchbase/test/{test_transaction_transaction_simple_async.cxx → test_transaction_simple_async.cxx} +19 -21
  242. data/ext/couchbase/test/test_unit_config_profiles.cxx +13 -13
  243. data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
  244. data/ext/couchbase/test/test_unit_json_transcoder.cxx +4 -0
  245. data/ext/couchbase/test/test_unit_search.cxx +427 -0
  246. data/ext/couchbase/test/test_unit_transaction_utils.cxx +10 -1
  247. data/ext/couchbase/test/test_unit_utils.cxx +8 -4
  248. data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
  249. data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
  250. data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
  251. data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
  252. data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
  253. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
  254. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
  255. data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
  256. data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
  257. data/ext/couchbase/third_party/snappy/snappy.h +19 -4
  258. data/ext/couchbase.cxx +85 -22
  259. data/ext/revisions.rb +3 -3
  260. data/lib/couchbase/authenticator.rb +0 -1
  261. data/lib/couchbase/cluster.rb +13 -13
  262. data/lib/couchbase/cluster_registry.rb +7 -2
  263. data/lib/couchbase/config_profiles.rb +1 -1
  264. data/lib/couchbase/configuration.rb +3 -4
  265. data/lib/couchbase/json_transcoder.rb +12 -5
  266. data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
  267. data/lib/couchbase/management/query_index_manager.rb +70 -5
  268. data/lib/couchbase/options.rb +85 -2
  269. data/lib/couchbase/raw_binary_transcoder.rb +37 -0
  270. data/lib/couchbase/raw_json_transcoder.rb +38 -0
  271. data/lib/couchbase/raw_string_transcoder.rb +40 -0
  272. data/lib/couchbase/search_options.rb +163 -240
  273. data/lib/couchbase/transcoder_flags.rb +62 -0
  274. data/lib/couchbase/version.rb +1 -1
  275. metadata +151 -12
  276. data/ext/couchbase/core/CMakeLists.txt +0 -0
  277. /data/ext/couchbase/test/{test_transaction_transaction_public_async_api.cxx → test_transaction_public_async_api.cxx} +0 -0
  278. /data/ext/couchbase/test/{test_transaction_transaction_public_blocking_api.cxx → test_transaction_public_blocking_api.cxx} +0 -0
@@ -39,7 +39,9 @@
39
39
  #ifndef THIRD_PARTY_SNAPPY_SNAPPY_H__
40
40
  #define THIRD_PARTY_SNAPPY_SNAPPY_H__
41
41
 
42
- #include <cstddef>
42
+ #include <stddef.h>
43
+ #include <stdint.h>
44
+
43
45
  #include <string>
44
46
 
45
47
  #include "snappy-stubs-public.h"
@@ -63,20 +65,27 @@ namespace snappy {
63
65
  // Also note that this leaves "*source" in a state that is unsuitable for
64
66
  // further operations, such as RawUncompress(). You will need to rewind
65
67
  // or recreate the source yourself before attempting any further calls.
66
- bool GetUncompressedLength(Source* source, uint32* result);
68
+ bool GetUncompressedLength(Source* source, uint32_t* result);
67
69
 
68
70
  // ------------------------------------------------------------------------
69
71
  // Higher-level string based routines (should be sufficient for most users)
70
72
  // ------------------------------------------------------------------------
71
73
 
72
- // Sets "*compressed" to the compressed version of "input[0,input_length-1]".
74
+ // Sets "*compressed" to the compressed version of "input[0..input_length-1]".
73
75
  // Original contents of *compressed are lost.
74
76
  //
75
77
  // REQUIRES: "input[]" is not an alias of "*compressed".
76
78
  size_t Compress(const char* input, size_t input_length,
77
79
  std::string* compressed);
78
80
 
79
- // Decompresses "compressed[0,compressed_length-1]" to "*uncompressed".
81
+ // Same as `Compress` above but taking an `iovec` array as input. Note that
82
+ // this function preprocesses the inputs to compute the sum of
83
+ // `iov[0..iov_cnt-1].iov_len` before reading. To avoid this, use
84
+ // `RawCompressFromIOVec` below.
85
+ size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt,
86
+ std::string* compressed);
87
+
88
+ // Decompresses "compressed[0..compressed_length-1]" to "*uncompressed".
80
89
  // Original contents of "*uncompressed" are lost.
81
90
  //
82
91
  // REQUIRES: "compressed[]" is not an alias of "*uncompressed".
@@ -122,6 +131,12 @@ namespace snappy {
122
131
  char* compressed,
123
132
  size_t* compressed_length);
124
133
 
134
+ // Same as `RawCompress` above but taking an `iovec` array as input. Note that
135
+ // `uncompressed_length` is the total number of bytes to be read from the
136
+ // elements of `iov` (_not_ the number of elements in `iov`).
137
+ void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length,
138
+ char* compressed, size_t* compressed_length);
139
+
125
140
  // Given data in "compressed[0..compressed_length-1]" generated by
126
141
  // calling the Snappy::Compress routine, this routine
127
142
  // stores the uncompressed data to
data/ext/couchbase.cxx CHANGED
@@ -270,9 +270,9 @@ init_versions(VALUE mCouchbase)
270
270
  VALUE cb_CoreInfo = rb_hash_new();
271
271
  for (const auto& [name, value] : couchbase::core::meta::sdk_build_info()) {
272
272
  if (name == "version_major" || name == "version_minor" || name == "version_patch" || name == "version_build" ||
273
- name == "__cplusplus" || name == "_MSC_VER") {
273
+ name == "__cplusplus" || name == "_MSC_VER" || name == "mozilla_ca_bundle_size") {
274
274
  rb_hash_aset(cb_CoreInfo, rb_id2sym(rb_intern(name.c_str())), INT2FIX(std::stoi(value)));
275
- } else if (name == "snapshot" || name == "static_stdlib" || name == "static_openssl") {
275
+ } else if (name == "snapshot" || name == "static_stdlib" || name == "static_openssl" || name == "mozilla_ca_bundle_embedded") {
276
276
  rb_hash_aset(cb_CoreInfo, rb_id2sym(rb_intern(name.c_str())), value == "true" ? Qtrue : Qfalse);
277
277
  } else {
278
278
  rb_hash_aset(cb_CoreInfo, rb_id2sym(rb_intern(name.c_str())), rb_str_freeze(rb_str_new_cstr(value.c_str())));
@@ -1253,9 +1253,7 @@ cb_map_error_code(const couchbase::core::error_context::search& ctx, const std::
1253
1253
  rb_hash_aset(error_context, rb_id2sym(rb_intern("error")), cb_str_new(error));
1254
1254
  rb_hash_aset(error_context, rb_id2sym(rb_intern("client_context_id")), cb_str_new(ctx.client_context_id));
1255
1255
  rb_hash_aset(error_context, rb_id2sym(rb_intern("index_name")), cb_str_new(ctx.index_name));
1256
- if (ctx.query) {
1257
- rb_hash_aset(error_context, rb_id2sym(rb_intern("query")), cb_str_new(ctx.query.value()));
1258
- }
1256
+ rb_hash_aset(error_context, rb_id2sym(rb_intern("query")), cb_str_new(ctx.query));
1259
1257
  if (ctx.parameters) {
1260
1258
  rb_hash_aset(error_context, rb_id2sym(rb_intern("parameters")), cb_str_new(ctx.parameters.value()));
1261
1259
  }
@@ -1592,7 +1590,7 @@ extract_durability_level(VALUE options)
1592
1590
  if (VALUE val = rb_hash_aref(options, property_name); !NIL_P(val)) {
1593
1591
  ID level = rb_sym2id(val);
1594
1592
  if (level == rb_intern("none")) {
1595
- return couchbase::durability_level::none;
1593
+ return {};
1596
1594
  }
1597
1595
  if (level == rb_intern("majority")) {
1598
1596
  return couchbase::durability_level::majority;
@@ -1615,7 +1613,7 @@ extract_legacy_durability_persist_to(VALUE options)
1615
1613
  if (VALUE val = rb_hash_aref(options, property_name); !NIL_P(val)) {
1616
1614
  ID mode = rb_sym2id(val);
1617
1615
  if (mode == rb_intern("none")) {
1618
- return couchbase::persist_to::none;
1616
+ return {};
1619
1617
  }
1620
1618
  if (mode == rb_intern("active")) {
1621
1619
  return couchbase::persist_to::active;
@@ -1644,7 +1642,7 @@ extract_legacy_durability_replicate_to(VALUE options)
1644
1642
  if (VALUE val = rb_hash_aref(options, property_name); !NIL_P(val)) {
1645
1643
  ID mode = rb_sym2id(val);
1646
1644
  if (mode == rb_intern("none")) {
1647
- return couchbase::replicate_to::none;
1645
+ return {};
1648
1646
  }
1649
1647
  if (mode == rb_intern("one")) {
1650
1648
  return couchbase::replicate_to::one;
@@ -1799,8 +1797,9 @@ cb_extract_cas(couchbase::cas& field, VALUE cas)
1799
1797
  }
1800
1798
  }
1801
1799
 
1800
+ template<typename Boolean>
1802
1801
  static void
1803
- cb_extract_option_bool(bool& field, VALUE options, const char* name)
1802
+ cb_extract_option_bool(Boolean& field, VALUE options, const char* name)
1804
1803
  {
1805
1804
  if (!NIL_P(options) && TYPE(options) == T_HASH) {
1806
1805
  VALUE val = rb_hash_aref(options, rb_id2sym(rb_intern(name)));
@@ -1820,8 +1819,9 @@ cb_extract_option_bool(bool& field, VALUE options, const char* name)
1820
1819
  }
1821
1820
  }
1822
1821
 
1822
+ template<typename Integer>
1823
1823
  static void
1824
- cb_extract_option_number(std::size_t& field, VALUE options, const char* name)
1824
+ cb_extract_option_number(Integer& field, VALUE options, const char* name)
1825
1825
  {
1826
1826
  if (!NIL_P(options) && TYPE(options) == T_HASH) {
1827
1827
  VALUE val = rb_hash_aref(options, rb_id2sym(rb_intern(name)));
@@ -1830,10 +1830,10 @@ cb_extract_option_number(std::size_t& field, VALUE options, const char* name)
1830
1830
  }
1831
1831
  switch (TYPE(val)) {
1832
1832
  case T_FIXNUM:
1833
- field = FIX2ULONG(val);
1833
+ field = static_cast<Integer>(FIX2ULONG(val));
1834
1834
  break;
1835
1835
  case T_BIGNUM:
1836
- field = NUM2ULL(val);
1836
+ field = static_cast<Integer>(NUM2ULL(val));
1837
1837
  break;
1838
1838
  default:
1839
1839
  throw ruby_exception(rb_eArgError, rb_sprintf("%s must be a Integer, but given %+" PRIsVALUE, name, val));
@@ -1884,6 +1884,25 @@ cb_extract_option_string(std::string& target, VALUE options, const char* name);
1884
1884
  static void
1885
1885
  cb_extract_option_symbol(VALUE& val, VALUE options, const char* name);
1886
1886
 
1887
+ static void
1888
+ cb_extract_dns_config(couchbase::core::io::dns::dns_config& config, VALUE options)
1889
+ {
1890
+ if (!NIL_P(options) && TYPE(options) == T_HASH) {
1891
+ return;
1892
+ }
1893
+
1894
+ auto timeout{ couchbase::core::timeout_defaults::dns_srv_timeout };
1895
+ cb_extract_option_milliseconds(timeout, options, "dns_srv_timeout");
1896
+
1897
+ std::string nameserver{ couchbase::core::io::dns::dns_config::default_nameserver };
1898
+ cb_extract_option_string(nameserver, options, "dns_srv_nameserver");
1899
+
1900
+ std::uint16_t port{ couchbase::core::io::dns::dns_config::default_port };
1901
+ cb_extract_option_number(port, options, "dns_srv_port");
1902
+
1903
+ config = couchbase::core::io::dns::dns_config(nameserver, port, timeout);
1904
+ }
1905
+
1887
1906
  static VALUE
1888
1907
  cb_Backend_open(VALUE self, VALUE connection_string, VALUE credentials, VALUE options)
1889
1908
  {
@@ -1983,13 +2002,14 @@ cb_Backend_open(VALUE self, VALUE connection_string, VALUE credentials, VALUE op
1983
2002
  cb_extract_option_milliseconds(origin.options().analytics_timeout, options, "analytics_timeout");
1984
2003
  cb_extract_option_milliseconds(origin.options().search_timeout, options, "search_timeout");
1985
2004
  cb_extract_option_milliseconds(origin.options().management_timeout, options, "management_timeout");
1986
- cb_extract_option_milliseconds(origin.options().dns_srv_timeout, options, "dns_srv_timeout");
1987
2005
  cb_extract_option_milliseconds(origin.options().tcp_keep_alive_interval, options, "tcp_keep_alive_interval");
1988
2006
  cb_extract_option_milliseconds(origin.options().config_poll_interval, options, "config_poll_interval");
1989
2007
  cb_extract_option_milliseconds(origin.options().config_poll_floor, options, "config_poll_floor");
1990
2008
  cb_extract_option_milliseconds(origin.options().config_idle_redial_timeout, options, "config_idle_redial_timeout");
1991
2009
  cb_extract_option_milliseconds(origin.options().idle_http_connection_timeout, options, "idle_http_connection_timeout");
1992
2010
 
2011
+ cb_extract_dns_config(origin.options().dns_config, options);
2012
+
1993
2013
  cb_extract_option_number(origin.options().max_http_connections, options, "max_http_connections");
1994
2014
 
1995
2015
  cb_extract_option_bool(origin.options().enable_tls, options, "enable_tls");
@@ -5069,6 +5089,14 @@ cb_Backend_query_index_get_all(VALUE self, VALUE bucket_name, VALUE options)
5069
5089
  couchbase::core::operations::management::query_index_get_all_request req{};
5070
5090
  req.bucket_name = cb_string_new(bucket_name);
5071
5091
  cb_extract_timeout(req, options);
5092
+ if (!NIL_P(options)) {
5093
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5094
+ req.scope_name = cb_string_new(scope_name);
5095
+ }
5096
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5097
+ req.collection_name = cb_string_new(collection_name);
5098
+ }
5099
+ }
5072
5100
  auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_get_all_response>>();
5073
5101
  auto f = barrier->get_future();
5074
5102
  cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_get_all_response&& resp) {
@@ -5445,15 +5473,50 @@ cb_Backend_query_index_build_deferred(VALUE self, VALUE bucket_name, VALUE optio
5445
5473
  }
5446
5474
 
5447
5475
  try {
5448
- couchbase::build_query_index_options opts;
5449
- couchbase::ruby::set_timeout(opts, options);
5450
- auto bucket = cb_string_new(bucket_name);
5476
+ couchbase::core::operations::management::query_index_build_deferred_request req{};
5477
+ cb_extract_timeout(req, options);
5478
+ req.bucket_name = cb_string_new(bucket_name);
5479
+
5480
+ if (!NIL_P(options)) {
5481
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5482
+ req.scope_name = cb_string_new(scope_name);
5483
+ }
5484
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5485
+ req.collection_name = cb_string_new(collection_name);
5486
+ }
5487
+ }
5451
5488
 
5452
- auto f = couchbase::cluster(cluster).query_indexes().build_deferred_indexes(bucket, opts);
5453
- if (auto ctx = cb_wait_for_future(f); ctx.ec()) {
5454
- cb_throw_error_code(ctx, fmt::format("unable to trigger build for deferred indexes for the bucket \"{}\"", bucket));
5489
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_build_deferred_response>>();
5490
+ auto f = barrier->get_future();
5491
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_build_deferred_response&& resp) {
5492
+ barrier->set_value(std::move(resp));
5493
+ });
5494
+ auto resp = cb_wait_for_future(f);
5495
+ if (resp.ctx.ec) {
5496
+ if (!resp.errors.empty()) {
5497
+ const auto& first_error = resp.errors.front();
5498
+ cb_throw_error_code(resp.ctx,
5499
+ fmt::format(R"(unable to build deferred indexes on the bucket "{}" ({}: {}))",
5500
+ req.bucket_name,
5501
+ first_error.code,
5502
+ first_error.message));
5503
+ } else {
5504
+ cb_throw_error_code(resp.ctx, fmt::format(R"(unable to build deferred indexes on the bucket "{}")", req.bucket_name));
5505
+ }
5455
5506
  }
5456
- return Qtrue;
5507
+ VALUE res = rb_hash_new();
5508
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5509
+ if (!resp.errors.empty()) {
5510
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5511
+ for (const auto& err : resp.errors) {
5512
+ VALUE error = rb_hash_new();
5513
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5514
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5515
+ rb_ary_push(errors, error);
5516
+ }
5517
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5518
+ }
5519
+ return res;
5457
5520
  } catch (const std::system_error& se) {
5458
5521
  rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5459
5522
  } catch (const ruby_exception& e) {
@@ -6819,12 +6882,12 @@ cb_Backend_dns_srv(VALUE self, VALUE hostname, VALUE service)
6819
6882
  if (tls) {
6820
6883
  service_name = "_couchbases";
6821
6884
  }
6822
- auto barrier = std::make_shared<std::promise<couchbase::core::io::dns::dns_client::dns_srv_response>>();
6885
+ auto barrier = std::make_shared<std::promise<couchbase::core::io::dns::dns_srv_response>>();
6823
6886
  auto f = barrier->get_future();
6824
6887
  client.query_srv(host_name,
6825
6888
  service_name,
6826
6889
  couchbase::core::io::dns::dns_config::system_config(),
6827
- [barrier](couchbase::core::io::dns::dns_client::dns_srv_response&& resp) { barrier->set_value(std::move(resp)); });
6890
+ [barrier](couchbase::core::io::dns::dns_srv_response&& resp) { barrier->set_value(std::move(resp)); });
6828
6891
  ctx.run();
6829
6892
  auto resp = cb_wait_for_future(f);
6830
6893
  if (resp.ec) {
data/ext/revisions.rb CHANGED
@@ -1,3 +1,3 @@
1
- cmake_flags << "-DEXT_GIT_REVISION=97ca42af94afb27b75d35a1f5ea5414a562036a5"
2
- cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_REVISION=b895551ebe99164be6e633e21147296cd7241c34"
3
- cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_DESCRIBE=1.0.0-dp.4-10-gb895551"
1
+ cmake_flags << "-DEXT_GIT_REVISION=ef79cc86f921face060319b31c7cacbecfdefaa6"
2
+ cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_REVISION=2c6a065499329f39963cc3a45c87f58c6bea5f28"
3
+ cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_DESCRIBE=1.0.0-dp.5-0-g2c6a065"
@@ -28,7 +28,6 @@ module Couchbase
28
28
  def initialize(username, password)
29
29
  @username = username
30
30
  @password = password
31
- @allowed_sasl_mechanisms = DEFAULT_SASL_MECHANISMS
32
31
  end
33
32
 
34
33
  # Creates a LDAP compatible password authenticator which is INSECURE if not used with TLS.
@@ -32,13 +32,13 @@ module Couchbase
32
32
 
33
33
  # Connect to the Couchbase cluster
34
34
  #
35
- # @overload connect(connection_string, options)
36
- # @param [String] connection_string connection string used to locate the Couchbase Cluster
35
+ # @overload connect(connection_string_or_config, options)
36
+ # @param [String, Configuration] connection_string_or_config connection string used to locate the Couchbase Cluster
37
37
  # @param [Options::Cluster] options custom options when creating the cluster connection
38
38
  #
39
- # @overload connect(connection_string, username, password, options)
39
+ # @overload connect(connection_string_or_config, username, password, options)
40
40
  # Shortcut for {PasswordAuthenticator}
41
- # @param [String] connection_string connection string used to locate the Couchbase Cluster
41
+ # @param [String] connection_string_or_config connection string used to locate the Couchbase Cluster
42
42
  # @param [String] username name of the user
43
43
  # @param [String] password password of the user
44
44
  # @param [Options::Cluster, nil] options custom options when creating the cluster connection
@@ -62,12 +62,16 @@ module Couchbase
62
62
  # @see https://docs.couchbase.com/server/current/manage/manage-security/configure-client-certificates.html
63
63
  #
64
64
  # @return [Cluster]
65
- def self.connect(connection_string, *options)
66
- regexp = /^((couchbases?|http):\/\/.*)$/i
67
- if regexp.match?(connection_string) || !connection_string.include?("://")
68
- Cluster.new(connection_string, *options)
65
+ def self.connect(connection_string_or_config, *options)
66
+ connection_string = if connection_string_or_config.is_a?(Configuration)
67
+ connection_string_or_config.connection_string
68
+ else
69
+ connection_string_or_config
70
+ end
71
+ if connection_string =~ /\Acouchbases?:\/\/.*\z/i || !connection_string.include?("://")
72
+ Cluster.new(connection_string_or_config, *options)
69
73
  else
70
- ClusterRegistry.instance.connect(connection_string, *options)
74
+ ClusterRegistry.instance.connect(connection_string_or_config, *options)
71
75
  end
72
76
  end
73
77
 
@@ -382,8 +386,6 @@ module Couchbase
382
386
  raise ArgumentError, "missing connection_string" unless connection_string
383
387
  raise ArgumentError, "missing username" unless credentials[:username]
384
388
  raise ArgumentError, "missing password" unless credentials[:password]
385
-
386
- open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
387
389
  else
388
390
  options = args.shift
389
391
  case options
@@ -392,8 +394,6 @@ module Couchbase
392
394
  credentials[:password] = args.shift
393
395
  raise ArgumentError, "missing username" unless credentials[:username]
394
396
  raise ArgumentError, "missing password" unless credentials[:password]
395
-
396
- open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
397
397
  when Options::Cluster
398
398
  open_options = options&.to_backend || {}
399
399
  authenticator = options&.authenticator
@@ -26,9 +26,14 @@ module Couchbase
26
26
  @handlers = {}
27
27
  end
28
28
 
29
- def connect(connection_string, *options)
29
+ def connect(connection_string_or_config, *options)
30
+ connection_string = if connection_string_or_config.is_a?(Configuration)
31
+ connection_string_or_config.connection_string
32
+ else
33
+ connection_string_or_config
34
+ end
30
35
  @handlers.each do |regexp, cluster_class|
31
- return cluster_class.connect(connection_string, *options) if regexp.match?(connection_string)
36
+ return cluster_class.connect(connection_string_or_config, *options) if regexp.match?(connection_string)
32
37
  end
33
38
  raise(Error::FeatureNotAvailable, "Connection string '#{connection_string}' not supported.")
34
39
  end
@@ -15,7 +15,7 @@
15
15
  module Couchbase
16
16
  module ConfigProfiles
17
17
  class Profiles
18
- attr :profiles
18
+ attr_reader :profiles
19
19
 
20
20
  def initialize
21
21
  @profiles = {}
@@ -33,10 +33,9 @@ module Couchbase
33
33
  private
34
34
 
35
35
  def load_configuration(settings)
36
- configuration = settings.with_indifferent_access
37
- @connection_string = configuration[:connection_string]
38
- @username = configuration[:username]
39
- @password = configuration[:password]
36
+ @connection_string = settings[:connection_string] || settings["connection_string"]
37
+ @username = settings[:username] || settings["username"]
38
+ @password = settings[:password] || settings["password"]
40
39
  end
41
40
 
42
41
  def load_yaml(path, environment)
@@ -14,18 +14,25 @@
14
14
 
15
15
  require "json"
16
16
 
17
+ require "couchbase/transcoder_flags"
18
+
17
19
  module Couchbase
18
20
  class JsonTranscoder
19
21
  # @param [Object] document
20
22
  # @return [Array<String, Integer>] pair of encoded document and flags
21
23
  def encode(document)
22
- [JSON.generate(document), (0x02 << 24) | 0x06]
24
+ raise Error::EncodingFailure, "The JsonTranscoder does not support binary data" if document.is_a?(String) && !document.valid_encoding?
25
+
26
+ [JSON.generate(document), TranscoderFlags.new(format: :json, lower_bits: 6).encode]
23
27
  end
24
28
 
25
- # @param [String, nil] blob string of bytes, containing encoded representation of the document
26
- # @param [Integer, :json] _flags bit field, describing how the data encoded
27
- # @return Object decoded document
28
- def decode(blob, _flags)
29
+ # @param [String] blob string of bytes, containing encoded representation of the document
30
+ # @param [Integer, :json] flags bit field, describing how the data encoded
31
+ # @return [Object] decoded document
32
+ def decode(blob, flags)
33
+ format = TranscoderFlags.decode(flags).format
34
+ raise Error::DecodingFailure, "Unable to decode #{format} with the JsonTranscoder" unless format == :json || format.nil?
35
+
29
36
  JSON.parse(blob) unless blob&.empty?
30
37
  end
31
38
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require "couchbase/management/query_index_manager"
16
16
  require "couchbase/utils/time"
17
+ require "couchbase/errors"
17
18
 
18
19
  module Couchbase
19
20
  module Management
@@ -37,8 +38,18 @@ module Couchbase
37
38
  #
38
39
  # @return [Array<QueryIndex>]
39
40
  #
40
- # @raise [ArgumentError]
41
+ # @raise [Error::InvalidArgument]
41
42
  def get_all_indexes(options = Options::Query::GetAllIndexes.new)
43
+ unless options.scope_name.nil?
44
+ raise Error::InvalidArgument,
45
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
46
+ end
47
+
48
+ unless options.collection_name.nil?
49
+ raise Error::InvalidArgument,
50
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
51
+ end
52
+
42
53
  res = @backend.collection_query_index_get_all(@bucket_name, @scope_name, @collection_name, options.to_backend)
43
54
  res[:indexes].map do |idx|
44
55
  QueryIndex.new do |index|
@@ -64,15 +75,17 @@ module Couchbase
64
75
  #
65
76
  # @return void
66
77
  #
67
- # @raise [ArgumentError]
78
+ # @raise [Error::InvalidArgument]
68
79
  # @raise [Error::IndexExists]
69
80
  def create_index(index_name, fields, options = Options::Query::CreateIndex.new)
70
81
  unless options.scope_name.nil?
71
- raise ArgumentError, "Scope name cannot be set in the options when using the Query Index manager at the collection level"
82
+ raise Error::InvalidArgument,
83
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
72
84
  end
73
85
 
74
86
  unless options.collection_name.nil?
75
- raise ArgumentError, "Collection name cannot be set in the options when using the Query Index manager at the collection level"
87
+ raise Error::InvalidArgument,
88
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
76
89
  end
77
90
 
78
91
  @backend.collection_query_index_create(@bucket_name, @scope_name, @collection_name, index_name, fields, options.to_backend)
@@ -84,15 +97,17 @@ module Couchbase
84
97
  #
85
98
  # @return void
86
99
  #
87
- # @raise [ArgumentError]
100
+ # @raise [Error::InvalidArgument]
88
101
  # @raise [Error::IndexExists]
89
102
  def create_primary_index(options = Options::Query::CreatePrimaryIndex.new)
90
103
  unless options.scope_name.nil?
91
- raise ArgumentError, "Scope name cannot be set in the options when using the Query Index manager at the collection level"
104
+ raise Error::InvalidArgument,
105
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
92
106
  end
93
107
 
94
108
  unless options.collection_name.nil?
95
- raise ArgumentError, "Collection name cannot be set in the options when using the Query Index manager at the collection level"
109
+ raise Error::InvalidArgument,
110
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
96
111
  end
97
112
 
98
113
  @backend.collection_query_index_create_primary(@bucket_name, @scope_name, @collection_name, options.to_backend)
@@ -105,15 +120,17 @@ module Couchbase
105
120
  #
106
121
  # @return void
107
122
  #
108
- # @raise [ArgumentError]
123
+ # @raise [Error::InvalidArgument]
109
124
  # @raise [Error::IndexNotFound]
110
125
  def drop_index(index_name, options = Options::Query::DropIndex.new)
111
126
  unless options.scope_name.nil?
112
- raise ArgumentError, "Scope name cannot be set in the options when using the Query Index manager at the collection level"
127
+ raise Error::InvalidArgument,
128
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
113
129
  end
114
130
 
115
131
  unless options.collection_name.nil?
116
- raise ArgumentError, "Collection name cannot be set in the options when using the Query Index manager at the collection level"
132
+ raise Error::InvalidArgument,
133
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
117
134
  end
118
135
 
119
136
  @backend.collection_query_index_drop(@bucket_name, @scope_name, @collection_name, index_name, options.to_backend)
@@ -125,15 +142,17 @@ module Couchbase
125
142
  #
126
143
  # @return void
127
144
  #
128
- # @raise [ArgumentError]
145
+ # @raise [Error::InvalidArgument]
129
146
  # @raise [Error::IndexNotFound]
130
147
  def drop_primary_index(options = Options::Query::DropPrimaryIndex.new)
131
148
  unless options.scope_name.nil?
132
- raise ArgumentError, "Scope name cannot be set in the options when using the Query Index manager at the collection level"
149
+ raise Error::InvalidArgument,
150
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
133
151
  end
134
152
 
135
153
  unless options.collection_name.nil?
136
- raise ArgumentError, "Collection name cannot be set in the options when using the Query Index manager at the collection level"
154
+ raise Error::InvalidArgument,
155
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
137
156
  end
138
157
 
139
158
  @backend.collection_query_index_drop_primary(@bucket_name, @scope_name, @collection_name, options.to_backend)
@@ -145,8 +164,18 @@ module Couchbase
145
164
  #
146
165
  # @return void
147
166
  #
148
- # @raise [ArgumentError]
167
+ # @raise [Error::InvalidArgument]
149
168
  def build_deferred_indexes(options = Options::Query::BuildDeferredIndexes.new)
169
+ unless options.scope_name.nil?
170
+ raise Error::InvalidArgument,
171
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
172
+ end
173
+
174
+ unless options.collection_name.nil?
175
+ raise Error::InvalidArgument,
176
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
177
+ end
178
+
150
179
  @backend.collection_query_index_build_deferred(@bucket_name, @scope_name, @collection_name, options.to_backend)
151
180
  end
152
181
 
@@ -156,9 +185,19 @@ module Couchbase
156
185
  # @param [Integer, #in_milliseconds] timeout the time in milliseconds allowed for the operation to complete
157
186
  # @param [Options::Query::WatchIndexes] options
158
187
  #
159
- # @raise [ArgumentError]
188
+ # @raise [Error::InvalidArgument]
160
189
  # @raise [Error::IndexNotFound]
161
190
  def watch_indexes(index_names, timeout, options = Options::Query::WatchIndexes.new)
191
+ unless options.scope_name.nil?
192
+ raise Error::InvalidArgument,
193
+ "Scope name cannot be set in the options when using the Query Index manager at the collection level"
194
+ end
195
+
196
+ unless options.collection_name.nil?
197
+ raise Error::InvalidArgument,
198
+ "Collection name cannot be set in the options when using the Query Index manager at the collection level"
199
+ end
200
+
162
201
  index_names.append("#primary") if options.watch_primary
163
202
 
164
203
  interval_millis = 50