couchbase 3.4.2 → 3.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/couchbase/CMakeLists.txt +57 -7
- data/ext/couchbase/cmake/Documentation.cmake +0 -1
- data/ext/couchbase/cmake/OpenSSL.cmake +98 -3
- data/ext/couchbase/cmake/Testing.cmake +12 -4
- data/ext/couchbase/cmake/build_config.hxx.in +3 -0
- data/ext/couchbase/core/bucket.cxx +3 -2
- data/ext/couchbase/core/bucket.hxx +9 -0
- data/ext/couchbase/core/cluster.hxx +17 -0
- data/ext/couchbase/core/cluster_options.cxx +2 -2
- data/ext/couchbase/core/cluster_options.hxx +4 -6
- data/ext/couchbase/core/cluster_options_fwd.hxx +26 -0
- data/ext/couchbase/core/config_profile.hxx +1 -54
- data/ext/couchbase/core/config_profiles.cxx +79 -0
- data/ext/couchbase/core/config_profiles.hxx +56 -0
- data/ext/couchbase/core/error_context/search.hxx +1 -1
- data/ext/couchbase/core/impl/analytics.cxx +1 -0
- data/ext/couchbase/core/impl/boolean_field_query.cxx +40 -0
- data/ext/couchbase/core/impl/boolean_query.cxx +62 -0
- data/ext/couchbase/core/impl/cluster.cxx +2 -0
- data/ext/couchbase/core/impl/conjunction_query.cxx +51 -0
- data/ext/couchbase/core/impl/date_range.cxx +89 -0
- data/ext/couchbase/core/impl/date_range_facet.cxx +54 -0
- data/ext/couchbase/core/impl/date_range_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/date_range_query.cxx +125 -0
- data/ext/couchbase/core/impl/disjunction_query.cxx +51 -0
- data/ext/couchbase/core/impl/encoded_search_facet.hxx +29 -0
- data/ext/couchbase/core/impl/encoded_search_query.hxx +29 -0
- data/ext/couchbase/core/impl/encoded_search_sort.hxx +29 -0
- data/ext/couchbase/core/impl/geo_bounding_box_query.cxx +46 -0
- data/ext/couchbase/core/impl/geo_distance_query.cxx +43 -0
- data/ext/couchbase/core/impl/geo_polygon_query.cxx +46 -0
- data/ext/couchbase/core/impl/internal_date_range_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_date_range_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/internal_numeric_range_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_numeric_range_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/internal_search_error_context.cxx +141 -0
- data/ext/couchbase/core/impl/internal_search_error_context.hxx +61 -0
- data/ext/couchbase/core/impl/internal_search_meta_data.cxx +60 -0
- data/ext/couchbase/core/impl/internal_search_meta_data.hxx +41 -0
- data/ext/couchbase/core/impl/internal_search_result.cxx +84 -0
- data/ext/couchbase/core/impl/internal_search_result.hxx +43 -0
- data/ext/couchbase/core/impl/internal_search_row.cxx +82 -0
- data/ext/couchbase/core/impl/internal_search_row.hxx +56 -0
- data/ext/couchbase/core/impl/internal_search_row_location.hxx +32 -0
- data/ext/couchbase/core/impl/internal_search_row_locations.cxx +137 -0
- data/ext/couchbase/core/impl/internal_search_row_locations.hxx +45 -0
- data/ext/couchbase/core/impl/internal_term_facet_result.cxx +80 -0
- data/ext/couchbase/core/impl/internal_term_facet_result.hxx +48 -0
- data/ext/couchbase/core/impl/match_all_query.cxx +35 -0
- data/ext/couchbase/core/impl/match_none_query.cxx +35 -0
- data/ext/couchbase/core/impl/match_phrase_query.cxx +43 -0
- data/ext/couchbase/core/impl/match_query.cxx +59 -0
- data/ext/couchbase/core/impl/numeric_range.cxx +49 -0
- data/ext/couchbase/core/impl/numeric_range_facet.cxx +54 -0
- data/ext/couchbase/core/impl/numeric_range_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/numeric_range_query.cxx +56 -0
- data/ext/couchbase/core/impl/phrase_query.cxx +42 -0
- data/ext/couchbase/core/impl/prefix_query.cxx +40 -0
- data/ext/couchbase/core/impl/query_string_query.cxx +37 -0
- data/ext/couchbase/core/impl/regexp_query.cxx +40 -0
- data/ext/couchbase/core/impl/search.cxx +191 -0
- data/ext/couchbase/core/impl/search_error_context.cxx +147 -0
- data/ext/couchbase/core/impl/search_meta_data.cxx +46 -0
- data/ext/couchbase/core/impl/search_result.cxx +66 -0
- data/ext/couchbase/core/impl/search_row.cxx +74 -0
- data/ext/couchbase/core/impl/search_row_location.cxx +64 -0
- data/ext/couchbase/core/impl/search_row_locations.cxx +66 -0
- data/ext/couchbase/core/impl/search_sort_field.cxx +104 -0
- data/ext/couchbase/core/impl/search_sort_id.cxx +43 -0
- data/ext/couchbase/core/impl/search_sort_score.cxx +43 -0
- data/ext/couchbase/core/impl/term_facet.cxx +36 -0
- data/ext/couchbase/core/impl/term_facet_result.cxx +64 -0
- data/ext/couchbase/core/impl/term_query.cxx +56 -0
- data/ext/couchbase/core/impl/term_range_query.cxx +57 -0
- data/ext/couchbase/core/impl/wildcard_query.cxx +40 -0
- data/ext/couchbase/core/io/http_context.hxx +1 -1
- data/ext/couchbase/core/io/http_session.hxx +10 -0
- data/ext/couchbase/core/io/http_session_manager.hxx +5 -3
- data/ext/couchbase/core/io/mcbp_session.cxx +28 -1
- data/ext/couchbase/core/io/retry_orchestrator.hxx +3 -2
- data/ext/couchbase/core/json_string.hxx +5 -0
- data/ext/couchbase/core/meta/version.cxx +18 -4
- data/ext/couchbase/core/mozilla_ca_bundle.hxx +39 -0
- data/ext/couchbase/core/operations/document_analytics.cxx +1 -0
- data/ext/couchbase/core/operations/document_analytics.hxx +1 -0
- data/ext/couchbase/core/operations/document_append.hxx +1 -1
- data/ext/couchbase/core/operations/document_decrement.hxx +1 -1
- data/ext/couchbase/core/operations/document_exists.hxx +1 -1
- data/ext/couchbase/core/operations/document_get.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_and_lock.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_and_touch.hxx +1 -1
- data/ext/couchbase/core/operations/document_get_projected.hxx +1 -1
- data/ext/couchbase/core/operations/document_increment.hxx +1 -1
- data/ext/couchbase/core/operations/document_insert.hxx +1 -1
- data/ext/couchbase/core/operations/document_lookup_in.hxx +1 -1
- data/ext/couchbase/core/operations/document_mutate_in.hxx +1 -1
- data/ext/couchbase/core/operations/document_prepend.hxx +1 -1
- data/ext/couchbase/core/operations/document_query.cxx +2 -0
- data/ext/couchbase/core/operations/document_query.hxx +6 -0
- data/ext/couchbase/core/operations/document_remove.hxx +1 -1
- data/ext/couchbase/core/operations/document_replace.hxx +1 -1
- data/ext/couchbase/core/operations/document_search.cxx +4 -1
- data/ext/couchbase/core/operations/document_search.hxx +2 -1
- data/ext/couchbase/core/operations/document_touch.hxx +1 -1
- data/ext/couchbase/core/operations/document_unlock.hxx +1 -1
- data/ext/couchbase/core/operations/document_upsert.hxx +1 -1
- data/ext/couchbase/core/operations/document_view.hxx +1 -0
- data/ext/couchbase/core/protocol/client_request.hxx +11 -2
- data/ext/couchbase/core/public_fwd.hxx +21 -0
- data/ext/couchbase/core/tls_verify_mode.hxx +26 -0
- data/ext/couchbase/core/topology/configuration.cxx +15 -2
- data/ext/couchbase/core/topology/configuration.hxx +5 -1
- data/ext/couchbase/core/transactions/attempt_context_testing_hooks.cxx +93 -0
- data/ext/couchbase/core/transactions/attempt_context_testing_hooks.hxx +48 -75
- data/ext/couchbase/core/transactions/cleanup_testing_hooks.cxx +52 -0
- data/ext/couchbase/core/transactions/cleanup_testing_hooks.hxx +17 -31
- data/ext/couchbase/core/transactions/exceptions.hxx +12 -9
- data/ext/couchbase/core/utils/connection_string.cxx +17 -0
- data/ext/couchbase/core/utils/json.cxx +4 -1
- data/ext/couchbase/couchbase/behavior_options.hxx +10 -1
- data/ext/couchbase/couchbase/boolean_field_query.hxx +77 -0
- data/ext/couchbase/couchbase/boolean_query.hxx +223 -0
- data/ext/couchbase/couchbase/cluster.hxx +42 -1
- data/ext/couchbase/couchbase/conjunction_query.hxx +88 -0
- data/ext/couchbase/couchbase/date_range.hxx +69 -0
- data/ext/couchbase/couchbase/date_range_facet.hxx +56 -0
- data/ext/couchbase/couchbase/date_range_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/date_range_query.hxx +265 -0
- data/ext/couchbase/couchbase/disjunction_query.hxx +109 -0
- data/ext/couchbase/couchbase/doc_id_query.hxx +111 -0
- data/ext/couchbase/couchbase/error_context.hxx +7 -6
- data/ext/couchbase/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
- data/ext/couchbase/couchbase/fmt/search_scan_consistency.hxx +49 -0
- data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +107 -0
- data/ext/couchbase/couchbase/geo_distance_query.hxx +109 -0
- data/ext/couchbase/couchbase/geo_point.hxx +32 -0
- data/ext/couchbase/couchbase/geo_polygon_query.hxx +85 -0
- data/ext/couchbase/couchbase/highlight_style.hxx +45 -0
- data/ext/couchbase/couchbase/match_all_query.hxx +43 -0
- data/ext/couchbase/couchbase/match_none_query.hxx +43 -0
- data/ext/couchbase/couchbase/match_operator.hxx +45 -0
- data/ext/couchbase/couchbase/match_phrase_query.hxx +108 -0
- data/ext/couchbase/couchbase/match_query.hxx +163 -0
- data/ext/couchbase/couchbase/numeric_range.hxx +58 -0
- data/ext/couchbase/couchbase/numeric_range_facet.hxx +56 -0
- data/ext/couchbase/couchbase/numeric_range_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/numeric_range_query.hxx +143 -0
- data/ext/couchbase/couchbase/phrase_query.hxx +93 -0
- data/ext/couchbase/couchbase/prefix_query.hxx +82 -0
- data/ext/couchbase/couchbase/query_string_query.hxx +72 -0
- data/ext/couchbase/couchbase/regexp_query.hxx +82 -0
- data/ext/couchbase/couchbase/scope.hxx +40 -0
- data/ext/couchbase/couchbase/search_date_range.hxx +68 -0
- data/ext/couchbase/couchbase/search_error_context.hxx +138 -0
- data/ext/couchbase/couchbase/search_facet.hxx +60 -0
- data/ext/couchbase/couchbase/search_facet_result.hxx +50 -0
- data/ext/couchbase/couchbase/search_meta_data.hxx +85 -0
- data/ext/couchbase/couchbase/search_metrics.hxx +127 -0
- data/ext/couchbase/couchbase/search_numeric_range.hxx +69 -0
- data/ext/couchbase/couchbase/search_options.hxx +509 -0
- data/ext/couchbase/couchbase/search_query.hxx +69 -0
- data/ext/couchbase/couchbase/search_result.hxx +77 -0
- data/ext/couchbase/couchbase/search_row.hxx +104 -0
- data/ext/couchbase/couchbase/search_row_location.hxx +55 -0
- data/ext/couchbase/couchbase/search_row_locations.hxx +86 -0
- data/ext/couchbase/couchbase/search_scan_consistency.hxx +34 -0
- data/ext/couchbase/couchbase/search_sort.hxx +58 -0
- data/ext/couchbase/couchbase/search_sort_field.hxx +117 -0
- data/ext/couchbase/couchbase/search_sort_field_missing.hxx +26 -0
- data/ext/couchbase/couchbase/search_sort_field_mode.hxx +27 -0
- data/ext/couchbase/couchbase/search_sort_field_type.hxx +28 -0
- data/ext/couchbase/couchbase/search_sort_id.hxx +60 -0
- data/ext/couchbase/couchbase/search_sort_score.hxx +60 -0
- data/ext/couchbase/couchbase/search_term_range.hxx +51 -0
- data/ext/couchbase/couchbase/security_options.hxx +3 -0
- data/ext/couchbase/couchbase/term_facet.hxx +48 -0
- data/ext/couchbase/couchbase/term_facet_result.hxx +55 -0
- data/ext/couchbase/couchbase/term_query.hxx +151 -0
- data/ext/couchbase/couchbase/term_range_query.hxx +142 -0
- data/ext/couchbase/couchbase/tracing/request_span.hxx +63 -0
- data/ext/couchbase/couchbase/tracing/request_tracer.hxx +2 -40
- data/ext/couchbase/couchbase/transactions/async_attempt_context.hxx +83 -4
- data/ext/couchbase/couchbase/transactions/attempt_context.hxx +67 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +2 -0
- data/ext/couchbase/couchbase/transactions/transaction_keyspace.hxx +11 -1
- data/ext/couchbase/couchbase/transactions/transaction_options.hxx +79 -8
- data/ext/couchbase/couchbase/transactions/transaction_query_options.hxx +128 -15
- data/ext/couchbase/couchbase/transactions/transaction_query_result.hxx +4 -0
- data/ext/couchbase/couchbase/transactions/transaction_result.hxx +1 -1
- data/ext/couchbase/couchbase/transactions/transactions_cleanup_config.hxx +5 -3
- data/ext/couchbase/couchbase/transactions/transactions_config.hxx +9 -5
- data/ext/couchbase/couchbase/transactions/transactions_query_config.hxx +6 -3
- data/ext/couchbase/couchbase/transactions.hxx +34 -1
- data/ext/couchbase/couchbase/wildcard_query.hxx +83 -0
- data/ext/couchbase/test/CMakeLists.txt +7 -5
- data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
- data/ext/couchbase/test/test_helper.hxx +5 -5
- data/ext/couchbase/test/test_integration_analytics.cxx +28 -6
- data/ext/couchbase/test/test_integration_collections.cxx +7 -3
- data/ext/couchbase/test/test_integration_connect.cxx +7 -3
- data/ext/couchbase/test/test_integration_crud.cxx +13 -3
- data/ext/couchbase/test/test_integration_diagnostics.cxx +11 -5
- data/ext/couchbase/test/test_integration_durability.cxx +12 -7
- data/ext/couchbase/test/test_integration_examples.cxx +283 -11
- data/ext/couchbase/test/test_integration_management.cxx +147 -91
- data/ext/couchbase/test/test_integration_query.cxx +68 -10
- data/ext/couchbase/test/test_integration_range_scan.cxx +12 -12
- data/ext/couchbase/test/test_integration_read_replica.cxx +48 -11
- data/ext/couchbase/test/test_integration_search.cxx +22 -2
- data/ext/couchbase/test/test_integration_subdoc.cxx +62 -11
- data/ext/couchbase/test/test_integration_tracer.cxx +5 -0
- data/ext/couchbase/test/test_integration_transcoders.cxx +13 -5
- data/ext/couchbase/test/{test_transaction_transaction_context.cxx → test_transaction_context.cxx} +1 -1
- data/ext/couchbase/test/test_transaction_examples.cxx +195 -0
- data/ext/couchbase/test/{test_transaction_transaction_simple.cxx → test_transaction_simple.cxx} +17 -5
- data/ext/couchbase/test/{test_transaction_transaction_simple_async.cxx → test_transaction_simple_async.cxx} +19 -21
- data/ext/couchbase/test/test_unit_config_profiles.cxx +1 -1
- data/ext/couchbase/test/test_unit_json_transcoder.cxx +4 -0
- data/ext/couchbase/test/test_unit_search.cxx +427 -0
- data/ext/couchbase/test/test_unit_transaction_utils.cxx +10 -1
- data/ext/couchbase/test/test_unit_utils.cxx +8 -4
- data/ext/couchbase.cxx +58 -16
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +0 -4
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/json_transcoder.rb +12 -5
- data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
- data/lib/couchbase/management/query_index_manager.rb +70 -5
- data/lib/couchbase/raw_binary_transcoder.rb +37 -0
- data/lib/couchbase/raw_json_transcoder.rb +38 -0
- data/lib/couchbase/raw_string_transcoder.rb +40 -0
- data/lib/couchbase/search_options.rb +5 -0
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/version.rb +1 -1
- metadata +139 -11
- data/ext/couchbase/core/config_profile.cxx +0 -47
- /data/ext/couchbase/test/{test_transaction_transaction_public_async_api.cxx → test_transaction_public_async_api.cxx} +0 -0
- /data/ext/couchbase/test/{test_transaction_transaction_public_blocking_api.cxx → test_transaction_public_blocking_api.cxx} +0 -0
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
|
-
|
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
|
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
|
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
|
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(
|
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)));
|
@@ -5090,6 +5089,14 @@ cb_Backend_query_index_get_all(VALUE self, VALUE bucket_name, VALUE options)
|
|
5090
5089
|
couchbase::core::operations::management::query_index_get_all_request req{};
|
5091
5090
|
req.bucket_name = cb_string_new(bucket_name);
|
5092
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
|
+
}
|
5093
5100
|
auto barrier = std::make_shared<std::promise<couchbase::core::operations::management::query_index_get_all_response>>();
|
5094
5101
|
auto f = barrier->get_future();
|
5095
5102
|
cluster->execute(req, [barrier](couchbase::core::operations::management::query_index_get_all_response&& resp) {
|
@@ -5466,15 +5473,50 @@ cb_Backend_query_index_build_deferred(VALUE self, VALUE bucket_name, VALUE optio
|
|
5466
5473
|
}
|
5467
5474
|
|
5468
5475
|
try {
|
5469
|
-
couchbase::
|
5470
|
-
|
5471
|
-
|
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);
|
5472
5479
|
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
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
|
+
}
|
5476
5487
|
}
|
5477
|
-
|
5488
|
+
|
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
|
+
}
|
5506
|
+
}
|
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;
|
5478
5520
|
} catch (const std::system_error& se) {
|
5479
5521
|
rb_exc_raise(cb_map_error_code(se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
5480
5522
|
} catch (const ruby_exception& e) {
|
data/ext/revisions.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
cmake_flags << "-DEXT_GIT_REVISION=
|
2
|
-
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_REVISION=
|
3
|
-
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_DESCRIBE=1.0.0-dp.
|
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"
|
data/lib/couchbase/cluster.rb
CHANGED
@@ -386,8 +386,6 @@ module Couchbase
|
|
386
386
|
raise ArgumentError, "missing connection_string" unless connection_string
|
387
387
|
raise ArgumentError, "missing username" unless credentials[:username]
|
388
388
|
raise ArgumentError, "missing password" unless credentials[:password]
|
389
|
-
|
390
|
-
open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
|
391
389
|
else
|
392
390
|
options = args.shift
|
393
391
|
case options
|
@@ -396,8 +394,6 @@ module Couchbase
|
|
396
394
|
credentials[:password] = args.shift
|
397
395
|
raise ArgumentError, "missing username" unless credentials[:username]
|
398
396
|
raise ArgumentError, "missing password" unless credentials[:password]
|
399
|
-
|
400
|
-
open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
|
401
397
|
when Options::Cluster
|
402
398
|
open_options = options&.to_backend || {}
|
403
399
|
authenticator = options&.authenticator
|
@@ -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
|
-
|
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
|
26
|
-
# @param [Integer, :json]
|
27
|
-
# @return Object decoded document
|
28
|
-
def decode(blob,
|
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 [
|
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 [
|
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
|
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
|
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 [
|
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
|
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
|
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 [
|
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
|
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
|
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 [
|
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
|
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
|
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 [
|
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 [
|
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
|
@@ -22,21 +22,40 @@ module Couchbase
|
|
22
22
|
module Query
|
23
23
|
# Options for {QueryIndexManager#get_all_indexes}
|
24
24
|
class GetAllIndexes < ::Couchbase::Options::Base
|
25
|
+
attr_accessor :scope_name # @return [String, nil]
|
26
|
+
attr_accessor :collection_name # @return [String, nil]
|
27
|
+
|
25
28
|
# Creates an instance of options for {QueryIndexManager#get_all_indexes}
|
26
29
|
#
|
30
|
+
# @param [String, nil] scope_name the name of the scope
|
31
|
+
# @param [String, nil] collection_name the name of the collection
|
32
|
+
#
|
27
33
|
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
28
34
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
29
35
|
# @param [Hash, nil] client_context the client context data, if set
|
30
36
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
31
37
|
#
|
32
38
|
# @yieldparam [GetAllScopes] self
|
33
|
-
def initialize(
|
39
|
+
def initialize(scope_name: nil,
|
40
|
+
collection_name: nil,
|
41
|
+
timeout: nil,
|
34
42
|
retry_strategy: nil,
|
35
43
|
client_context: nil,
|
36
44
|
parent_span: nil)
|
37
|
-
super
|
45
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
46
|
+
@scope_name = scope_name
|
47
|
+
@collection_name = collection_name
|
38
48
|
yield self if block_given?
|
39
49
|
end
|
50
|
+
|
51
|
+
# @api private
|
52
|
+
def to_backend
|
53
|
+
{
|
54
|
+
timeout: Utils::Time.extract_duration(@timeout),
|
55
|
+
scope_name: @scope_name,
|
56
|
+
collection_name: @collection_name,
|
57
|
+
}
|
58
|
+
end
|
40
59
|
end
|
41
60
|
|
42
61
|
# Options for {QueryIndexManager#create_index}
|
@@ -102,6 +121,7 @@ module Couchbase
|
|
102
121
|
attr_accessor :ignore_if_exists # @return [Boolean]
|
103
122
|
attr_accessor :num_replicas # @return [Integer, nil]
|
104
123
|
attr_accessor :deferred # @return [Boolean]
|
124
|
+
attr_accessor :index_name # @return [String. nil]
|
105
125
|
attr_accessor :scope_name # @return [String, nil]
|
106
126
|
attr_accessor :collection_name # @return [String, nil]
|
107
127
|
|
@@ -110,6 +130,7 @@ module Couchbase
|
|
110
130
|
# @param [Boolean] ignore_if_exists do not raise error if the index already exist
|
111
131
|
# @param [Integer] num_replicas the number of replicas that this index should have
|
112
132
|
# @param [Boolean] deferred whether the index should be created as a deferred index.
|
133
|
+
# @param [String, nil] index_name the custom name of the primary index.
|
113
134
|
# @param [String, nil] scope_name the name of the scope
|
114
135
|
# @param [String, nil] collection_name the name of the collection
|
115
136
|
#
|
@@ -122,6 +143,7 @@ module Couchbase
|
|
122
143
|
def initialize(ignore_if_exists: false,
|
123
144
|
num_replicas: nil,
|
124
145
|
deferred: false,
|
146
|
+
index_name: nil,
|
125
147
|
scope_name: nil,
|
126
148
|
collection_name: nil,
|
127
149
|
timeout: nil,
|
@@ -132,6 +154,7 @@ module Couchbase
|
|
132
154
|
@ignore_if_exists = ignore_if_exists
|
133
155
|
@num_replicas = num_replicas
|
134
156
|
@deferred = deferred
|
157
|
+
@index_name = index_name
|
135
158
|
@scope_name = scope_name
|
136
159
|
@collection_name = collection_name
|
137
160
|
yield self if block_given?
|
@@ -144,6 +167,7 @@ module Couchbase
|
|
144
167
|
ignore_if_exists: @ignore_if_exists,
|
145
168
|
deferred: @deferred,
|
146
169
|
num_replicas: @num_replicas,
|
170
|
+
index_name: @index_name,
|
147
171
|
scope_name: @scope_name,
|
148
172
|
collection_name: @collection_name,
|
149
173
|
}
|
@@ -238,7 +262,12 @@ module Couchbase
|
|
238
262
|
|
239
263
|
# Options for {QueryIndexManager#build_deferred_indexes}
|
240
264
|
class BuildDeferredIndexes < ::Couchbase::Options::Base
|
265
|
+
attr_accessor :scope_name # @return [String, nil]
|
266
|
+
attr_accessor :collection_name # @return [String, nil]
|
267
|
+
|
241
268
|
# Creates an instance of options for {QueryIndexManager#build_deferred_indexes}
|
269
|
+
# @param [String, nil] scope_name the name of the scope
|
270
|
+
# @param [String, nil] collection_name the name of the collection
|
242
271
|
#
|
243
272
|
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
244
273
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -246,33 +275,55 @@ module Couchbase
|
|
246
275
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
247
276
|
#
|
248
277
|
# @yieldparam [GetAllScopes] self
|
249
|
-
def initialize(
|
278
|
+
def initialize(scope_name: nil,
|
279
|
+
collection_name: nil,
|
280
|
+
timeout: nil,
|
250
281
|
retry_strategy: nil,
|
251
282
|
client_context: nil,
|
252
283
|
parent_span: nil)
|
253
|
-
super
|
284
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
285
|
+
@scope_name = scope_name
|
286
|
+
@collection_name = collection_name
|
254
287
|
yield self if block_given?
|
255
288
|
end
|
289
|
+
|
290
|
+
# @api private
|
291
|
+
def to_backend
|
292
|
+
{
|
293
|
+
timeout: Utils::Time.extract_duration(@timeout),
|
294
|
+
scope_name: @scope_name,
|
295
|
+
collection_name: @collection_name,
|
296
|
+
}
|
297
|
+
end
|
256
298
|
end
|
257
299
|
|
258
300
|
# Options for {QueryIndexManager#watch_indexes}
|
259
301
|
class WatchIndexes < ::Couchbase::Options::Base
|
260
302
|
attr_accessor :watch_primary # @return [Boolean]
|
303
|
+
attr_accessor :scope_name # @return [String, nil]
|
304
|
+
attr_accessor :collection_name # @return [String, nil]
|
261
305
|
|
262
306
|
# Creates an instance of options for {QueryIndexManager#watch_indexes}
|
263
307
|
#
|
264
308
|
# @param [Boolean] watch_primary whether or not to watch the primary index
|
309
|
+
# @param [String, nil] scope_name the name of the scope
|
310
|
+
# @param [String, nil] collection_name the name of the collection
|
311
|
+
#
|
265
312
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
266
313
|
# @param [Hash, nil] client_context the client context data, if set
|
267
314
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
268
315
|
#
|
269
316
|
# @yieldparam [GetAllScopes] self
|
270
317
|
def initialize(watch_primary: false,
|
318
|
+
scope_name: nil,
|
319
|
+
collection_name: nil,
|
271
320
|
retry_strategy: nil,
|
272
321
|
client_context: nil,
|
273
322
|
parent_span: nil)
|
274
323
|
super(timeout: nil, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
275
324
|
@watch_primary = watch_primary
|
325
|
+
@scope_name = scope_name
|
326
|
+
@collection_name = collection_name
|
276
327
|
yield self if block_given?
|
277
328
|
end
|
278
329
|
|
@@ -280,6 +331,8 @@ module Couchbase
|
|
280
331
|
def to_backend
|
281
332
|
{
|
282
333
|
watch_primary: @watch_primary,
|
334
|
+
scope_name: @scope_name,
|
335
|
+
collection_name: @collection_name,
|
283
336
|
}
|
284
337
|
end
|
285
338
|
end
|
@@ -343,6 +396,10 @@ module Couchbase
|
|
343
396
|
#
|
344
397
|
# @raise [ArgumentError]
|
345
398
|
def get_all_indexes(bucket_name, options = GetAllIndexOptions.new)
|
399
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
400
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
401
|
+
end
|
402
|
+
|
346
403
|
res = @backend.query_index_get_all(bucket_name, options.to_backend)
|
347
404
|
res[:indexes].map do |idx|
|
348
405
|
QueryIndex.new do |index|
|
@@ -436,10 +493,14 @@ module Couchbase
|
|
436
493
|
# @param [String] bucket_name name of the bucket
|
437
494
|
# @param [Options::Query::BuildDeferredIndexes] options
|
438
495
|
#
|
439
|
-
# @return
|
496
|
+
# @return
|
440
497
|
#
|
441
498
|
# @raise [ArgumentError]
|
442
499
|
def build_deferred_indexes(bucket_name, options = Options::Query::BuildDeferredIndexes.new)
|
500
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
501
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
502
|
+
end
|
503
|
+
|
443
504
|
@backend.query_index_build_deferred(bucket_name, options.to_backend)
|
444
505
|
end
|
445
506
|
|
@@ -453,6 +514,10 @@ module Couchbase
|
|
453
514
|
# @raise [ArgumentError]
|
454
515
|
# @raise [Error::IndexNotFound]
|
455
516
|
def watch_indexes(bucket_name, index_names, timeout, options = Options::Query::WatchIndexes.new)
|
517
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
518
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
519
|
+
end
|
520
|
+
|
456
521
|
index_names.append("#primary") if options.watch_primary
|
457
522
|
|
458
523
|
interval_millis = 50
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2023. Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "couchbase/transcoder_flags"
|
16
|
+
|
17
|
+
module Couchbase
|
18
|
+
class RawBinaryTranscoder
|
19
|
+
# @param [String] document
|
20
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
21
|
+
def encode(document)
|
22
|
+
raise Error::EncodingFailure, "Only binary data supported by RawBinaryTranscoder" unless document.is_a?(String)
|
23
|
+
|
24
|
+
[document, TranscoderFlags.new(format: :binary).encode]
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
28
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
29
|
+
# @return [String] decoded document
|
30
|
+
def decode(blob, flags)
|
31
|
+
format = TranscoderFlags.decode(flags).format
|
32
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawBinaryTranscoder" unless format == :binary || format.nil?
|
33
|
+
|
34
|
+
blob
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright 2023. Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "couchbase/transcoder_flags"
|
16
|
+
require "couchbase/errors"
|
17
|
+
|
18
|
+
module Couchbase
|
19
|
+
class RawJsonTranscoder
|
20
|
+
# @param [String] document
|
21
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
22
|
+
def encode(document)
|
23
|
+
raise Error::EncodingFailure, "Only String and binary data supported by RawJsonTranscoder" unless document.is_a?(String)
|
24
|
+
|
25
|
+
[document, TranscoderFlags.new(format: :json).encode]
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
29
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
30
|
+
# @return [String] decoded document
|
31
|
+
def decode(blob, flags)
|
32
|
+
format = TranscoderFlags.decode(flags).format
|
33
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawJsonTranscoder" unless format == :json || format.nil?
|
34
|
+
|
35
|
+
blob
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|