couchbase 3.4.0 → 3.4.2

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/couchbase/CMakeLists.txt +10 -3
  4. data/ext/couchbase/cmake/CompilerWarnings.cmake +12 -4
  5. data/ext/couchbase/cmake/Documentation.cmake +4 -3
  6. data/ext/couchbase/cmake/OpenSSL.cmake +52 -7
  7. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
  8. data/ext/couchbase/cmake/VersionInfo.cmake +39 -3
  9. data/ext/couchbase/cmake/test_openssl.cxx +7 -0
  10. data/ext/couchbase/core/cluster_options.hxx +0 -1
  11. data/ext/couchbase/core/config_profile.cxx +23 -1
  12. data/ext/couchbase/core/config_profile.hxx +2 -12
  13. data/ext/couchbase/core/crypto/CMakeLists.txt +5 -1
  14. data/ext/couchbase/core/impl/analytics.cxx +236 -0
  15. data/ext/couchbase/core/impl/cluster.cxx +0 -1
  16. data/ext/couchbase/core/impl/collection_query_index_manager.cxx +3 -3
  17. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
  18. data/ext/couchbase/core/impl/get_all_query_indexes.cxx +3 -3
  19. data/ext/couchbase/core/impl/query.cxx +5 -5
  20. data/ext/couchbase/core/impl/transaction_get_result.cxx +54 -0
  21. data/ext/couchbase/core/io/dns_client.cxx +225 -0
  22. data/ext/couchbase/core/io/dns_client.hxx +19 -188
  23. data/ext/couchbase/core/meta/CMakeLists.txt +7 -5
  24. data/ext/couchbase/core/meta/version.cxx +19 -0
  25. data/ext/couchbase/core/operations/document_search.cxx +5 -2
  26. data/ext/couchbase/core/operations/document_search.hxx +0 -1
  27. data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
  28. data/ext/couchbase/core/transactions/atr_cleanup_entry.cxx +1 -0
  29. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +65 -31
  30. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +44 -23
  31. data/ext/couchbase/core/transactions/forward_compat.hxx +2 -2
  32. data/ext/couchbase/core/transactions/internal/transaction_context.hxx +13 -13
  33. data/ext/couchbase/core/transactions/internal/transaction_fields.hxx +1 -0
  34. data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
  35. data/ext/couchbase/core/transactions/staged_mutation.cxx +1 -1
  36. data/ext/couchbase/core/transactions/staged_mutation.hxx +12 -2
  37. data/ext/couchbase/core/transactions/transaction_context.cxx +9 -11
  38. data/ext/couchbase/core/transactions/transaction_get_result.cxx +41 -31
  39. data/ext/couchbase/core/transactions/transaction_get_result.hxx +7 -3
  40. data/ext/couchbase/core/transactions/transaction_links.hxx +13 -1
  41. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
  42. data/ext/couchbase/core/transactions/waitable_op_list.hxx +1 -0
  43. data/ext/couchbase/core/utils/connection_string.cxx +10 -3
  44. data/ext/couchbase/core/utils/connection_string.hxx +3 -3
  45. data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
  46. data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
  47. data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
  48. data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
  49. data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
  50. data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
  51. data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
  52. data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
  53. data/ext/couchbase/couchbase/cluster.hxx +35 -2
  54. data/ext/couchbase/couchbase/cluster_options.hxx +10 -10
  55. data/ext/couchbase/couchbase/collection.hxx +22 -17
  56. data/ext/couchbase/couchbase/collection_query_index_manager.hxx +1 -1
  57. data/ext/couchbase/couchbase/common_options.hxx +1 -1
  58. data/ext/couchbase/couchbase/configuration_profile.hxx +1 -1
  59. data/ext/couchbase/couchbase/configuration_profiles_registry.hxx +0 -1
  60. data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +1 -1
  61. data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +1 -1
  62. data/ext/couchbase/couchbase/drop_query_index_options.hxx +1 -1
  63. data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
  64. data/ext/couchbase/couchbase/fmt/cas.hxx +12 -0
  65. data/ext/couchbase/couchbase/fmt/durability_level.hxx +6 -0
  66. data/ext/couchbase/couchbase/fmt/key_value_extended_error_info.hxx +6 -0
  67. data/ext/couchbase/couchbase/fmt/key_value_status_code.hxx +6 -0
  68. data/ext/couchbase/couchbase/fmt/mutation_token.hxx +6 -0
  69. data/ext/couchbase/couchbase/fmt/query_scan_consistency.hxx +6 -0
  70. data/ext/couchbase/couchbase/fmt/query_status.hxx +6 -0
  71. data/ext/couchbase/couchbase/fmt/retry_reason.hxx +6 -0
  72. data/ext/couchbase/couchbase/fmt/tls_verify_mode.hxx +6 -0
  73. data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +5 -4
  74. data/ext/couchbase/couchbase/query_index_manager.hxx +4 -2
  75. data/ext/couchbase/couchbase/query_options.hxx +0 -1
  76. data/ext/couchbase/couchbase/scope.hxx +34 -1
  77. data/ext/couchbase/couchbase/subdoc/array_add_unique.hxx +2 -0
  78. data/ext/couchbase/couchbase/subdoc/array_append.hxx +2 -0
  79. data/ext/couchbase/couchbase/subdoc/array_insert.hxx +2 -0
  80. data/ext/couchbase/couchbase/subdoc/array_prepend.hxx +2 -0
  81. data/ext/couchbase/couchbase/subdoc/count.hxx +2 -0
  82. data/ext/couchbase/couchbase/subdoc/counter.hxx +2 -0
  83. data/ext/couchbase/couchbase/subdoc/exists.hxx +2 -0
  84. data/ext/couchbase/couchbase/subdoc/get.hxx +2 -0
  85. data/ext/couchbase/couchbase/subdoc/insert.hxx +2 -0
  86. data/ext/couchbase/couchbase/subdoc/remove.hxx +2 -0
  87. data/ext/couchbase/couchbase/subdoc/replace.hxx +3 -1
  88. data/ext/couchbase/couchbase/subdoc/upsert.hxx +2 -0
  89. data/ext/couchbase/couchbase/transaction_op_error_context.hxx +4 -4
  90. data/ext/couchbase/couchbase/transactions/attempt_context.hxx +1 -1
  91. data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +36 -51
  92. data/ext/couchbase/couchbase/transactions/transactions_config.hxx +1 -1
  93. data/ext/couchbase/test/CMakeLists.txt +3 -2
  94. data/ext/couchbase/test/test_helper.hxx +1 -1
  95. data/ext/couchbase/test/test_integration_analytics.cxx +289 -13
  96. data/ext/couchbase/test/test_integration_crud.cxx +8 -1
  97. data/ext/couchbase/test/test_integration_examples.cxx +182 -0
  98. data/ext/couchbase/test/test_integration_management.cxx +15 -3
  99. data/ext/couchbase/test/test_integration_search.cxx +601 -0
  100. data/ext/couchbase/test/test_transaction_transaction_simple.cxx +73 -0
  101. data/ext/couchbase/test/test_unit_config_profiles.cxx +12 -12
  102. data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
  103. data/ext/couchbase/test/test_unit_transaction_utils.cxx +76 -19
  104. data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
  105. data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
  106. data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
  107. data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
  108. data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
  109. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
  110. data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
  111. data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
  112. data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
  113. data/ext/couchbase/third_party/snappy/snappy.h +19 -4
  114. data/ext/couchbase.cxx +506 -26
  115. data/ext/extconf.rb +2 -1
  116. data/ext/revisions.rb +3 -2
  117. data/lib/couchbase/binary_collection.rb +4 -4
  118. data/lib/couchbase/cluster.rb +13 -9
  119. data/lib/couchbase/cluster_registry.rb +7 -2
  120. data/lib/couchbase/collection.rb +5 -0
  121. data/lib/couchbase/configuration.rb +3 -4
  122. data/lib/couchbase/errors.rb +10 -0
  123. data/lib/couchbase/management/collection_query_index_manager.rb +183 -0
  124. data/lib/couchbase/management/query_index_manager.rb +35 -3
  125. data/lib/couchbase/management.rb +1 -0
  126. data/lib/couchbase/options.rb +87 -5
  127. data/lib/couchbase/search_options.rb +158 -240
  128. data/lib/couchbase/version.rb +1 -1
  129. metadata +21 -6
  130. data/ext/couchbase/core/CMakeLists.txt +0 -0
@@ -54,7 +54,7 @@ class cluster_options
54
54
  * @param password
55
55
  *
56
56
  * @since 1.0.0
57
- * @comitted
57
+ * @committed
58
58
  */
59
59
  cluster_options(std::string username, std::string password)
60
60
  : username_{ std::move(username) }
@@ -67,7 +67,7 @@ class cluster_options
67
67
  * @param authenticator
68
68
  *
69
69
  * @since 1.0.0
70
- * @comitted
70
+ * @committed
71
71
  */
72
72
  explicit cluster_options(password_authenticator authenticator)
73
73
  : username_{ std::move(authenticator.username_) }
@@ -83,7 +83,7 @@ class cluster_options
83
83
  * @param authenticator
84
84
  *
85
85
  * @since 1.0.0
86
- * @comitted
86
+ * @committed
87
87
  */
88
88
  explicit cluster_options(certificate_authenticator authenticator)
89
89
  : certificate_path_{ std::move(authenticator.certificate_path_) }
@@ -115,7 +115,7 @@ class cluster_options
115
115
  * @return compression options
116
116
  *
117
117
  * @since 1.0.0
118
- * @comitted
118
+ * @committed
119
119
  */
120
120
  [[nodiscard]] auto compression() -> compression_options&
121
121
  {
@@ -128,7 +128,7 @@ class cluster_options
128
128
  * @return timeout options
129
129
  *
130
130
  * @since 1.0.0
131
- * @comitted
131
+ * @committed
132
132
  */
133
133
  [[nodiscard]] auto timeouts() -> timeout_options&
134
134
  {
@@ -141,7 +141,7 @@ class cluster_options
141
141
  * @return DNS options
142
142
  *
143
143
  * @since 1.0.0
144
- * @comitted
144
+ * @committed
145
145
  */
146
146
  [[nodiscard]] auto dns() -> dns_options&
147
147
  {
@@ -154,7 +154,7 @@ class cluster_options
154
154
  * @return security options
155
155
  *
156
156
  * @since 1.0.0
157
- * @comitted
157
+ * @committed
158
158
  */
159
159
  [[nodiscard]] auto security() -> security_options&
160
160
  {
@@ -167,7 +167,7 @@ class cluster_options
167
167
  * @return network options
168
168
  *
169
169
  * @since 1.0.0
170
- * @comitted
170
+ * @committed
171
171
  */
172
172
  [[nodiscard]] auto network() -> network_options&
173
173
  {
@@ -180,7 +180,7 @@ class cluster_options
180
180
  * @return metrics options
181
181
  *
182
182
  * @since 1.0.0
183
- * @comitted
183
+ * @committed
184
184
  */
185
185
  [[nodiscard]] auto metrics() -> metrics_options&
186
186
  {
@@ -193,7 +193,7 @@ class cluster_options
193
193
  * @return tracing options
194
194
  *
195
195
  * @since 1.0.0
196
- * @comitted
196
+ * @committed
197
197
  */
198
198
  [[nodiscard]] auto tracing() -> tracing_options&
199
199
  {
@@ -161,7 +161,7 @@ class collection
161
161
  * @since 1.0.0
162
162
  * @committed
163
163
  */
164
- [[nodiscard]] auto get(std::string document_id, const get_options& options) const
164
+ [[nodiscard]] auto get(std::string document_id, const get_options& options = {}) const
165
165
  -> std::future<std::pair<key_value_error_context, get_result>>
166
166
  {
167
167
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
@@ -220,7 +220,9 @@ class collection
220
220
  * @since 1.0.0
221
221
  * @committed
222
222
  */
223
- [[nodiscard]] auto get_and_touch(std::string document_id, std::chrono::seconds duration, const get_and_touch_options& options) const
223
+ [[nodiscard]] auto get_and_touch(std::string document_id,
224
+ std::chrono::seconds duration,
225
+ const get_and_touch_options& options = {}) const
224
226
  -> std::future<std::pair<key_value_error_context, get_result>>
225
227
  {
226
228
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
@@ -281,7 +283,7 @@ class collection
281
283
  */
282
284
  [[nodiscard]] auto get_and_touch(std::string document_id,
283
285
  std::chrono::system_clock::time_point time_point,
284
- const get_and_touch_options& options) const
286
+ const get_and_touch_options& options = {}) const
285
287
  -> std::future<std::pair<key_value_error_context, get_result>>
286
288
  {
287
289
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
@@ -337,7 +339,7 @@ class collection
337
339
  * @since 1.0.0
338
340
  * @committed
339
341
  */
340
- [[nodiscard]] auto touch(std::string document_id, std::chrono::seconds duration, const touch_options& options) const
342
+ [[nodiscard]] auto touch(std::string document_id, std::chrono::seconds duration, const touch_options& options = {}) const
341
343
  -> std::future<std::pair<key_value_error_context, result>>
342
344
  {
343
345
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, result>>>();
@@ -396,8 +398,9 @@ class collection
396
398
  * @since 1.0.0
397
399
  * @committed
398
400
  */
399
- [[nodiscard]] auto touch(std::string document_id, std::chrono::system_clock::time_point time_point, const touch_options& options) const
400
- -> std::future<std::pair<key_value_error_context, result>>
401
+ [[nodiscard]] auto touch(std::string document_id,
402
+ std::chrono::system_clock::time_point time_point,
403
+ const touch_options& options = {}) const -> std::future<std::pair<key_value_error_context, result>>
401
404
  {
402
405
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, result>>>();
403
406
  auto future = barrier->get_future();
@@ -450,7 +453,7 @@ class collection
450
453
  * @since 1.0.0
451
454
  * @committed
452
455
  */
453
- [[nodiscard]] auto get_any_replica(std::string document_id, const get_any_replica_options& options) const
456
+ [[nodiscard]] auto get_any_replica(std::string document_id, const get_any_replica_options& options = {}) const
454
457
  -> std::future<std::pair<key_value_error_context, get_replica_result>>
455
458
  {
456
459
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_replica_result>>>();
@@ -502,7 +505,7 @@ class collection
502
505
  * @since 1.0.0
503
506
  * @committed
504
507
  */
505
- [[nodiscard]] auto get_all_replicas(std::string document_id, const get_all_replicas_options& options) const
508
+ [[nodiscard]] auto get_all_replicas(std::string document_id, const get_all_replicas_options& options = {}) const
506
509
  -> std::future<std::pair<key_value_error_context, get_all_replicas_result>>
507
510
  {
508
511
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_all_replicas_result>>>();
@@ -562,7 +565,7 @@ class collection
562
565
  * @committed
563
566
  */
564
567
  template<typename Transcoder = codec::default_json_transcoder, typename Document>
565
- [[nodiscard]] auto upsert(std::string document_id, const Document& document, const upsert_options& options) const
568
+ [[nodiscard]] auto upsert(std::string document_id, const Document& document, const upsert_options& options = {}) const
566
569
  -> std::future<std::pair<key_value_error_context, mutation_result>>
567
570
  {
568
571
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
@@ -624,7 +627,7 @@ class collection
624
627
  * @committed
625
628
  */
626
629
  template<typename Transcoder = codec::default_json_transcoder, typename Document>
627
- [[nodiscard]] auto insert(std::string document_id, const Document& document, const insert_options& options) const
630
+ [[nodiscard]] auto insert(std::string document_id, const Document& document, const insert_options& options = {}) const
628
631
  -> std::future<std::pair<key_value_error_context, mutation_result>>
629
632
  {
630
633
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
@@ -688,7 +691,7 @@ class collection
688
691
  * @committed
689
692
  */
690
693
  template<typename Transcoder = codec::default_json_transcoder, typename Document>
691
- [[nodiscard]] auto replace(std::string document_id, const Document& document, const replace_options& options) const
694
+ [[nodiscard]] auto replace(std::string document_id, const Document& document, const replace_options& options = {}) const
692
695
  -> std::future<std::pair<key_value_error_context, mutation_result>>
693
696
  {
694
697
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
@@ -738,7 +741,7 @@ class collection
738
741
  * @since 1.0.0
739
742
  * @committed
740
743
  */
741
- [[nodiscard]] auto remove(std::string document_id, const remove_options& options) const
744
+ [[nodiscard]] auto remove(std::string document_id, const remove_options& options = {}) const
742
745
  -> std::future<std::pair<key_value_error_context, mutation_result>>
743
746
  {
744
747
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, mutation_result>>>();
@@ -792,7 +795,7 @@ class collection
792
795
  * @since 1.0.0
793
796
  * @committed
794
797
  */
795
- [[nodiscard]] auto mutate_in(std::string document_id, mutate_in_specs specs, const mutate_in_options& options) const
798
+ [[nodiscard]] auto mutate_in(std::string document_id, mutate_in_specs specs, const mutate_in_options& options = {}) const
796
799
  -> std::future<std::pair<subdocument_error_context, mutate_in_result>>
797
800
  {
798
801
  auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, mutate_in_result>>>();
@@ -842,7 +845,7 @@ class collection
842
845
  * @since 1.0.0
843
846
  * @committed
844
847
  */
845
- [[nodiscard]] auto lookup_in(std::string document_id, lookup_in_specs specs, const lookup_in_options& options) const
848
+ [[nodiscard]] auto lookup_in(std::string document_id, lookup_in_specs specs, const lookup_in_options& options = {}) const
846
849
  -> std::future<std::pair<subdocument_error_context, lookup_in_result>>
847
850
  {
848
851
  auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_result>>>();
@@ -887,7 +890,9 @@ class collection
887
890
  * @since 1.0.0
888
891
  * @committed
889
892
  */
890
- [[nodiscard]] auto get_and_lock(std::string document_id, std::chrono::seconds lock_duration, const get_and_lock_options& options) const
893
+ [[nodiscard]] auto get_and_lock(std::string document_id,
894
+ std::chrono::seconds lock_duration,
895
+ const get_and_lock_options& options = {}) const
891
896
  -> std::future<std::pair<key_value_error_context, get_result>>
892
897
  {
893
898
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, get_result>>>();
@@ -939,7 +944,7 @@ class collection
939
944
  * @since 1.0.0
940
945
  * @committed
941
946
  */
942
- [[nodiscard]] auto unlock(std::string document_id, couchbase::cas cas, const unlock_options& options) const
947
+ [[nodiscard]] auto unlock(std::string document_id, couchbase::cas cas, const unlock_options& options = {}) const
943
948
  -> std::future<key_value_error_context>
944
949
  {
945
950
  auto barrier = std::make_shared<std::promise<key_value_error_context>>();
@@ -983,7 +988,7 @@ class collection
983
988
  * @since 1.0.0
984
989
  * @committed
985
990
  */
986
- [[nodiscard]] auto exists(std::string document_id, const exists_options& options) const
991
+ [[nodiscard]] auto exists(std::string document_id, const exists_options& options = {}) const
987
992
  -> std::future<std::pair<key_value_error_context, exists_result>>
988
993
  {
989
994
  auto barrier = std::make_shared<std::promise<std::pair<key_value_error_context, exists_result>>>();
@@ -61,7 +61,7 @@ class collection_query_index_manager
61
61
  * @since 1.0.0
62
62
  * @committed
63
63
  */
64
- void get_all_indexes(const get_all_query_indexes_options& options, get_all_indexes_handler&& handler) const;
64
+ void get_all_indexes(const get_all_query_indexes_options& options, get_all_query_indexes_handler&& handler) const;
65
65
 
66
66
  [[nodiscard]] auto get_all_indexes(const get_all_query_indexes_options& options) const
67
67
  -> std::future<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>
@@ -55,7 +55,7 @@ class common_options
55
55
  }
56
56
 
57
57
  /**
58
- * Specifies a custom {@link retry_strategy} for this operation.
58
+ * Specifies a custom {@link couchbase::retry_strategy} for this operation.
59
59
  *
60
60
  * @param strategy the retry strategy to use for this operation.
61
61
  * @return this options builder for chaining purposes.
@@ -25,7 +25,7 @@ class cluster_options;
25
25
  /**
26
26
  * Base class for all defined configuration profiles
27
27
  *
28
- * Just implement the apply function, and register it. See @ref configuration_profiles_registry#register()
28
+ * Just implement the apply function, and register it. See @ref configuration_profiles_registry#register_profile()
29
29
  */
30
30
  class configuration_profile
31
31
  {
@@ -30,7 +30,6 @@ class cluster_options;
30
30
  /**
31
31
  * Registry for defining configuration profiles.
32
32
  */
33
-
34
33
  class configuration_profiles_registry
35
34
  {
36
35
  public:
@@ -32,7 +32,7 @@ class create_primary_query_index_options : public common_options<create_primary_
32
32
  /**
33
33
  * Give the primary index a name
34
34
  *
35
- * defaults to #primary
35
+ * defaults to `#primary`
36
36
  *
37
37
  * @param index_name
38
38
  * @return reference to this object, for use in chaining.
@@ -46,7 +46,7 @@ class drop_primary_query_index_options : public common_options<drop_primary_quer
46
46
  *
47
47
  * The default is to not ignore the error.
48
48
  *
49
- * @param ignore_if_exists if true, we don't return an error if the index already exists
49
+ * @param ignore_if_not_exists if true, we don't return an error if the index already exists
50
50
  * @return reference to this object, for use in chaining.
51
51
  *
52
52
  * @since 1.0.0
@@ -34,7 +34,7 @@ class drop_query_index_options : public common_options<drop_query_index_options>
34
34
  *
35
35
  * The default is to not ignore the error.
36
36
  *
37
- * @param ignore_if_exists if true, we don't return an error if the index already exists
37
+ * @param ignore_if_not_exists if true, we don't return an error if the index already exists
38
38
  * @return reference to this object, for use in chaining.
39
39
  *
40
40
  * @since 1.0.0
@@ -0,0 +1,76 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present Couchbase, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #pragma once
19
+
20
+ #include <couchbase/analytics_status.hxx>
21
+
22
+ #include <fmt/core.h>
23
+
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::analytics_status objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
30
+ template<>
31
+ struct fmt::formatter<couchbase::analytics_status> {
32
+ template<typename ParseContext>
33
+ constexpr auto parse(ParseContext& ctx)
34
+ {
35
+ return ctx.begin();
36
+ }
37
+
38
+ template<typename FormatContext>
39
+ auto format(couchbase::analytics_status status, FormatContext& ctx) const
40
+ {
41
+ string_view name = "unknown";
42
+ switch (status) {
43
+ case couchbase::analytics_status::running:
44
+ name = "running";
45
+ break;
46
+ case couchbase::analytics_status::success:
47
+ name = "success";
48
+ break;
49
+ case couchbase::analytics_status::errors:
50
+ name = "errors";
51
+ break;
52
+ case couchbase::analytics_status::completed:
53
+ name = "completed";
54
+ break;
55
+ case couchbase::analytics_status::stopped:
56
+ name = "stopped";
57
+ break;
58
+ case couchbase::analytics_status::timeout:
59
+ name = "timeout";
60
+ break;
61
+ case couchbase::analytics_status::closed:
62
+ name = "closed";
63
+ break;
64
+ case couchbase::analytics_status::fatal:
65
+ name = "fatal";
66
+ break;
67
+ case couchbase::analytics_status::aborted:
68
+ name = "aborted";
69
+ break;
70
+ case couchbase::analytics_status::unknown:
71
+ name = "unknown";
72
+ break;
73
+ }
74
+ return format_to(ctx.out(), "{}", name);
75
+ }
76
+ };
@@ -21,6 +21,18 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ #ifdef COUCHBASE_CXX_CLIENT_DOXYGEN
25
+ namespace fmt
26
+ {
27
+ }
28
+ #endif
29
+
30
+ /**
31
+ * Helper for fmtlib to format @ref couchbase::cas objects.
32
+ *
33
+ * @since 1.0.0
34
+ * @committed
35
+ */
24
36
  template<>
25
37
  struct fmt::formatter<couchbase::cas> {
26
38
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::durability_level objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::durability_level> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::key_value_extended_error_info objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::key_value_extended_error_info> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::key_value_status_code objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::key_value_status_code> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::mutation_token objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::mutation_token> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::query_scan_consistency objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::query_scan_consistency> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::query_status objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::query_status> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::retry_reason objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::retry_reason> {
26
32
  template<typename ParseContext>
@@ -21,6 +21,12 @@
21
21
 
22
22
  #include <fmt/core.h>
23
23
 
24
+ /**
25
+ * Helper for fmtlib to format @ref couchbase::tls_verify_mode objects.
26
+ *
27
+ * @since 1.0.0
28
+ * @committed
29
+ */
24
30
  template<>
25
31
  struct fmt::formatter<couchbase::tls_verify_mode> {
26
32
  template<typename ParseContext>
@@ -66,7 +66,8 @@ class get_all_query_indexes_options : public common_options<get_all_query_indexe
66
66
  * @uncommitted
67
67
  */
68
68
 
69
- using get_all_indexes_handler = std::function<void(couchbase::manager_error_context, std::vector<couchbase::management::query::index>)>;
69
+ using get_all_query_indexes_handler =
70
+ std::function<void(couchbase::manager_error_context, std::vector<couchbase::management::query::index>)>;
70
71
 
71
72
  #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
72
73
  namespace core
@@ -84,7 +85,7 @@ void
84
85
  initiate_get_all_query_indexes(std::shared_ptr<couchbase::core::cluster> core,
85
86
  std::string bucket_name,
86
87
  couchbase::get_all_query_indexes_options::built options,
87
- get_all_indexes_handler&& handler);
88
+ get_all_query_indexes_handler&& handler);
88
89
 
89
90
  void
90
91
  initiate_get_all_query_indexes(std::shared_ptr<couchbase::core::cluster> core,
@@ -92,9 +93,9 @@ initiate_get_all_query_indexes(std::shared_ptr<couchbase::core::cluster> core,
92
93
  couchbase::get_all_query_indexes_options::built options,
93
94
  query_context query_ctx,
94
95
  std::string collection_name,
95
- get_all_indexes_handler&& handler);
96
+ get_all_query_indexes_handler&& handler);
96
97
 
97
98
  #endif
98
99
  } // namespace impl
99
100
  } // namespace core
100
- } // namespace couchbase
101
+ } // namespace couchbase
@@ -59,10 +59,12 @@ class query_index_manager
59
59
  * @since 1.0.0
60
60
  * @committed
61
61
  */
62
- void get_all_indexes(std::string bucket_name, const get_all_query_indexes_options& options, get_all_indexes_handler&& handler) const
62
+ void get_all_indexes(std::string bucket_name,
63
+ const get_all_query_indexes_options& options,
64
+ get_all_query_indexes_handler&& handler) const
63
65
  {
64
66
  return core::impl::initiate_get_all_query_indexes(
65
- core_, std::move(bucket_name), options.build(), std::forward<get_all_indexes_handler>(handler));
67
+ core_, std::move(bucket_name), options.build(), std::forward<get_all_query_indexes_handler>(handler));
66
68
  }
67
69
  [[nodiscard]] auto get_all_indexes(std::string bucket_name, const get_all_query_indexes_options& options) const
68
70
  -> std::future<std::pair<manager_error_context, std::vector<couchbase::management::query::index>>>
@@ -19,7 +19,6 @@
19
19
 
20
20
  #include <couchbase/codec/tao_json_serializer.hxx>
21
21
  #include <couchbase/common_options.hxx>
22
- #include <couchbase/key_value_error_context.hxx>
23
22
  #include <couchbase/mutation_state.hxx>
24
23
  #include <couchbase/query_error_context.hxx>
25
24
  #include <couchbase/query_profile.hxx>
@@ -17,6 +17,7 @@
17
17
 
18
18
  #pragma once
19
19
 
20
+ #include <couchbase/analytics_options.hxx>
20
21
  #include <couchbase/query_options.hxx>
21
22
 
22
23
  #include <memory>
@@ -121,7 +122,7 @@ class scope
121
122
  * @since 1.0.0
122
123
  * @committed
123
124
  */
124
- [[nodiscard]] auto query(std::string statement, const query_options& options) const
125
+ [[nodiscard]] auto query(std::string statement, const query_options& options = {}) const
125
126
  -> std::future<std::pair<query_error_context, query_result>>
126
127
  {
127
128
  auto barrier = std::make_shared<std::promise<std::pair<query_error_context, query_result>>>();
@@ -132,6 +133,38 @@ class scope
132
133
  return future;
133
134
  }
134
135
 
136
+ /**
137
+ * Performs a query against the analytics services.
138
+ *
139
+ * @param statement the query statement.
140
+ * @param options options to customize the query request.
141
+ * @param handler the handler that implements @ref query_handler
142
+ *
143
+ * @exception errc::common::ambiguous_timeout
144
+ * @exception errc::common::unambiguous_timeout
145
+ *
146
+ * @see https://docs.couchbase.com/server/current/analytics/introduction.html
147
+ *
148
+ * @since 1.0.0
149
+ * @committed
150
+ */
151
+ void analytics_query(std::string statement, const analytics_options& options, analytics_handler&& handler) const;
152
+
153
+ /**
154
+ * Performs a query against the analytics services.
155
+ *
156
+ * @param statement the query statement.
157
+ * @param options options to customize the query request.
158
+ * @return future object that carries result of the operation
159
+ *
160
+ * @see https://docs.couchbase.com/server/current/analytics/introduction.html
161
+ *
162
+ * @since 1.0.0
163
+ * @committed
164
+ */
165
+ [[nodiscard]] auto analytics_query(std::string statement, const analytics_options& options = {}) const
166
+ -> std::future<std::pair<analytics_error_context, analytics_result>>;
167
+
135
168
  private:
136
169
  friend class bucket;
137
170
 
@@ -71,7 +71,9 @@ class array_add_unique
71
71
  }
72
72
 
73
73
  private:
74
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
74
75
  friend couchbase::mutate_in_specs;
76
+ #endif
75
77
 
76
78
  array_add_unique(std::string path, std::vector<std::byte> value)
77
79
  : path_(std::move(path))
@@ -70,7 +70,9 @@ class array_append
70
70
  }
71
71
 
72
72
  private:
73
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
73
74
  friend couchbase::mutate_in_specs;
75
+ #endif
74
76
 
75
77
  array_append(std::string path, std::vector<std::vector<std::byte>> values)
76
78
  : path_(std::move(path))
@@ -71,7 +71,9 @@ class array_insert
71
71
  }
72
72
 
73
73
  private:
74
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
74
75
  friend couchbase::mutate_in_specs;
76
+ #endif
75
77
 
76
78
  array_insert(std::string path, std::vector<std::vector<std::byte>> values)
77
79
  : path_(std::move(path))
@@ -71,7 +71,9 @@ class array_prepend
71
71
  }
72
72
 
73
73
  private:
74
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
74
75
  friend couchbase::mutate_in_specs;
76
+ #endif
75
77
 
76
78
  array_prepend(std::string path, std::vector<std::vector<std::byte>> values)
77
79
  : path_(std::move(path))