couchbase 3.4.2 → 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 +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
|
@@ -28,33 +28,6 @@ class attempt_context;
|
|
|
28
28
|
using error_func1 = std::function<std::optional<error_class>(attempt_context*)>;
|
|
29
29
|
using error_func2 = std::function<std::optional<error_class>(attempt_context*, const std::string&)>;
|
|
30
30
|
|
|
31
|
-
namespace
|
|
32
|
-
{
|
|
33
|
-
std::optional<error_class>
|
|
34
|
-
noop_1(attempt_context*)
|
|
35
|
-
{
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
std::optional<error_class>
|
|
40
|
-
noop_2(attempt_context*, const std::string&)
|
|
41
|
-
{
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
std::optional<const std::string>
|
|
46
|
-
noop_3(attempt_context*)
|
|
47
|
-
{
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
bool
|
|
52
|
-
noop_4(attempt_context*, const std::string&, std::optional<const std::string>)
|
|
53
|
-
{
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
} // namespace
|
|
57
|
-
|
|
58
31
|
static const std::string STAGE_ROLLBACK = "rollback";
|
|
59
32
|
static const std::string STAGE_GET = "get";
|
|
60
33
|
static const std::string STAGE_INSERT = "insert";
|
|
@@ -91,55 +64,55 @@ static const std::string STAGE_QUERY_KV_INSERT = "queryKvInsert";
|
|
|
91
64
|
* about your use-case: we are always open to adding good ideas into the transactions library.
|
|
92
65
|
*/
|
|
93
66
|
struct attempt_context_testing_hooks {
|
|
94
|
-
error_func1 before_atr_commit
|
|
95
|
-
error_func1 before_atr_commit_ambiguity_resolution
|
|
96
|
-
error_func1 after_atr_commit
|
|
97
|
-
error_func2 before_doc_committed
|
|
98
|
-
error_func2 before_removing_doc_during_staged_insert
|
|
99
|
-
error_func2 before_rollback_delete_inserted
|
|
100
|
-
error_func2 after_doc_committed_before_saving_cas
|
|
101
|
-
error_func2 after_doc_committed
|
|
102
|
-
error_func2 before_staged_insert
|
|
103
|
-
error_func2 before_staged_remove
|
|
104
|
-
error_func2 before_staged_replace
|
|
105
|
-
error_func2 before_doc_removed
|
|
106
|
-
error_func2 before_doc_rolled_back
|
|
107
|
-
error_func2 after_doc_removed_pre_retry
|
|
108
|
-
error_func2 after_doc_removed_post_retry
|
|
109
|
-
error_func2 after_get_complete
|
|
110
|
-
error_func2 after_staged_replace_complete_before_cas_saved
|
|
111
|
-
error_func2 after_staged_replace_complete
|
|
112
|
-
error_func2 after_staged_remove_complete
|
|
113
|
-
error_func2 after_staged_insert_complete
|
|
114
|
-
error_func2 after_rollback_replace_or_remove
|
|
115
|
-
error_func2 after_rollback_delete_inserted
|
|
116
|
-
error_func2 before_check_atr_entry_for_blocking_doc
|
|
117
|
-
error_func2 before_doc_get
|
|
118
|
-
error_func2 before_get_doc_in_exists_during_staged_insert
|
|
119
|
-
error_func2 before_query
|
|
120
|
-
error_func2 after_query
|
|
121
|
-
error_func2 before_remove_staged_insert
|
|
122
|
-
error_func2 after_remove_staged_insert
|
|
123
|
-
|
|
124
|
-
error_func1 after_docs_committed
|
|
125
|
-
error_func1 after_docs_removed
|
|
126
|
-
error_func1 after_atr_pending
|
|
127
|
-
error_func1 before_atr_pending
|
|
128
|
-
error_func1 before_atr_complete
|
|
129
|
-
error_func1 before_atr_rolled_back
|
|
130
|
-
error_func1 after_atr_complete
|
|
131
|
-
error_func1 before_get_atr_for_abort
|
|
132
|
-
error_func1 before_atr_aborted
|
|
133
|
-
error_func1 after_atr_aborted
|
|
134
|
-
error_func1 after_atr_rolled_back
|
|
135
|
-
|
|
136
|
-
std::function<std::optional<const std::string>(attempt_context*)> random_atr_id_for_vbucket
|
|
137
|
-
|
|
138
|
-
std::function<bool(attempt_context*, const std::string&, std::optional<const std::string>)> has_expired_client_side
|
|
67
|
+
error_func1 before_atr_commit;
|
|
68
|
+
error_func1 before_atr_commit_ambiguity_resolution;
|
|
69
|
+
error_func1 after_atr_commit;
|
|
70
|
+
error_func2 before_doc_committed;
|
|
71
|
+
error_func2 before_removing_doc_during_staged_insert;
|
|
72
|
+
error_func2 before_rollback_delete_inserted;
|
|
73
|
+
error_func2 after_doc_committed_before_saving_cas;
|
|
74
|
+
error_func2 after_doc_committed;
|
|
75
|
+
error_func2 before_staged_insert;
|
|
76
|
+
error_func2 before_staged_remove;
|
|
77
|
+
error_func2 before_staged_replace;
|
|
78
|
+
error_func2 before_doc_removed;
|
|
79
|
+
error_func2 before_doc_rolled_back;
|
|
80
|
+
error_func2 after_doc_removed_pre_retry;
|
|
81
|
+
error_func2 after_doc_removed_post_retry;
|
|
82
|
+
error_func2 after_get_complete;
|
|
83
|
+
error_func2 after_staged_replace_complete_before_cas_saved;
|
|
84
|
+
error_func2 after_staged_replace_complete;
|
|
85
|
+
error_func2 after_staged_remove_complete;
|
|
86
|
+
error_func2 after_staged_insert_complete;
|
|
87
|
+
error_func2 after_rollback_replace_or_remove;
|
|
88
|
+
error_func2 after_rollback_delete_inserted;
|
|
89
|
+
error_func2 before_check_atr_entry_for_blocking_doc;
|
|
90
|
+
error_func2 before_doc_get;
|
|
91
|
+
error_func2 before_get_doc_in_exists_during_staged_insert;
|
|
92
|
+
error_func2 before_query;
|
|
93
|
+
error_func2 after_query;
|
|
94
|
+
error_func2 before_remove_staged_insert;
|
|
95
|
+
error_func2 after_remove_staged_insert;
|
|
96
|
+
|
|
97
|
+
error_func1 after_docs_committed;
|
|
98
|
+
error_func1 after_docs_removed;
|
|
99
|
+
error_func1 after_atr_pending;
|
|
100
|
+
error_func1 before_atr_pending;
|
|
101
|
+
error_func1 before_atr_complete;
|
|
102
|
+
error_func1 before_atr_rolled_back;
|
|
103
|
+
error_func1 after_atr_complete;
|
|
104
|
+
error_func1 before_get_atr_for_abort;
|
|
105
|
+
error_func1 before_atr_aborted;
|
|
106
|
+
error_func1 after_atr_aborted;
|
|
107
|
+
error_func1 after_atr_rolled_back;
|
|
108
|
+
|
|
109
|
+
std::function<std::optional<const std::string>(attempt_context*)> random_atr_id_for_vbucket;
|
|
110
|
+
|
|
111
|
+
std::function<bool(attempt_context*, const std::string&, std::optional<const std::string>)> has_expired_client_side;
|
|
112
|
+
|
|
113
|
+
attempt_context_testing_hooks();
|
|
139
114
|
|
|
140
115
|
// needed for unique_ptr<attempt_context_testing_hooks> in transaction_config, with a forward declaration.
|
|
141
|
-
~attempt_context_testing_hooks()
|
|
142
|
-
{
|
|
143
|
-
}
|
|
116
|
+
~attempt_context_testing_hooks() = default;
|
|
144
117
|
};
|
|
145
118
|
} // namespace couchbase::core::transactions
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#include "cleanup_testing_hooks.hxx"
|
|
18
|
+
|
|
19
|
+
namespace couchbase::core::transactions
|
|
20
|
+
{
|
|
21
|
+
namespace
|
|
22
|
+
{
|
|
23
|
+
inline std::optional<couchbase::core::transactions::error_class>
|
|
24
|
+
noop1(const std::string&)
|
|
25
|
+
{
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
inline std::optional<couchbase::core::transactions::error_class>
|
|
30
|
+
noop2()
|
|
31
|
+
{
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
} // namespace
|
|
35
|
+
|
|
36
|
+
cleanup_testing_hooks::cleanup_testing_hooks()
|
|
37
|
+
: before_commit_doc{ noop1 }
|
|
38
|
+
, before_doc_get{ noop1 }
|
|
39
|
+
, before_remove_doc_staged_for_removal{ noop1 }
|
|
40
|
+
, before_remove_doc{ noop1 }
|
|
41
|
+
, before_atr_get{ noop1 }
|
|
42
|
+
, before_remove_links{ noop1 }
|
|
43
|
+
, before_atr_remove{ noop2 }
|
|
44
|
+
, on_cleanup_docs_completed{ noop2 }
|
|
45
|
+
, on_cleanup_completed{ noop2 }
|
|
46
|
+
, client_record_before_create{ noop1 }
|
|
47
|
+
, client_record_before_get{ noop1 }
|
|
48
|
+
, client_record_before_update{ noop1 }
|
|
49
|
+
, client_record_before_remove_client{ noop1 }
|
|
50
|
+
{
|
|
51
|
+
}
|
|
52
|
+
} // namespace couchbase::core::transactions
|
|
@@ -18,52 +18,38 @@
|
|
|
18
18
|
#include "core/transactions/error_class.hxx"
|
|
19
19
|
|
|
20
20
|
#include <functional>
|
|
21
|
+
#include <optional>
|
|
21
22
|
#include <string>
|
|
22
23
|
|
|
23
24
|
namespace couchbase::core::transactions
|
|
24
25
|
{
|
|
25
26
|
using error_func3 = std::function<std::optional<error_class>(const std::string&)>;
|
|
26
27
|
using error_func4 = std::function<std::optional<error_class>(void)>;
|
|
27
|
-
namespace
|
|
28
|
-
{
|
|
29
|
-
std::optional<couchbase::core::transactions::error_class>
|
|
30
|
-
noop1(const std::string&)
|
|
31
|
-
{
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
std::optional<couchbase::core::transactions::error_class>
|
|
35
|
-
noop2()
|
|
36
|
-
{
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
} // namespace
|
|
41
28
|
|
|
42
29
|
/**
|
|
43
30
|
* Hooks purely for testing purposes. If you're an end-user looking at these for any reason, then please contact us first
|
|
44
31
|
* about your use-case: we are always open to adding good ideas into the transactions library.
|
|
45
32
|
*/
|
|
46
33
|
struct cleanup_testing_hooks {
|
|
47
|
-
error_func3 before_commit_doc
|
|
48
|
-
error_func3 before_doc_get
|
|
49
|
-
error_func3 before_remove_doc_staged_for_removal
|
|
50
|
-
error_func3 before_remove_doc
|
|
51
|
-
error_func3 before_atr_get
|
|
52
|
-
error_func3 before_remove_links
|
|
34
|
+
error_func3 before_commit_doc;
|
|
35
|
+
error_func3 before_doc_get;
|
|
36
|
+
error_func3 before_remove_doc_staged_for_removal;
|
|
37
|
+
error_func3 before_remove_doc;
|
|
38
|
+
error_func3 before_atr_get;
|
|
39
|
+
error_func3 before_remove_links;
|
|
53
40
|
|
|
54
|
-
error_func4 before_atr_remove
|
|
41
|
+
error_func4 before_atr_remove;
|
|
55
42
|
|
|
56
|
-
error_func4 on_cleanup_docs_completed
|
|
57
|
-
error_func4 on_cleanup_completed
|
|
43
|
+
error_func4 on_cleanup_docs_completed;
|
|
44
|
+
error_func4 on_cleanup_completed;
|
|
58
45
|
|
|
59
|
-
error_func3 client_record_before_create
|
|
60
|
-
error_func3 client_record_before_get
|
|
61
|
-
error_func3 client_record_before_update
|
|
62
|
-
error_func3 client_record_before_remove_client
|
|
46
|
+
error_func3 client_record_before_create;
|
|
47
|
+
error_func3 client_record_before_get;
|
|
48
|
+
error_func3 client_record_before_update;
|
|
49
|
+
error_func3 client_record_before_remove_client;
|
|
63
50
|
|
|
51
|
+
cleanup_testing_hooks();
|
|
64
52
|
// needed for unique_ptr<cleanup_testing_hooks> in transaction_config, with a forward declaration.
|
|
65
|
-
~cleanup_testing_hooks()
|
|
66
|
-
{
|
|
67
|
-
}
|
|
53
|
+
~cleanup_testing_hooks() = default;
|
|
68
54
|
};
|
|
69
|
-
} // namespace couchbase::core::transactions
|
|
55
|
+
} // namespace couchbase::core::transactions
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
#pragma once
|
|
18
18
|
|
|
19
|
-
#include
|
|
19
|
+
#include "core/error_context/query.hxx"
|
|
20
|
+
#include "error_class.hxx"
|
|
21
|
+
|
|
20
22
|
#include <couchbase/error_codes.hxx>
|
|
21
23
|
#include <couchbase/transactions/transaction_result.hxx>
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
#include <stdexcept>
|
|
26
|
+
#include <utility>
|
|
24
27
|
|
|
25
28
|
namespace couchbase::core::transactions
|
|
26
29
|
{
|
|
@@ -135,7 +138,7 @@ class op_exception : public std::runtime_error
|
|
|
135
138
|
transaction_op_error_context ctx_;
|
|
136
139
|
|
|
137
140
|
public:
|
|
138
|
-
op_exception(transaction_op_error_context ctx, external_exception cause = COUCHBASE_EXCEPTION)
|
|
141
|
+
explicit op_exception(transaction_op_error_context ctx, external_exception cause = COUCHBASE_EXCEPTION)
|
|
139
142
|
: std::runtime_error(ctx.ec().message())
|
|
140
143
|
, cause_(cause)
|
|
141
144
|
, ctx_(std::move(ctx))
|
|
@@ -157,7 +160,7 @@ class document_not_found : public op_exception
|
|
|
157
160
|
{
|
|
158
161
|
public:
|
|
159
162
|
explicit document_not_found(transaction_op_error_context ctx)
|
|
160
|
-
: op_exception(ctx, DOCUMENT_NOT_FOUND_EXCEPTION)
|
|
163
|
+
: op_exception(std::move(ctx), DOCUMENT_NOT_FOUND_EXCEPTION)
|
|
161
164
|
{
|
|
162
165
|
}
|
|
163
166
|
};
|
|
@@ -166,7 +169,7 @@ class document_exists : public op_exception
|
|
|
166
169
|
{
|
|
167
170
|
public:
|
|
168
171
|
explicit document_exists(transaction_op_error_context ctx)
|
|
169
|
-
: op_exception(ctx, DOCUMENT_EXISTS_EXCEPTION)
|
|
172
|
+
: op_exception(std::move(ctx), DOCUMENT_EXISTS_EXCEPTION)
|
|
170
173
|
{
|
|
171
174
|
}
|
|
172
175
|
};
|
|
@@ -175,7 +178,7 @@ class query_attempt_not_found : public op_exception
|
|
|
175
178
|
{
|
|
176
179
|
public:
|
|
177
180
|
query_attempt_not_found(transaction_op_error_context ctx)
|
|
178
|
-
: op_exception(ctx)
|
|
181
|
+
: op_exception(std::move(ctx))
|
|
179
182
|
{
|
|
180
183
|
}
|
|
181
184
|
};
|
|
@@ -184,7 +187,7 @@ class query_cas_mismatch : public op_exception
|
|
|
184
187
|
{
|
|
185
188
|
public:
|
|
186
189
|
query_cas_mismatch(transaction_op_error_context ctx)
|
|
187
|
-
: op_exception(ctx)
|
|
190
|
+
: op_exception(std::move(ctx))
|
|
188
191
|
{
|
|
189
192
|
}
|
|
190
193
|
};
|
|
@@ -193,7 +196,7 @@ class query_attempt_expired : public op_exception
|
|
|
193
196
|
{
|
|
194
197
|
public:
|
|
195
198
|
query_attempt_expired(transaction_op_error_context ctx)
|
|
196
|
-
: op_exception(ctx)
|
|
199
|
+
: op_exception(std::move(ctx))
|
|
197
200
|
{
|
|
198
201
|
}
|
|
199
202
|
};
|
|
@@ -202,7 +205,7 @@ class query_parsing_failure : public op_exception
|
|
|
202
205
|
{
|
|
203
206
|
public:
|
|
204
207
|
query_parsing_failure(transaction_op_error_context ctx)
|
|
205
|
-
: op_exception(ctx, PARSING_FAILURE)
|
|
208
|
+
: op_exception(std::move(ctx), PARSING_FAILURE)
|
|
206
209
|
{
|
|
207
210
|
}
|
|
208
211
|
};
|
|
@@ -347,6 +347,16 @@ extract_options(connection_string& connstr)
|
|
|
347
347
|
* The period of time an HTTP connection can be idle before it is forcefully disconnected.
|
|
348
348
|
*/
|
|
349
349
|
parse_option(connstr.options.idle_http_connection_timeout, name, value);
|
|
350
|
+
} else if (name == "bootstrap_timeout") {
|
|
351
|
+
/**
|
|
352
|
+
* The period of time allocated to complete bootstrap
|
|
353
|
+
*/
|
|
354
|
+
parse_option(connstr.options.bootstrap_timeout, name, value);
|
|
355
|
+
} else if (name == "resolve_timeout") {
|
|
356
|
+
/**
|
|
357
|
+
* The period of time to resolve DNS name of the node to IP address
|
|
358
|
+
*/
|
|
359
|
+
parse_option(connstr.options.resolve_timeout, name, value);
|
|
350
360
|
} else if (name == "enable_dns_srv") {
|
|
351
361
|
if (connstr.bootstrap_nodes.size() == 1) {
|
|
352
362
|
parse_option(connstr.options.enable_dns_srv, name, value);
|
|
@@ -392,12 +402,19 @@ extract_options(connection_string& connstr)
|
|
|
392
402
|
parse_option(connstr.options.enable_metrics, name, value);
|
|
393
403
|
} else if (name == "tls_verify") {
|
|
394
404
|
parse_option(connstr.options.tls_verify, name, value);
|
|
405
|
+
} else if (name == "disable_mozilla_ca_certificates") {
|
|
406
|
+
parse_option(connstr.options.disable_mozilla_ca_certificates, name, value);
|
|
395
407
|
} else if (name == "user_agent_extra") {
|
|
396
408
|
/**
|
|
397
409
|
* string, that will be appended to identification fields of the server protocols (key in HELO packet for MCBP, "user-agent"
|
|
398
410
|
* header for HTTP)
|
|
399
411
|
*/
|
|
400
412
|
parse_option(connstr.options.user_agent_extra, name, value);
|
|
413
|
+
} else if (name == "dump_configuration") {
|
|
414
|
+
/**
|
|
415
|
+
* Whether to dump every new configuration on TRACE level
|
|
416
|
+
*/
|
|
417
|
+
parse_option(connstr.options.dump_configuration, name, value);
|
|
401
418
|
} else {
|
|
402
419
|
CB_LOG_WARNING(R"(unknown parameter "{}" in connection string (value "{}"))", name, value);
|
|
403
420
|
}
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
#include <tao/json.hpp>
|
|
21
21
|
#include <tao/json/contrib/traits.hpp>
|
|
22
22
|
|
|
23
|
+
#include <gsl/span>
|
|
24
|
+
|
|
23
25
|
namespace couchbase::core::utils::json
|
|
24
26
|
{
|
|
25
27
|
/**
|
|
@@ -102,7 +104,8 @@ class to_byte_vector
|
|
|
102
104
|
void write(std::string_view data)
|
|
103
105
|
{
|
|
104
106
|
buffer_.reserve(buffer_.size() + data.size());
|
|
105
|
-
|
|
107
|
+
const auto* begin = reinterpret_cast<const std::byte*>(data.data());
|
|
108
|
+
buffer_.insert(buffer_.end(), begin, begin + data.size());
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
inline void escape(const std::string_view s)
|
|
@@ -54,18 +54,26 @@ class behavior_options
|
|
|
54
54
|
return *this;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
auto dump_configuration(bool enable) -> behavior_options&
|
|
58
|
+
{
|
|
59
|
+
dump_configuration_ = enable;
|
|
60
|
+
return *this;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
struct built {
|
|
58
64
|
std::string user_agent_extra;
|
|
59
65
|
bool show_queries;
|
|
60
66
|
bool enable_clustermap_notification;
|
|
61
67
|
bool enable_mutation_tokens;
|
|
62
68
|
bool enable_unordered_execution;
|
|
69
|
+
bool dump_configuration;
|
|
63
70
|
};
|
|
64
71
|
|
|
65
72
|
[[nodiscard]] auto build() const -> built
|
|
66
73
|
{
|
|
67
74
|
return {
|
|
68
|
-
user_agent_extra_,
|
|
75
|
+
user_agent_extra_, show_queries_, enable_clustermap_notification_, enable_mutation_tokens_,
|
|
76
|
+
enable_unordered_execution_, dump_configuration_,
|
|
69
77
|
};
|
|
70
78
|
}
|
|
71
79
|
|
|
@@ -75,5 +83,6 @@ class behavior_options
|
|
|
75
83
|
bool enable_clustermap_notification_{ false };
|
|
76
84
|
bool enable_mutation_tokens_{ true };
|
|
77
85
|
bool enable_unordered_execution_{ true };
|
|
86
|
+
bool dump_configuration_{ false };
|
|
78
87
|
};
|
|
79
88
|
} // namespace couchbase
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-Present Couchbase, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include <couchbase/search_query.hxx>
|
|
21
|
+
|
|
22
|
+
#include <optional>
|
|
23
|
+
#include <string>
|
|
24
|
+
|
|
25
|
+
namespace couchbase
|
|
26
|
+
{
|
|
27
|
+
/**
|
|
28
|
+
* Allow to match `true`/`false` in a field mapped as boolean.
|
|
29
|
+
*
|
|
30
|
+
* @since 1.0.0
|
|
31
|
+
* @committed
|
|
32
|
+
*/
|
|
33
|
+
class boolean_field_query : public search_query
|
|
34
|
+
{
|
|
35
|
+
public:
|
|
36
|
+
/**
|
|
37
|
+
* Create a new boolean field query.
|
|
38
|
+
*
|
|
39
|
+
* @param value the input string to be matched against
|
|
40
|
+
*
|
|
41
|
+
* @since 1.0.0
|
|
42
|
+
* @committed
|
|
43
|
+
*/
|
|
44
|
+
explicit boolean_field_query(bool value)
|
|
45
|
+
: bool_{ value }
|
|
46
|
+
{
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* If a field is specified, only terms in that field will be matched.
|
|
51
|
+
*
|
|
52
|
+
* @param field_name name of the field to be matched
|
|
53
|
+
*
|
|
54
|
+
* @return this query for chaining purposes.
|
|
55
|
+
*
|
|
56
|
+
* @since 1.0.0
|
|
57
|
+
* @committed
|
|
58
|
+
*/
|
|
59
|
+
auto field(std::string field_name) -> boolean_field_query&
|
|
60
|
+
{
|
|
61
|
+
field_ = std::move(field_name);
|
|
62
|
+
return *this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @return encoded representation of the query.
|
|
67
|
+
*
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
[[nodiscard]] auto encode() const -> encoded_search_query override;
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
bool bool_;
|
|
75
|
+
std::optional<std::string> field_{};
|
|
76
|
+
};
|
|
77
|
+
} // namespace couchbase
|