couchbase 3.4.0 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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
@@ -1820,8 +1820,9 @@ cb_extract_option_bool(bool& field, VALUE options, const char* name)
1820
1820
  }
1821
1821
  }
1822
1822
 
1823
+ template<typename Integer>
1823
1824
  static void
1824
- cb_extract_option_number(std::size_t& field, VALUE options, const char* name)
1825
+ cb_extract_option_number(Integer& field, VALUE options, const char* name)
1825
1826
  {
1826
1827
  if (!NIL_P(options) && TYPE(options) == T_HASH) {
1827
1828
  VALUE val = rb_hash_aref(options, rb_id2sym(rb_intern(name)));
@@ -1830,10 +1831,10 @@ cb_extract_option_number(std::size_t& field, VALUE options, const char* name)
1830
1831
  }
1831
1832
  switch (TYPE(val)) {
1832
1833
  case T_FIXNUM:
1833
- field = FIX2ULONG(val);
1834
+ field = static_cast<Integer>(FIX2ULONG(val));
1834
1835
  break;
1835
1836
  case T_BIGNUM:
1836
- field = NUM2ULL(val);
1837
+ field = static_cast<Integer>(NUM2ULL(val));
1837
1838
  break;
1838
1839
  default:
1839
1840
  throw ruby_exception(rb_eArgError, rb_sprintf("%s must be a Integer, but given %+" PRIsVALUE, name, val));
@@ -1884,6 +1885,25 @@ cb_extract_option_string(std::string& target, VALUE options, const char* name);
1884
1885
  static void
1885
1886
  cb_extract_option_symbol(VALUE& val, VALUE options, const char* name);
1886
1887
 
1888
+ static void
1889
+ cb_extract_dns_config(couchbase::core::io::dns::dns_config& config, VALUE options)
1890
+ {
1891
+ if (!NIL_P(options) && TYPE(options) == T_HASH) {
1892
+ return;
1893
+ }
1894
+
1895
+ auto timeout{ couchbase::core::timeout_defaults::dns_srv_timeout };
1896
+ cb_extract_option_milliseconds(timeout, options, "dns_srv_timeout");
1897
+
1898
+ std::string nameserver{ couchbase::core::io::dns::dns_config::default_nameserver };
1899
+ cb_extract_option_string(nameserver, options, "dns_srv_nameserver");
1900
+
1901
+ std::uint16_t port{ couchbase::core::io::dns::dns_config::default_port };
1902
+ cb_extract_option_number(port, options, "dns_srv_port");
1903
+
1904
+ config = couchbase::core::io::dns::dns_config(nameserver, port, timeout);
1905
+ }
1906
+
1887
1907
  static VALUE
1888
1908
  cb_Backend_open(VALUE self, VALUE connection_string, VALUE credentials, VALUE options)
1889
1909
  {
@@ -1983,13 +2003,14 @@ cb_Backend_open(VALUE self, VALUE connection_string, VALUE credentials, VALUE op
1983
2003
  cb_extract_option_milliseconds(origin.options().analytics_timeout, options, "analytics_timeout");
1984
2004
  cb_extract_option_milliseconds(origin.options().search_timeout, options, "search_timeout");
1985
2005
  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
2006
  cb_extract_option_milliseconds(origin.options().tcp_keep_alive_interval, options, "tcp_keep_alive_interval");
1988
2007
  cb_extract_option_milliseconds(origin.options().config_poll_interval, options, "config_poll_interval");
1989
2008
  cb_extract_option_milliseconds(origin.options().config_poll_floor, options, "config_poll_floor");
1990
2009
  cb_extract_option_milliseconds(origin.options().config_idle_redial_timeout, options, "config_idle_redial_timeout");
1991
2010
  cb_extract_option_milliseconds(origin.options().idle_http_connection_timeout, options, "idle_http_connection_timeout");
1992
2011
 
2012
+ cb_extract_dns_config(origin.options().dns_config, options);
2013
+
1993
2014
  cb_extract_option_number(origin.options().max_http_connections, options, "max_http_connections");
1994
2015
 
1995
2016
  cb_extract_option_bool(origin.options().enable_tls, options, "enable_tls");
@@ -5084,9 +5105,9 @@ cb_Backend_query_index_get_all(VALUE self, VALUE bucket_name, VALUE options)
5084
5105
  VALUE indexes = rb_ary_new_capa(static_cast<long>(resp.indexes.size()));
5085
5106
  for (const auto& idx : resp.indexes) {
5086
5107
  VALUE index = rb_hash_new();
5087
- rb_hash_aset(index, rb_id2sym(rb_intern("state")), cb_str_new(idx.state));
5108
+ rb_hash_aset(index, rb_id2sym(rb_intern("state")), rb_id2sym(rb_intern(idx.state.c_str())));
5088
5109
  rb_hash_aset(index, rb_id2sym(rb_intern("name")), cb_str_new(idx.name));
5089
- rb_hash_aset(index, rb_id2sym(rb_intern("type")), cb_str_new(idx.type));
5110
+ rb_hash_aset(index, rb_id2sym(rb_intern("type")), rb_id2sym(rb_intern(idx.type.c_str())));
5090
5111
  rb_hash_aset(index, rb_id2sym(rb_intern("is_primary")), idx.is_primary ? Qtrue : Qfalse);
5091
5112
  VALUE index_key = rb_ary_new_capa(static_cast<long>(idx.index_key.size()));
5092
5113
  for (const auto& key : idx.index_key) {
@@ -5463,16 +5484,473 @@ cb_Backend_query_index_build_deferred(VALUE self, VALUE bucket_name, VALUE optio
5463
5484
  }
5464
5485
 
5465
5486
  static VALUE
5466
- cb_Backend_query_index_watch(VALUE /* self */, VALUE bucket_name, VALUE index_names, VALUE timeout, VALUE options)
5487
+ cb_Backend_collection_query_index_get_all(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE collection_name, VALUE options)
5488
+ {
5489
+ const auto& cluster = cb_backend_to_cluster(self);
5490
+
5491
+ Check_Type(bucket_name, T_STRING);
5492
+ Check_Type(scope_name, T_STRING);
5493
+ Check_Type(collection_name, T_STRING);
5494
+ if (!NIL_P(options)) {
5495
+ Check_Type(options, T_HASH);
5496
+ }
5497
+
5498
+ try {
5499
+ couchbase::core::operations::management::query_index_get_all_request req{};
5500
+ req.bucket_name = cb_string_new(bucket_name);
5501
+ req.scope_name = cb_string_new(scope_name);
5502
+ req.collection_name = cb_string_new(collection_name);
5503
+ cb_extract_timeout(req, options);
5504
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_get_all_response>>();
5505
+ auto f = barrier->get_future();
5506
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_get_all_response&& resp) {
5507
+ barrier->set_value(std::move(resp));
5508
+ });
5509
+ auto resp = cb_wait_for_future(f);
5510
+ if (resp.ctx.ec) {
5511
+ cb_throw_error_code(resp.ctx, fmt::format("unable to get list of the indexes of the collection \"{}\"", req.collection_name));
5512
+ }
5513
+
5514
+ VALUE res = rb_hash_new();
5515
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5516
+ VALUE indexes = rb_ary_new_capa(static_cast<long>(resp.indexes.size()));
5517
+ for (const auto& idx : resp.indexes) {
5518
+ VALUE index = rb_hash_new();
5519
+ rb_hash_aset(index, rb_id2sym(rb_intern("state")), rb_id2sym(rb_intern(idx.state.c_str())));
5520
+ rb_hash_aset(index, rb_id2sym(rb_intern("name")), cb_str_new(idx.name));
5521
+ rb_hash_aset(index, rb_id2sym(rb_intern("type")), rb_id2sym(rb_intern(idx.type.c_str())));
5522
+ rb_hash_aset(index, rb_id2sym(rb_intern("is_primary")), idx.is_primary ? Qtrue : Qfalse);
5523
+ VALUE index_key = rb_ary_new_capa(static_cast<long>(idx.index_key.size()));
5524
+ for (const auto& key : idx.index_key) {
5525
+ rb_ary_push(index_key, cb_str_new(key));
5526
+ }
5527
+ rb_hash_aset(index, rb_id2sym(rb_intern("index_key")), index_key);
5528
+ if (idx.collection_name) {
5529
+ rb_hash_aset(index, rb_id2sym(rb_intern("collection_name")), cb_str_new(idx.collection_name.value()));
5530
+ }
5531
+ if (idx.scope_name) {
5532
+ rb_hash_aset(index, rb_id2sym(rb_intern("scope_name")), cb_str_new(idx.scope_name.value()));
5533
+ }
5534
+ rb_hash_aset(index, rb_id2sym(rb_intern("bucket_name")), cb_str_new(idx.bucket_name));
5535
+ if (idx.condition) {
5536
+ rb_hash_aset(index, rb_id2sym(rb_intern("condition")), cb_str_new(idx.condition.value()));
5537
+ }
5538
+ if (idx.partition) {
5539
+ rb_hash_aset(index, rb_id2sym(rb_intern("partition")), cb_str_new(idx.partition.value()));
5540
+ }
5541
+ rb_ary_push(indexes, index);
5542
+ }
5543
+
5544
+ rb_hash_aset(res, rb_id2sym(rb_intern("indexes")), indexes);
5545
+
5546
+ return res;
5547
+ } catch (const std::system_error& se) {
5548
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5549
+ } catch (const ruby_exception& e) {
5550
+ rb_exc_raise(e.exception_object());
5551
+ }
5552
+ return Qnil;
5553
+ }
5554
+
5555
+ static VALUE
5556
+ cb_Backend_collection_query_index_create(VALUE self,
5557
+ VALUE bucket_name,
5558
+ VALUE scope_name,
5559
+ VALUE collection_name,
5560
+ VALUE index_name,
5561
+ VALUE fields,
5562
+ VALUE options)
5563
+ {
5564
+ const auto& cluster = cb_backend_to_cluster(self);
5565
+
5566
+ Check_Type(bucket_name, T_STRING);
5567
+ Check_Type(scope_name, T_STRING);
5568
+ Check_Type(collection_name, T_STRING);
5569
+ Check_Type(index_name, T_STRING);
5570
+ Check_Type(fields, T_ARRAY);
5571
+ if (!NIL_P(options)) {
5572
+ Check_Type(options, T_HASH);
5573
+ }
5574
+
5575
+ try {
5576
+ couchbase::core::operations::management::query_index_create_request req{};
5577
+ cb_extract_timeout(req, options);
5578
+ req.bucket_name = cb_string_new(bucket_name);
5579
+ req.scope_name = cb_string_new(scope_name);
5580
+ req.collection_name = cb_string_new(collection_name);
5581
+ req.index_name = cb_string_new(index_name);
5582
+ auto fields_num = static_cast<std::size_t>(RARRAY_LEN(fields));
5583
+ req.fields.reserve(fields_num);
5584
+ for (std::size_t i = 0; i < fields_num; ++i) {
5585
+ VALUE entry = rb_ary_entry(fields, static_cast<long>(i));
5586
+ cb_check_type(entry, T_STRING);
5587
+ req.fields.emplace_back(RSTRING_PTR(entry), static_cast<std::size_t>(RSTRING_LEN(entry)));
5588
+ }
5589
+ if (!NIL_P(options)) {
5590
+ if (VALUE ignore_if_exists = rb_hash_aref(options, rb_id2sym(rb_intern("ignore_if_exists"))); ignore_if_exists == Qtrue) {
5591
+ req.ignore_if_exists = true;
5592
+ } else if (ignore_if_exists == Qfalse) {
5593
+ req.ignore_if_exists = false;
5594
+ } /* else use backend default */
5595
+ if (VALUE deferred = rb_hash_aref(options, rb_id2sym(rb_intern("deferred"))); deferred == Qtrue) {
5596
+ req.deferred = true;
5597
+ } else if (deferred == Qfalse) {
5598
+ req.deferred = false;
5599
+ } /* else use backend default */
5600
+ if (VALUE num_replicas = rb_hash_aref(options, rb_id2sym(rb_intern("num_replicas"))); !NIL_P(num_replicas)) {
5601
+ req.num_replicas = NUM2UINT(num_replicas);
5602
+ } /* else use backend default */
5603
+ if (VALUE condition = rb_hash_aref(options, rb_id2sym(rb_intern("condition"))); !NIL_P(condition)) {
5604
+ req.condition.emplace(cb_string_new(condition));
5605
+ } /* else use backend default */
5606
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5607
+ req.scope_name = cb_string_new(scope_name);
5608
+ }
5609
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5610
+ req.collection_name = cb_string_new(collection_name);
5611
+ }
5612
+ }
5613
+
5614
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_create_response>>();
5615
+ auto f = barrier->get_future();
5616
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_create_response&& resp) {
5617
+ barrier->set_value(std::move(resp));
5618
+ });
5619
+ auto resp = cb_wait_for_future(f);
5620
+ if (resp.ctx.ec) {
5621
+ if (!resp.errors.empty()) {
5622
+ const auto& first_error = resp.errors.front();
5623
+ cb_throw_error_code(resp.ctx,
5624
+ fmt::format(R"(unable to create index "{}" on the collection "{}" ({}: {}))",
5625
+ req.index_name,
5626
+ req.collection_name,
5627
+ first_error.code,
5628
+ first_error.message));
5629
+ } else {
5630
+ cb_throw_error_code(
5631
+ resp.ctx, fmt::format(R"(unable to create index "{}" on the collection "{}")", req.index_name, req.collection_name));
5632
+ }
5633
+ }
5634
+ VALUE res = rb_hash_new();
5635
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5636
+ if (!resp.errors.empty()) {
5637
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5638
+ for (const auto& err : resp.errors) {
5639
+ VALUE error = rb_hash_new();
5640
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5641
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5642
+ rb_ary_push(errors, error);
5643
+ }
5644
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5645
+ }
5646
+ return res;
5647
+ } catch (const std::system_error& se) {
5648
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5649
+ } catch (const ruby_exception& e) {
5650
+ rb_exc_raise(e.exception_object());
5651
+ }
5652
+ return Qnil;
5653
+ }
5654
+
5655
+ static VALUE
5656
+ cb_Backend_collection_query_index_drop(VALUE self,
5657
+ VALUE bucket_name,
5658
+ VALUE scope_name,
5659
+ VALUE collection_name,
5660
+ VALUE index_name,
5661
+ VALUE options)
5662
+ {
5663
+ const auto& cluster = cb_backend_to_cluster(self);
5664
+
5665
+ Check_Type(bucket_name, T_STRING);
5666
+ Check_Type(scope_name, T_STRING);
5667
+ Check_Type(collection_name, T_STRING);
5668
+ Check_Type(index_name, T_STRING);
5669
+ if (!NIL_P(options)) {
5670
+ Check_Type(options, T_HASH);
5671
+ }
5672
+
5673
+ try {
5674
+ couchbase::core::operations::management::query_index_drop_request req{};
5675
+ cb_extract_timeout(req, options);
5676
+ req.bucket_name = cb_string_new(bucket_name);
5677
+ req.scope_name = cb_string_new(scope_name);
5678
+ req.collection_name = cb_string_new(collection_name);
5679
+ req.index_name = cb_string_new(index_name);
5680
+ if (!NIL_P(options)) {
5681
+ if (VALUE ignore_if_does_not_exist = rb_hash_aref(options, rb_id2sym(rb_intern("ignore_if_does_not_exist")));
5682
+ ignore_if_does_not_exist == Qtrue) {
5683
+ req.ignore_if_does_not_exist = true;
5684
+ } else if (ignore_if_does_not_exist == Qfalse) {
5685
+ req.ignore_if_does_not_exist = false;
5686
+ } /* else use backend default */
5687
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5688
+ req.scope_name = cb_string_new(scope_name);
5689
+ }
5690
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5691
+ req.collection_name = cb_string_new(collection_name);
5692
+ }
5693
+ }
5694
+
5695
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_drop_response>>();
5696
+ auto f = barrier->get_future();
5697
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_drop_response&& resp) {
5698
+ barrier->set_value(std::move(resp));
5699
+ });
5700
+ auto resp = cb_wait_for_future(f);
5701
+ if (resp.ctx.ec) {
5702
+ if (!resp.errors.empty()) {
5703
+ const auto& first_error = resp.errors.front();
5704
+ cb_throw_error_code(resp.ctx,
5705
+ fmt::format(R"(unable to drop index "{}" on the collection "{}" ({}: {}))",
5706
+ req.index_name,
5707
+ req.collection_name,
5708
+ first_error.code,
5709
+ first_error.message));
5710
+ } else {
5711
+ cb_throw_error_code(
5712
+ resp.ctx, fmt::format(R"(unable to drop index "{}" on the collection "{}")", req.index_name, req.collection_name));
5713
+ }
5714
+ }
5715
+ VALUE res = rb_hash_new();
5716
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5717
+ if (!resp.errors.empty()) {
5718
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5719
+ for (const auto& err : resp.errors) {
5720
+ VALUE error = rb_hash_new();
5721
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5722
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5723
+ rb_ary_push(errors, error);
5724
+ }
5725
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5726
+ }
5727
+ return res;
5728
+ } catch (const std::system_error& se) {
5729
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5730
+ } catch (const ruby_exception& e) {
5731
+ rb_exc_raise(e.exception_object());
5732
+ }
5733
+ return Qnil;
5734
+ }
5735
+
5736
+ static VALUE
5737
+ cb_Backend_collection_query_index_create_primary(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE collection_name, VALUE options)
5738
+ {
5739
+ const auto& cluster = cb_backend_to_cluster(self);
5740
+
5741
+ Check_Type(bucket_name, T_STRING);
5742
+ Check_Type(scope_name, T_STRING);
5743
+ Check_Type(collection_name, T_STRING);
5744
+ if (!NIL_P(options)) {
5745
+ Check_Type(options, T_HASH);
5746
+ }
5747
+
5748
+ try {
5749
+ couchbase::core::operations::management::query_index_create_request req{};
5750
+ cb_extract_timeout(req, options);
5751
+ req.is_primary = true;
5752
+ req.bucket_name = cb_string_new(bucket_name);
5753
+ req.scope_name = cb_string_new(scope_name);
5754
+ req.collection_name = cb_string_new(collection_name);
5755
+ if (!NIL_P(options)) {
5756
+ if (VALUE ignore_if_exists = rb_hash_aref(options, rb_id2sym(rb_intern("ignore_if_exists"))); ignore_if_exists == Qtrue) {
5757
+ req.ignore_if_exists = true;
5758
+ } else if (ignore_if_exists == Qfalse) {
5759
+ req.ignore_if_exists = false;
5760
+ } /* else use backend default */
5761
+ if (VALUE deferred = rb_hash_aref(options, rb_id2sym(rb_intern("deferred"))); deferred == Qtrue) {
5762
+ req.deferred = true;
5763
+ } else if (deferred == Qfalse) {
5764
+ req.deferred = false;
5765
+ } /* else use backend default */
5766
+ if (VALUE num_replicas = rb_hash_aref(options, rb_id2sym(rb_intern("num_replicas"))); !NIL_P(num_replicas)) {
5767
+ req.num_replicas = NUM2UINT(num_replicas);
5768
+ } /* else use backend default */
5769
+ if (VALUE index_name = rb_hash_aref(options, rb_id2sym(rb_intern("index_name"))); TYPE(index_name) == T_STRING) {
5770
+ req.index_name = cb_string_new(index_name);
5771
+ } /* else use backend default */
5772
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5773
+ req.scope_name = cb_string_new(scope_name);
5774
+ }
5775
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5776
+ req.collection_name = cb_string_new(collection_name);
5777
+ }
5778
+ }
5779
+
5780
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_create_response>>();
5781
+ auto f = barrier->get_future();
5782
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_create_response&& resp) {
5783
+ barrier->set_value(std::move(resp));
5784
+ });
5785
+ auto resp = cb_wait_for_future(f);
5786
+ if (resp.ctx.ec) {
5787
+ if (!resp.errors.empty()) {
5788
+ const auto& first_error = resp.errors.front();
5789
+ cb_throw_error_code(resp.ctx,
5790
+ fmt::format(R"(unable to create primary index on the collection "{}" ({}: {}))",
5791
+ req.collection_name,
5792
+ first_error.code,
5793
+ first_error.message));
5794
+ } else {
5795
+ cb_throw_error_code(resp.ctx, fmt::format(R"(unable to create primary index on the collection "{}")", req.collection_name));
5796
+ }
5797
+ }
5798
+ VALUE res = rb_hash_new();
5799
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5800
+ if (!resp.errors.empty()) {
5801
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5802
+ for (const auto& err : resp.errors) {
5803
+ VALUE error = rb_hash_new();
5804
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5805
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5806
+ rb_ary_push(errors, error);
5807
+ }
5808
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5809
+ }
5810
+ return res;
5811
+ } catch (const std::system_error& se) {
5812
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5813
+ } catch (const ruby_exception& e) {
5814
+ rb_exc_raise(e.exception_object());
5815
+ }
5816
+ return Qnil;
5817
+ }
5818
+
5819
+ static VALUE
5820
+ cb_Backend_collection_query_index_drop_primary(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE collection_name, VALUE options)
5821
+ {
5822
+ const auto& cluster = cb_backend_to_cluster(self);
5823
+
5824
+ Check_Type(bucket_name, T_STRING);
5825
+ Check_Type(scope_name, T_STRING);
5826
+ Check_Type(collection_name, T_STRING);
5827
+ if (!NIL_P(options)) {
5828
+ Check_Type(options, T_HASH);
5829
+ }
5830
+
5831
+ try {
5832
+ couchbase::core::operations::management::query_index_drop_request req{};
5833
+ cb_extract_timeout(req, options);
5834
+ req.is_primary = true;
5835
+ req.bucket_name = cb_string_new(bucket_name);
5836
+ req.scope_name = cb_string_new(scope_name);
5837
+ req.collection_name = cb_string_new(collection_name);
5838
+ if (!NIL_P(options)) {
5839
+ if (VALUE ignore_if_does_not_exist = rb_hash_aref(options, rb_id2sym(rb_intern("ignore_if_does_not_exist")));
5840
+ ignore_if_does_not_exist == Qtrue) {
5841
+ req.ignore_if_does_not_exist = true;
5842
+ } else if (ignore_if_does_not_exist == Qfalse) {
5843
+ req.ignore_if_does_not_exist = false;
5844
+ } /* else use backend default */
5845
+ if (VALUE index_name = rb_hash_aref(options, rb_id2sym(rb_intern("index_name"))); !NIL_P(index_name)) {
5846
+ cb_check_type(options, T_STRING);
5847
+ req.is_primary = false;
5848
+ req.bucket_name = cb_string_new(index_name);
5849
+ }
5850
+ if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name"))); TYPE(scope_name) == T_STRING) {
5851
+ req.scope_name = cb_string_new(scope_name);
5852
+ }
5853
+ if (VALUE collection_name = rb_hash_aref(options, rb_id2sym(rb_intern("collection_name"))); TYPE(collection_name) == T_STRING) {
5854
+ req.collection_name = cb_string_new(collection_name);
5855
+ }
5856
+ }
5857
+
5858
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_drop_response>>();
5859
+ auto f = barrier->get_future();
5860
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_drop_response&& resp) {
5861
+ barrier->set_value(std::move(resp));
5862
+ });
5863
+ auto resp = cb_wait_for_future(f);
5864
+ if (resp.ctx.ec) {
5865
+ if (!resp.errors.empty()) {
5866
+ const auto& first_error = resp.errors.front();
5867
+ cb_throw_error_code(resp.ctx,
5868
+ fmt::format(R"(unable to drop primary index on the collection "{}" ({}: {}))",
5869
+ req.collection_name,
5870
+ first_error.code,
5871
+ first_error.message));
5872
+ } else {
5873
+ cb_throw_error_code(resp.ctx, fmt::format(R"(unable to drop primary index on the collection "{}")", req.collection_name));
5874
+ }
5875
+ }
5876
+ VALUE res = rb_hash_new();
5877
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5878
+ if (!resp.errors.empty()) {
5879
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5880
+ for (const auto& err : resp.errors) {
5881
+ VALUE error = rb_hash_new();
5882
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5883
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5884
+ rb_ary_push(errors, error);
5885
+ }
5886
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5887
+ }
5888
+ return res;
5889
+ } catch (const std::system_error& se) {
5890
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5891
+ } catch (const ruby_exception& e) {
5892
+ rb_exc_raise(e.exception_object());
5893
+ }
5894
+ return Qnil;
5895
+ }
5896
+
5897
+ static VALUE
5898
+ cb_Backend_collection_query_index_build_deferred(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE collection_name, VALUE options)
5467
5899
  {
5900
+ const auto& cluster = cb_backend_to_cluster(self);
5901
+
5468
5902
  Check_Type(bucket_name, T_STRING);
5469
- Check_Type(index_names, T_ARRAY);
5470
- Check_Type(timeout, T_FIXNUM);
5903
+ Check_Type(scope_name, T_STRING);
5904
+ Check_Type(collection_name, T_STRING);
5471
5905
  if (!NIL_P(options)) {
5472
5906
  Check_Type(options, T_HASH);
5473
5907
  }
5474
5908
 
5475
- return Qtrue;
5909
+ try {
5910
+ couchbase::core::operations::management::query_index_build_deferred_request req{};
5911
+ cb_extract_timeout(req, options);
5912
+ req.bucket_name = cb_string_new(bucket_name);
5913
+ req.scope_name = cb_string_new(scope_name);
5914
+ req.collection_name = cb_string_new(collection_name);
5915
+
5916
+ auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_build_deferred_response>>();
5917
+ auto f = barrier->get_future();
5918
+ cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_build_deferred_response&& resp) {
5919
+ barrier->set_value(std::move(resp));
5920
+ });
5921
+ auto resp = cb_wait_for_future(f);
5922
+ if (resp.ctx.ec) {
5923
+ if (!resp.errors.empty()) {
5924
+ const auto& first_error = resp.errors.front();
5925
+ cb_throw_error_code(resp.ctx,
5926
+ fmt::format(R"(unable to build deferred indexes on the collection "{}" ({}: {}))",
5927
+ req.collection_name.value(),
5928
+ first_error.code,
5929
+ first_error.message));
5930
+ } else {
5931
+ cb_throw_error_code(resp.ctx,
5932
+ fmt::format(R"(unable to build deferred indexes on the collection "{}")", req.collection_name.value()));
5933
+ }
5934
+ }
5935
+ VALUE res = rb_hash_new();
5936
+ rb_hash_aset(res, rb_id2sym(rb_intern("status")), cb_str_new(resp.status));
5937
+ if (!resp.errors.empty()) {
5938
+ VALUE errors = rb_ary_new_capa(static_cast<long>(resp.errors.size()));
5939
+ for (const auto& err : resp.errors) {
5940
+ VALUE error = rb_hash_new();
5941
+ rb_hash_aset(error, rb_id2sym(rb_intern("code")), ULL2NUM(err.code));
5942
+ rb_hash_aset(error, rb_id2sym(rb_intern("message")), cb_str_new(err.message));
5943
+ rb_ary_push(errors, error);
5944
+ }
5945
+ rb_hash_aset(res, rb_id2sym(rb_intern("errors")), errors);
5946
+ }
5947
+ return res;
5948
+ } catch (const std::system_error& se) {
5949
+ rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
5950
+ } catch (const ruby_exception& e) {
5951
+ rb_exc_raise(e.exception_object());
5952
+ }
5953
+ return Qnil;
5476
5954
  }
5477
5955
 
5478
5956
  static void
@@ -6150,19 +6628,15 @@ cb_Backend_document_search(VALUE self, VALUE index_name, VALUE query, VALUE opti
6150
6628
  }
6151
6629
  }
6152
6630
 
6153
- if (VALUE scope_name = rb_hash_aref(options, rb_id2sym(rb_intern("scope_name")));
6154
- !NIL_P(scope_name) && TYPE(scope_name) == T_STRING) {
6155
- req.scope_name.emplace(cb_string_new(scope_name));
6156
- VALUE collections = rb_hash_aref(options, rb_id2sym(rb_intern("collections")));
6157
- if (!NIL_P(collections)) {
6158
- cb_check_type(collections, T_ARRAY);
6159
- auto collections_size = static_cast<std::size_t>(RARRAY_LEN(collections));
6160
- req.collections.reserve(collections_size);
6161
- for (std::size_t i = 0; i < collections_size; ++i) {
6162
- VALUE collection = rb_ary_entry(collections, static_cast<long>(i));
6163
- cb_check_type(collection, T_STRING);
6164
- req.collections.emplace_back(cb_string_new(collection));
6165
- }
6631
+ VALUE collections = rb_hash_aref(options, rb_id2sym(rb_intern("collections")));
6632
+ if (!NIL_P(collections)) {
6633
+ cb_check_type(collections, T_ARRAY);
6634
+ auto collections_size = static_cast<std::size_t>(RARRAY_LEN(collections));
6635
+ req.collections.reserve(collections_size);
6636
+ for (std::size_t i = 0; i < collections_size; ++i) {
6637
+ VALUE collection = rb_ary_entry(collections, static_cast<long>(i));
6638
+ cb_check_type(collection, T_STRING);
6639
+ req.collections.emplace_back(cb_string_new(collection));
6166
6640
  }
6167
6641
  }
6168
6642
 
@@ -6366,12 +6840,12 @@ cb_Backend_dns_srv(VALUE self, VALUE hostname, VALUE service)
6366
6840
  if (tls) {
6367
6841
  service_name = "_couchbases";
6368
6842
  }
6369
- auto barrier = std::make_shared<std::promise<couchbase::core::io::dns::dns_client::dns_srv_response>>();
6843
+ auto barrier = std::make_shared<std::promise<couchbase::core::io::dns::dns_srv_response>>();
6370
6844
  auto f = barrier->get_future();
6371
6845
  client.query_srv(host_name,
6372
6846
  service_name,
6373
6847
  couchbase::core::io::dns::dns_config::system_config(),
6374
- [barrier](couchbase::core::io::dns::dns_client::dns_srv_response&& resp) { barrier->set_value(std::move(resp)); });
6848
+ [barrier](couchbase::core::io::dns::dns_srv_response&& resp) { barrier->set_value(std::move(resp)); });
6375
6849
  ctx.run();
6376
6850
  auto resp = cb_wait_for_future(f);
6377
6851
  if (resp.ec) {
@@ -8132,7 +8606,13 @@ init_backend(VALUE mCouchbase)
8132
8606
  rb_define_method(cBackend, "query_index_drop", VALUE_FUNC(cb_Backend_query_index_drop), 3);
8133
8607
  rb_define_method(cBackend, "query_index_drop_primary", VALUE_FUNC(cb_Backend_query_index_drop_primary), 2);
8134
8608
  rb_define_method(cBackend, "query_index_build_deferred", VALUE_FUNC(cb_Backend_query_index_build_deferred), 2);
8135
- rb_define_method(cBackend, "query_index_watch", VALUE_FUNC(cb_Backend_query_index_watch), 4);
8609
+
8610
+ rb_define_method(cBackend, "collection_query_index_get_all", VALUE_FUNC(cb_Backend_collection_query_index_get_all), 4);
8611
+ rb_define_method(cBackend, "collection_query_index_create", VALUE_FUNC(cb_Backend_collection_query_index_create), 6);
8612
+ rb_define_method(cBackend, "collection_query_index_create_primary", VALUE_FUNC(cb_Backend_collection_query_index_create_primary), 4);
8613
+ rb_define_method(cBackend, "collection_query_index_drop", VALUE_FUNC(cb_Backend_collection_query_index_drop), 5);
8614
+ rb_define_method(cBackend, "collection_query_index_drop_primary", VALUE_FUNC(cb_Backend_collection_query_index_drop_primary), 4);
8615
+ rb_define_method(cBackend, "collection_query_index_build_deferred", VALUE_FUNC(cb_Backend_collection_query_index_build_deferred), 4);
8136
8616
 
8137
8617
  rb_define_method(cBackend, "search_get_stats", VALUE_FUNC(cb_Backend_search_get_stats), 1);
8138
8618
  rb_define_method(cBackend, "search_index_get_all", VALUE_FUNC(cb_Backend_search_index_get_all), 1);