couchbase 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +59 -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/ThirdPartyDependencies.cmake +4 -0
- 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 -7
- data/ext/couchbase/core/{config_profile.cxx → cluster_options_fwd.hxx} +7 -6
- data/ext/couchbase/core/config_profile.hxx +2 -65
- 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 +237 -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 -1
- 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/dns_srv_tracker.cxx +5 -3
- 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.cxx +5 -5
- 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/dns_client.cxx +225 -0
- data/ext/couchbase/core/io/dns_client.hxx +19 -188
- 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/active_transaction_record.hxx +2 -2
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +3 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +1 -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/transactions/internal/transaction_context.hxx +12 -12
- data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
- data/ext/couchbase/core/transactions/transaction_context.cxx +1 -0
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
- data/ext/couchbase/core/utils/connection_string.cxx +27 -3
- data/ext/couchbase/core/utils/connection_string.hxx +3 -3
- data/ext/couchbase/core/utils/json.cxx +4 -1
- data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
- data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
- data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
- data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
- data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
- data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
- data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
- data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
- 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 +75 -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/analytics_status.hxx +76 -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_options.hxx +0 -1
- 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 +73 -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 +68 -1
- 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 +8 -7
- data/ext/couchbase/test/benchmark_helper_integration.hxx +2 -2
- data/ext/couchbase/test/test_helper.hxx +6 -6
- data/ext/couchbase/test/test_integration_analytics.cxx +314 -16
- 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 +19 -2
- 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 +324 -11
- data/ext/couchbase/test/test_integration_management.cxx +162 -94
- 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 +621 -0
- 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} +90 -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 +13 -13
- data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
- 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/third_party/snappy/CMakeLists.txt +150 -27
- data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
- data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
- data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
- data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
- data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
- data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
- data/ext/couchbase/third_party/snappy/snappy.h +19 -4
- data/ext/couchbase.cxx +85 -22
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +13 -13
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/configuration.rb +3 -4
- 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/options.rb +85 -2
- 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 +163 -240
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/version.rb +1 -1
- metadata +151 -12
- data/ext/couchbase/core/CMakeLists.txt +0 -0
- /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
|
@@ -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
|
data/lib/couchbase/options.rb
CHANGED
|
@@ -1029,10 +1029,38 @@ module Couchbase
|
|
|
1029
1029
|
# Options for {BinaryCollection#append}
|
|
1030
1030
|
class Append < Base
|
|
1031
1031
|
attr_accessor :cas # @return [Integer]
|
|
1032
|
+
attr_accessor :durability_level # @return [Symbol]
|
|
1033
|
+
attr_accessor :replicate_to # @return [Symbol]
|
|
1034
|
+
attr_accessor :persist_to # @return [Symbol]
|
|
1032
1035
|
|
|
1033
1036
|
# Creates an instance of options for {BinaryCollection#append}
|
|
1034
1037
|
#
|
|
1035
1038
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
|
1039
|
+
# @param [Symbol] durability_level level of durability
|
|
1040
|
+
# +:none+::
|
|
1041
|
+
# no enhanced durability required for the mutation
|
|
1042
|
+
# +:majority+::
|
|
1043
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
|
1044
|
+
# (that is, held in the memory allocated to the bucket)
|
|
1045
|
+
# +:majority_and_persist_to_active+::
|
|
1046
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
|
1047
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
|
1048
|
+
# node hosting the active partition (vBucket) for the data.
|
|
1049
|
+
# +:persist_to_majority+::
|
|
1050
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
|
1051
|
+
# Accordingly, it will be written to disk on those nodes.
|
|
1052
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
|
1053
|
+
# +:none+:: do not apply any replication requirements.
|
|
1054
|
+
# +:one+:: wait for replication to at least one node.
|
|
1055
|
+
# +:two+:: wait for replication to at least two nodes.
|
|
1056
|
+
# +:three+:: wait for replication to at least three nodes.
|
|
1057
|
+
# @param [Symbol] persist_to number of nodes to persist
|
|
1058
|
+
# +:none+:: do not apply any persistence requirements.
|
|
1059
|
+
# +:active+:: wait for persistence to active node
|
|
1060
|
+
# +:one+:: wait for persistence to at least one node.
|
|
1061
|
+
# +:two+:: wait for persistence to at least two nodes.
|
|
1062
|
+
# +:three+:: wait for persistence to at least three nodes.
|
|
1063
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
|
1036
1064
|
#
|
|
1037
1065
|
# @param [Integer, #in_milliseconds, nil] timeout
|
|
1038
1066
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
|
@@ -1041,12 +1069,23 @@ module Couchbase
|
|
|
1041
1069
|
#
|
|
1042
1070
|
# @yieldparam [Append] self
|
|
1043
1071
|
def initialize(cas: nil,
|
|
1072
|
+
durability_level: :none,
|
|
1073
|
+
replicate_to: :none,
|
|
1074
|
+
persist_to: :none,
|
|
1044
1075
|
timeout: nil,
|
|
1045
1076
|
retry_strategy: nil,
|
|
1046
1077
|
client_context: nil,
|
|
1047
1078
|
parent_span: nil)
|
|
1048
1079
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
|
1049
1080
|
@cas = cas
|
|
1081
|
+
|
|
1082
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
|
1083
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
|
1084
|
+
end
|
|
1085
|
+
|
|
1086
|
+
@durability_level = durability_level
|
|
1087
|
+
@replicate_to = replicate_to
|
|
1088
|
+
@persist_to = persist_to
|
|
1050
1089
|
yield self if block_given?
|
|
1051
1090
|
end
|
|
1052
1091
|
|
|
@@ -1055,6 +1094,9 @@ module Couchbase
|
|
|
1055
1094
|
{
|
|
1056
1095
|
timeout: Utils::Time.extract_duration(@timeout),
|
|
1057
1096
|
cas: @cas,
|
|
1097
|
+
durability_level: @durability_level,
|
|
1098
|
+
persist_to: @persist_to,
|
|
1099
|
+
replicate_to: @replicate_to,
|
|
1058
1100
|
}
|
|
1059
1101
|
end
|
|
1060
1102
|
|
|
@@ -1064,12 +1106,39 @@ module Couchbase
|
|
|
1064
1106
|
|
|
1065
1107
|
# Options for {BinaryCollection#prepend}
|
|
1066
1108
|
class Prepend < Base
|
|
1067
|
-
# @return [Integer]
|
|
1068
|
-
attr_accessor :
|
|
1109
|
+
attr_accessor :cas # @return [Integer]
|
|
1110
|
+
attr_accessor :durability_level # @return [Symbol]
|
|
1111
|
+
attr_accessor :replicate_to # @return [Symbol]
|
|
1112
|
+
attr_accessor :persist_to # @return [Symbol]
|
|
1069
1113
|
|
|
1070
1114
|
# Creates an instance of options for {BinaryCollection#prepend}
|
|
1071
1115
|
#
|
|
1072
1116
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
|
1117
|
+
# @param [Symbol] durability_level level of durability
|
|
1118
|
+
# +:none+::
|
|
1119
|
+
# no enhanced durability required for the mutation
|
|
1120
|
+
# +:majority+::
|
|
1121
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
|
1122
|
+
# (that is, held in the memory allocated to the bucket)
|
|
1123
|
+
# +:majority_and_persist_to_active+::
|
|
1124
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
|
1125
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
|
1126
|
+
# node hosting the active partition (vBucket) for the data.
|
|
1127
|
+
# +:persist_to_majority+::
|
|
1128
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
|
1129
|
+
# Accordingly, it will be written to disk on those nodes.
|
|
1130
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
|
1131
|
+
# +:none+:: do not apply any replication requirements.
|
|
1132
|
+
# +:one+:: wait for replication to at least one node.
|
|
1133
|
+
# +:two+:: wait for replication to at least two nodes.
|
|
1134
|
+
# +:three+:: wait for replication to at least three nodes.
|
|
1135
|
+
# @param [Symbol] persist_to number of nodes to persist
|
|
1136
|
+
# +:none+:: do not apply any persistence requirements.
|
|
1137
|
+
# +:active+:: wait for persistence to active node
|
|
1138
|
+
# +:one+:: wait for persistence to at least one node.
|
|
1139
|
+
# +:two+:: wait for persistence to at least two nodes.
|
|
1140
|
+
# +:three+:: wait for persistence to at least three nodes.
|
|
1141
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
|
1073
1142
|
#
|
|
1074
1143
|
# @param [Integer, #in_milliseconds, nil] timeout
|
|
1075
1144
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
|
@@ -1078,12 +1147,23 @@ module Couchbase
|
|
|
1078
1147
|
#
|
|
1079
1148
|
# @yieldparam [Prepend] self
|
|
1080
1149
|
def initialize(cas: nil,
|
|
1150
|
+
durability_level: :none,
|
|
1151
|
+
replicate_to: :none,
|
|
1152
|
+
persist_to: :none,
|
|
1081
1153
|
timeout: nil,
|
|
1082
1154
|
retry_strategy: nil,
|
|
1083
1155
|
client_context: nil,
|
|
1084
1156
|
parent_span: nil)
|
|
1085
1157
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
|
1086
1158
|
@cas = cas
|
|
1159
|
+
|
|
1160
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
|
1161
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
|
1162
|
+
end
|
|
1163
|
+
|
|
1164
|
+
@durability_level = durability_level
|
|
1165
|
+
@replicate_to = replicate_to
|
|
1166
|
+
@persist_to = persist_to
|
|
1087
1167
|
yield self if block_given?
|
|
1088
1168
|
end
|
|
1089
1169
|
|
|
@@ -1092,6 +1172,9 @@ module Couchbase
|
|
|
1092
1172
|
{
|
|
1093
1173
|
timeout: Utils::Time.extract_duration(@timeout),
|
|
1094
1174
|
cas: @cas,
|
|
1175
|
+
durability_level: @durability_level,
|
|
1176
|
+
persist_to: @persist_to,
|
|
1177
|
+
replicate_to: @replicate_to,
|
|
1095
1178
|
}
|
|
1096
1179
|
end
|
|
1097
1180
|
|
|
@@ -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
|
|
@@ -0,0 +1,40 @@
|
|
|
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 RawStringTranscoder
|
|
20
|
+
# @param [String] document
|
|
21
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
|
22
|
+
def encode(document)
|
|
23
|
+
unless document.is_a?(String) && document.valid_encoding?
|
|
24
|
+
raise Error::EncodingFailure, "Only String data supported by RawStringTranscoder"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
[document, TranscoderFlags.new(format: :string).encode]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
|
31
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
|
32
|
+
# @return [String] decoded document
|
|
33
|
+
def decode(blob, flags)
|
|
34
|
+
format = TranscoderFlags.decode(flags).format
|
|
35
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawStringTranscoder" unless format == :string || format.nil?
|
|
36
|
+
|
|
37
|
+
blob
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|