couchbase 4.2.8-dev.1 → 4.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CMakeLists.txt +1 -1
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +139 -56
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
- package/deps/couchbase-cxx-client/CMakeLists.txt +397 -424
- package/deps/couchbase-cxx-client/core/agent_config.hxx +1 -1
- package/deps/couchbase-cxx-client/core/agent_group.cxx +0 -1
- package/deps/couchbase-cxx-client/core/agent_group.hxx +9 -0
- package/deps/couchbase-cxx-client/core/agent_group_config.hxx +1 -1
- package/deps/couchbase-cxx-client/core/bucket.cxx +22 -8
- package/deps/couchbase-cxx-client/core/bucket.hxx +3 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +1453 -108
- package/deps/couchbase-cxx-client/core/cluster.hxx +183 -473
- package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +1 -1
- package/deps/couchbase-cxx-client/core/cluster_options.cxx +12 -2
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +9 -8
- package/deps/couchbase-cxx-client/core/config_profiles.cxx +2 -2
- package/deps/couchbase-cxx-client/core/config_profiles.hxx +1 -1
- package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +1 -2
- package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +3 -2
- package/deps/couchbase-cxx-client/core/diagnostics.hxx +0 -1
- package/deps/couchbase-cxx-client/core/dispatcher.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +38 -76
- package/deps/couchbase-cxx-client/core/impl/analytics.hxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +820 -0
- package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +403 -0
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +78 -0
- package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +433 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +226 -44
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +1384 -0
- package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +306 -0
- package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +3 -1
- package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +2 -0
- package/deps/couchbase-cxx-client/core/{operations/mcbp_noop.cxx → impl/doc_id_query.cxx} +19 -15
- package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +4 -2
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +0 -10
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +0 -10
- package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +24 -17
- package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/query.cxx +45 -68
- package/deps/couchbase-cxx-client/core/impl/query.hxx +34 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +628 -0
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +172 -0
- package/deps/couchbase-cxx-client/core/impl/search.cxx +12 -61
- package/deps/couchbase-cxx-client/core/impl/search.hxx +37 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +469 -0
- package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +12 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +87 -0
- package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +23 -25
- package/deps/couchbase-cxx-client/core/io/dns_config.cxx +28 -0
- package/deps/couchbase-cxx-client/core/io/dns_config.hxx +6 -25
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +9 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +3 -2
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +51 -21
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -1
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -4
- package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +1 -1
- package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +1 -1
- package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +28 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +6 -5
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +2 -2
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +4 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +4 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +4 -4
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +4 -4
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations.hxx +0 -1
- package/deps/couchbase-cxx-client/core/operations_fwd.hxx +260 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +146 -5
- package/deps/couchbase-cxx-client/core/origin.hxx +30 -140
- package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +3 -3
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +4 -4
- package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
- package/deps/couchbase-cxx-client/core/query_context.hxx +11 -7
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/configuration.cxx +23 -0
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +8 -12
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +3 -3
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -0
- package/deps/couchbase-cxx-client/core/topology/error_map.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +4 -0
- package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +58 -0
- package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +5 -40
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +30 -0
- package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +18 -18
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +36 -0
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +39 -41
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +3 -1
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +2 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +32 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +4 -30
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +41 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +17 -15
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +1 -1
- package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +1 -13
- package/deps/couchbase-cxx-client/core/transactions/result.hxx +0 -26
- package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +46 -0
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +16 -14
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +6 -6
- package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +48 -0
- package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +1 -0
- package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +61 -4
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +9 -8
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +9 -16
- package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +7 -6
- package/deps/couchbase-cxx-client/core/transactions.hxx +6 -5
- package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +4 -3
- package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +4 -4
- package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +44 -0
- package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +463 -0
- package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +44 -0
- package/deps/couchbase-cxx-client/couchbase/append_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +19 -115
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +13 -30
- package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +8 -7
- package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +41 -73
- package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +1 -27
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +176 -386
- package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +8 -9
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +21 -24
- package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +116 -0
- package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +3 -2
- package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +120 -0
- package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +103 -0
- package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +63 -0
- package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +105 -0
- package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +103 -0
- package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +84 -0
- package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +103 -0
- package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +63 -0
- package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +22 -1
- package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +6 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +37 -0
- package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +66 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +65 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +1 -4
- package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +45 -0
- package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +121 -0
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +67 -0
- package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +44 -0
- package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +12 -0
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +48 -0
- package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +48 -0
- package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +239 -0
- package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +40 -0
- package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/network_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +19 -0
- package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +99 -20
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +0 -21
- package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +0 -23
- package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +63 -0
- package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +13 -45
- package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +1 -7
- package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +292 -0
- package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +10 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +84 -0
- package/deps/couchbase-cxx-client/couchbase/security_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +10 -7
- package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +8 -58
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +28 -70
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +7 -2
- package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +11 -38
- package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +0 -24
- package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +41 -0
- package/dist/binding.d.ts +7 -9
- package/dist/bindingutilities.js +2 -0
- package/dist/collection.js +3 -3
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +14 -2
- package/dist/transactions.d.ts +2 -0
- package/dist/transactions.js +2 -3
- package/dist/usermanager.js +1 -1
- package/package.json +7 -7
- package/src/binding.cpp +1 -0
- package/src/connection.cpp +12 -9
- package/src/connection.hpp +3 -3
- package/src/connection_autogen.cpp +7 -5
- package/src/constants.cpp +3 -0
- package/src/instance.cpp +2 -2
- package/src/instance.hpp +1 -1
- package/src/jstocbpp_autogen.hpp +21 -38
- package/src/jstocbpp_basic.hpp +2 -0
- package/src/jstocbpp_errors.hpp +1 -0
- package/src/jstocbpp_transactions.hpp +6 -22
- package/src/mutationtoken.hpp +1 -0
- package/tools/gen-bindings-json.py +39 -16
- package/deps/couchbase-cxx-cache/spdlog/66ab2619a0014319471759c03e2de1af6bda14de/spdlog/example/CMakeLists.txt +0 -23
- package/deps/couchbase-cxx-cache/spdlog/66ab2619a0014319471759c03e2de1af6bda14de/spdlog/example/example.cpp +0 -398
- package/deps/couchbase-cxx-client/core/impl/append.cxx +0 -87
- package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +0 -157
- package/deps/couchbase-cxx-client/core/impl/create_bucket.cxx +0 -158
- package/deps/couchbase-cxx-client/core/impl/create_collection.cxx +0 -83
- package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +0 -232
- package/deps/couchbase-cxx-client/core/impl/create_scope.cxx +0 -69
- package/deps/couchbase-cxx-client/core/impl/decrement.cxx +0 -96
- package/deps/couchbase-cxx-client/core/impl/drop_bucket.cxx +0 -66
- package/deps/couchbase-cxx-client/core/impl/drop_collection.cxx +0 -76
- package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +0 -187
- package/deps/couchbase-cxx-client/core/impl/drop_scope.cxx +0 -68
- package/deps/couchbase-cxx-client/core/impl/exists.cxx +0 -47
- package/deps/couchbase-cxx-client/core/impl/flush_bucket.cxx +0 -66
- package/deps/couchbase-cxx-client/core/impl/get.cxx +0 -68
- package/deps/couchbase-cxx-client/core/impl/get_all_buckets.cxx +0 -178
- package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +0 -106
- package/deps/couchbase-cxx-client/core/impl/get_all_replicas.cxx +0 -145
- package/deps/couchbase-cxx-client/core/impl/get_all_scopes.cxx +0 -94
- package/deps/couchbase-cxx-client/core/impl/get_and_lock.cxx +0 -49
- package/deps/couchbase-cxx-client/core/impl/get_and_touch.cxx +0 -49
- package/deps/couchbase-cxx-client/core/impl/get_any_replica.cxx +0 -134
- package/deps/couchbase-cxx-client/core/impl/get_bucket.cxx +0 -168
- package/deps/couchbase-cxx-client/core/impl/increment.cxx +0 -96
- package/deps/couchbase-cxx-client/core/impl/insert.cxx +0 -90
- package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +0 -69
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +0 -178
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +0 -169
- package/deps/couchbase-cxx-client/core/impl/mutate_in.cxx +0 -125
- package/deps/couchbase-cxx-client/core/impl/prepend.cxx +0 -87
- package/deps/couchbase-cxx-client/core/impl/remove.cxx +0 -86
- package/deps/couchbase-cxx-client/core/impl/replace.cxx +0 -102
- package/deps/couchbase-cxx-client/core/impl/touch.cxx +0 -49
- package/deps/couchbase-cxx-client/core/impl/unlock.cxx +0 -47
- package/deps/couchbase-cxx-client/core/impl/update_bucket.cxx +0 -133
- package/deps/couchbase-cxx-client/core/impl/update_collection.cxx +0 -83
- package/deps/couchbase-cxx-client/core/impl/upsert.cxx +0 -100
- package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +0 -196
- package/deps/couchbase-cxx-client/core/operations/mcbp_noop.hxx +0 -49
- /package/deps/couchbase-cxx-client/core/impl/{streaming_json_lexter_error_category.cxx → streaming_json_lexer_error_category.cxx} +0 -0
@@ -0,0 +1,306 @@
|
|
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
|
+
#include "core/cluster.hxx"
|
19
|
+
|
20
|
+
#include "core/operations/management/collection_create.hxx"
|
21
|
+
#include "core/operations/management/collection_drop.hxx"
|
22
|
+
#include "core/operations/management/collection_update.hxx"
|
23
|
+
#include "core/operations/management/scope_create.hxx"
|
24
|
+
#include "core/operations/management/scope_drop.hxx"
|
25
|
+
#include "core/operations/management/scope_get_all.hxx"
|
26
|
+
#include "internal_manager_error_context.hxx"
|
27
|
+
|
28
|
+
#include <couchbase/collection_manager.hxx>
|
29
|
+
|
30
|
+
#include <memory>
|
31
|
+
|
32
|
+
namespace couchbase
|
33
|
+
{
|
34
|
+
namespace
|
35
|
+
{
|
36
|
+
template<typename Response>
|
37
|
+
manager_error_context
|
38
|
+
build_context(Response& resp)
|
39
|
+
{
|
40
|
+
return manager_error_context(internal_manager_error_context{ resp.ctx.ec,
|
41
|
+
resp.ctx.last_dispatched_to,
|
42
|
+
resp.ctx.last_dispatched_from,
|
43
|
+
resp.ctx.retry_attempts,
|
44
|
+
std::move(resp.ctx.retry_reasons),
|
45
|
+
std::move(resp.ctx.client_context_id),
|
46
|
+
resp.ctx.http_status,
|
47
|
+
std::move(resp.ctx.http_body),
|
48
|
+
std::move(resp.ctx.path) });
|
49
|
+
}
|
50
|
+
|
51
|
+
management::bucket::collection_spec
|
52
|
+
map_collection(std::string scope_name, const core::topology::collections_manifest::collection& collection)
|
53
|
+
{
|
54
|
+
management::bucket::collection_spec spec{};
|
55
|
+
spec.name = collection.name;
|
56
|
+
spec.scope_name = std::move(scope_name);
|
57
|
+
spec.max_expiry = collection.max_expiry;
|
58
|
+
spec.history = collection.history;
|
59
|
+
return spec;
|
60
|
+
}
|
61
|
+
|
62
|
+
std::vector<couchbase::management::bucket::scope_spec>
|
63
|
+
map_scope_specs(core::topology::collections_manifest& manifest)
|
64
|
+
{
|
65
|
+
std::vector<couchbase::management::bucket::scope_spec> scope_specs{};
|
66
|
+
for (const auto& scope : manifest.scopes) {
|
67
|
+
couchbase::management::bucket::scope_spec converted_scope{};
|
68
|
+
converted_scope.name = scope.name;
|
69
|
+
for (const auto& collection : scope.collections) {
|
70
|
+
auto collection_spec = map_collection(scope.name, collection);
|
71
|
+
converted_scope.collections.emplace_back(collection_spec);
|
72
|
+
}
|
73
|
+
scope_specs.emplace_back(converted_scope);
|
74
|
+
}
|
75
|
+
return scope_specs;
|
76
|
+
}
|
77
|
+
} // namespace
|
78
|
+
|
79
|
+
class collection_manager_impl
|
80
|
+
{
|
81
|
+
public:
|
82
|
+
collection_manager_impl(core::cluster core, std::string_view bucket_name)
|
83
|
+
: core_{ std::move(core) }
|
84
|
+
, bucket_name_{ bucket_name }
|
85
|
+
{
|
86
|
+
}
|
87
|
+
|
88
|
+
void drop_collection(std::string scope_name,
|
89
|
+
std::string collection_name,
|
90
|
+
const couchbase::drop_collection_options::built& options,
|
91
|
+
couchbase::drop_collection_handler&& handler) const
|
92
|
+
{
|
93
|
+
return core_.execute(
|
94
|
+
core::operations::management::collection_drop_request{
|
95
|
+
bucket_name_,
|
96
|
+
std::move(scope_name),
|
97
|
+
std::move(collection_name),
|
98
|
+
{},
|
99
|
+
options.timeout,
|
100
|
+
},
|
101
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
|
102
|
+
}
|
103
|
+
|
104
|
+
void update_collection(std::string scope_name,
|
105
|
+
std::string collection_name,
|
106
|
+
const couchbase::update_collection_settings& settings,
|
107
|
+
const couchbase::update_collection_options::built& options,
|
108
|
+
couchbase::update_collection_handler&& handler) const
|
109
|
+
{
|
110
|
+
return core_.execute(
|
111
|
+
core::operations::management::collection_update_request{
|
112
|
+
bucket_name_,
|
113
|
+
std::move(scope_name),
|
114
|
+
std::move(collection_name),
|
115
|
+
settings.max_expiry,
|
116
|
+
settings.history,
|
117
|
+
{},
|
118
|
+
options.timeout,
|
119
|
+
},
|
120
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
|
121
|
+
}
|
122
|
+
|
123
|
+
void create_collection(std::string scope_name,
|
124
|
+
std::string collection_name,
|
125
|
+
const couchbase::create_collection_settings& settings,
|
126
|
+
const couchbase::create_collection_options::built& options,
|
127
|
+
couchbase::update_collection_handler&& handler) const
|
128
|
+
{
|
129
|
+
return core_.execute(
|
130
|
+
core::operations::management::collection_create_request{
|
131
|
+
bucket_name_,
|
132
|
+
std::move(scope_name),
|
133
|
+
std::move(collection_name),
|
134
|
+
settings.max_expiry,
|
135
|
+
settings.history,
|
136
|
+
{},
|
137
|
+
options.timeout,
|
138
|
+
},
|
139
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
|
140
|
+
}
|
141
|
+
|
142
|
+
void get_all_scopes(const get_all_scopes_options::built& options, get_all_scopes_handler&& handler) const
|
143
|
+
{
|
144
|
+
return core_.execute(
|
145
|
+
core::operations::management::scope_get_all_request{
|
146
|
+
bucket_name_,
|
147
|
+
{},
|
148
|
+
options.timeout,
|
149
|
+
},
|
150
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), map_scope_specs(resp.manifest)); });
|
151
|
+
}
|
152
|
+
|
153
|
+
void create_scope(std::string scope_name,
|
154
|
+
const couchbase::create_scope_options::built& options,
|
155
|
+
couchbase::create_scope_handler&& handler) const
|
156
|
+
{
|
157
|
+
return core_.execute(
|
158
|
+
core::operations::management::scope_create_request{
|
159
|
+
bucket_name_,
|
160
|
+
std::move(scope_name),
|
161
|
+
{},
|
162
|
+
options.timeout,
|
163
|
+
},
|
164
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
|
165
|
+
}
|
166
|
+
|
167
|
+
void drop_scope(std::string scope_name,
|
168
|
+
const couchbase::drop_scope_options::built& options,
|
169
|
+
couchbase::drop_scope_handler&& handler) const
|
170
|
+
{
|
171
|
+
core_.execute(
|
172
|
+
core::operations::management::scope_drop_request{
|
173
|
+
bucket_name_,
|
174
|
+
std::move(scope_name),
|
175
|
+
{},
|
176
|
+
options.timeout,
|
177
|
+
},
|
178
|
+
[handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
|
179
|
+
}
|
180
|
+
|
181
|
+
private:
|
182
|
+
core::cluster core_;
|
183
|
+
std::string bucket_name_;
|
184
|
+
};
|
185
|
+
|
186
|
+
collection_manager::collection_manager(core::cluster core, std::string_view bucket_name)
|
187
|
+
: impl_(std::make_shared<collection_manager_impl>(std::move(core), bucket_name))
|
188
|
+
{
|
189
|
+
}
|
190
|
+
|
191
|
+
void
|
192
|
+
collection_manager::drop_collection(std::string scope_name,
|
193
|
+
std::string collection_name,
|
194
|
+
const couchbase::drop_collection_options& options,
|
195
|
+
couchbase::drop_collection_handler&& handler) const
|
196
|
+
{
|
197
|
+
return impl_->drop_collection(std::move(scope_name), std::move(collection_name), options.build(), std::move(handler));
|
198
|
+
}
|
199
|
+
|
200
|
+
auto
|
201
|
+
collection_manager::drop_collection(std::string scope_name,
|
202
|
+
std::string collection_name,
|
203
|
+
const couchbase::drop_collection_options& options) const -> std::future<manager_error_context>
|
204
|
+
{
|
205
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
206
|
+
drop_collection(
|
207
|
+
std::move(scope_name), std::move(collection_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
|
208
|
+
return barrier->get_future();
|
209
|
+
}
|
210
|
+
|
211
|
+
void
|
212
|
+
collection_manager::update_collection(std::string scope_name,
|
213
|
+
std::string collection_name,
|
214
|
+
const update_collection_settings& settings,
|
215
|
+
const update_collection_options& options,
|
216
|
+
update_collection_handler&& handler) const
|
217
|
+
{
|
218
|
+
return impl_->update_collection(std::move(scope_name), std::move(collection_name), settings, options.build(), std::move(handler));
|
219
|
+
}
|
220
|
+
|
221
|
+
auto
|
222
|
+
collection_manager::update_collection(std::string scope_name,
|
223
|
+
std::string collection_name,
|
224
|
+
const couchbase::update_collection_settings& settings,
|
225
|
+
const couchbase::update_collection_options& options) const -> std::future<manager_error_context>
|
226
|
+
{
|
227
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
228
|
+
update_collection(std::move(scope_name), std::move(collection_name), settings, options, [barrier](auto ctx) mutable {
|
229
|
+
barrier->set_value(std::move(ctx));
|
230
|
+
});
|
231
|
+
return barrier->get_future();
|
232
|
+
}
|
233
|
+
|
234
|
+
void
|
235
|
+
collection_manager::create_collection(std::string scope_name,
|
236
|
+
std::string collection_name,
|
237
|
+
const couchbase::create_collection_settings& settings,
|
238
|
+
const couchbase::create_collection_options& options,
|
239
|
+
couchbase::create_collection_handler&& handler) const
|
240
|
+
{
|
241
|
+
return impl_->create_collection(std::move(scope_name), std::move(collection_name), settings, options.build(), std::move(handler));
|
242
|
+
}
|
243
|
+
|
244
|
+
auto
|
245
|
+
collection_manager::create_collection(std::string scope_name,
|
246
|
+
std::string collection_name,
|
247
|
+
const couchbase::create_collection_settings& settings,
|
248
|
+
const couchbase::create_collection_options& options) const -> std::future<manager_error_context>
|
249
|
+
{
|
250
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
251
|
+
create_collection(std::move(scope_name), std::move(collection_name), settings, options, [barrier](auto ctx) mutable {
|
252
|
+
barrier->set_value(std::move(ctx));
|
253
|
+
});
|
254
|
+
return barrier->get_future();
|
255
|
+
}
|
256
|
+
|
257
|
+
void
|
258
|
+
collection_manager::get_all_scopes(const get_all_scopes_options& options, get_all_scopes_handler&& handler) const
|
259
|
+
{
|
260
|
+
return impl_->get_all_scopes(options.build(), std::move(handler));
|
261
|
+
}
|
262
|
+
|
263
|
+
auto
|
264
|
+
collection_manager::get_all_scopes(const couchbase::get_all_scopes_options& options) const
|
265
|
+
-> std::future<std::pair<manager_error_context, std::vector<management::bucket::scope_spec>>>
|
266
|
+
{
|
267
|
+
auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<management::bucket::scope_spec>>>>();
|
268
|
+
get_all_scopes(options,
|
269
|
+
[barrier](auto ctx, auto result) mutable { barrier->set_value(std::make_pair(std::move(ctx), std::move(result))); });
|
270
|
+
return barrier->get_future();
|
271
|
+
}
|
272
|
+
|
273
|
+
void
|
274
|
+
collection_manager::create_scope(std::string scope_name,
|
275
|
+
const couchbase::create_scope_options& options,
|
276
|
+
couchbase::create_scope_handler&& handler) const
|
277
|
+
{
|
278
|
+
return impl_->create_scope(std::move(scope_name), options.build(), std::move(handler));
|
279
|
+
}
|
280
|
+
|
281
|
+
auto
|
282
|
+
collection_manager::create_scope(std::string scope_name, const couchbase::create_scope_options& options) const
|
283
|
+
-> std::future<manager_error_context>
|
284
|
+
{
|
285
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
286
|
+
create_scope(std::move(scope_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
|
287
|
+
return barrier->get_future();
|
288
|
+
}
|
289
|
+
|
290
|
+
void
|
291
|
+
collection_manager::drop_scope(std::string scope_name,
|
292
|
+
const couchbase::drop_scope_options& options,
|
293
|
+
couchbase::drop_scope_handler&& handler) const
|
294
|
+
{
|
295
|
+
return impl_->drop_scope(std::move(scope_name), options.build(), std::move(handler));
|
296
|
+
}
|
297
|
+
|
298
|
+
auto
|
299
|
+
collection_manager::drop_scope(std::string scope_name, const couchbase::drop_scope_options& options) const
|
300
|
+
-> std::future<manager_error_context>
|
301
|
+
{
|
302
|
+
auto barrier = std::make_shared<std::promise<manager_error_context>>();
|
303
|
+
drop_scope(std::move(scope_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
|
304
|
+
return barrier->get_future();
|
305
|
+
}
|
306
|
+
} // namespace couchbase
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright
|
3
|
+
* Copyright 2023-Present Couchbase, Inc.
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
* you may not use this file except in compliance with the License.
|
@@ -15,24 +15,28 @@
|
|
15
15
|
* limitations under the License.
|
16
16
|
*/
|
17
17
|
|
18
|
-
#include "
|
18
|
+
#include "encoded_search_query.hxx"
|
19
19
|
|
20
|
+
#include <couchbase/doc_id_query.hxx>
|
20
21
|
#include <couchbase/error_codes.hxx>
|
21
22
|
|
22
|
-
|
23
|
+
#include <tao/json/contrib/traits.hpp>
|
24
|
+
|
25
|
+
namespace couchbase
|
23
26
|
{
|
24
|
-
|
25
|
-
|
27
|
+
auto
|
28
|
+
doc_id_query::encode() const -> encoded_search_query
|
26
29
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
30
|
+
if (ids_.empty()) {
|
31
|
+
return { errc::common::invalid_argument };
|
32
|
+
}
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
encoded_search_query built;
|
35
|
+
built.query = tao::json::value{ { "ids", ids_ } };
|
36
|
+
|
37
|
+
if (boost_.has_value()) {
|
38
|
+
built.query["boost"] = boost_.value();
|
39
|
+
}
|
40
|
+
return built;
|
37
41
|
}
|
38
|
-
} // namespace couchbase
|
42
|
+
} // namespace couchbase
|
@@ -80,10 +80,12 @@ struct key_value_error_category : std::error_category {
|
|
80
80
|
return "xattr_unknown_virtual_attribute (127)";
|
81
81
|
case errc::key_value::xattr_cannot_modify_virtual_attribute:
|
82
82
|
return "xattr_cannot_modify_virtual_attribute (128)";
|
83
|
-
case errc::key_value::cannot_revive_living_document:
|
84
|
-
return "cannot_revive_living_document (131)";
|
85
83
|
case errc::key_value::xattr_no_access:
|
86
84
|
return "xattr_no_access (130)";
|
85
|
+
case errc::key_value::document_not_locked:
|
86
|
+
return "document_not_locked (131)";
|
87
|
+
case errc::key_value::cannot_revive_living_document:
|
88
|
+
return "cannot_revive_living_document (132)";
|
87
89
|
case errc::key_value::mutation_token_outdated:
|
88
90
|
return "mutation_token_outdated (133)";
|
89
91
|
case errc::key_value::range_scan_completed:
|
@@ -67,14 +67,4 @@ class lookup_in_all_replicas_request
|
|
67
67
|
|
68
68
|
using movable_lookup_in_all_replicas_handler =
|
69
69
|
utils::movable_function<void(couchbase::subdocument_error_context, lookup_in_all_replicas_result)>;
|
70
|
-
|
71
|
-
void
|
72
|
-
initiate_lookup_in_all_replicas_operation(std::shared_ptr<cluster> core,
|
73
|
-
const std::string& bucket_name,
|
74
|
-
const std::string& scope_name,
|
75
|
-
const std::string& collection_name,
|
76
|
-
std::string document_key,
|
77
|
-
const std::vector<subdoc::command>& specs,
|
78
|
-
std::optional<std::chrono::milliseconds> timeout,
|
79
|
-
movable_lookup_in_all_replicas_handler&& handler);
|
80
70
|
} // namespace couchbase::core::impl
|
@@ -62,14 +62,4 @@ class lookup_in_any_replica_request
|
|
62
62
|
};
|
63
63
|
|
64
64
|
using movable_lookup_in_any_replica_handler = utils::movable_function<void(couchbase::subdocument_error_context, lookup_in_replica_result)>;
|
65
|
-
|
66
|
-
void
|
67
|
-
initiate_lookup_in_any_replica_operation(std::shared_ptr<cluster> core,
|
68
|
-
const std::string& bucket_name,
|
69
|
-
const std::string& scope_name,
|
70
|
-
const std::string& collection_name,
|
71
|
-
std::string document_key,
|
72
|
-
const std::vector<subdoc::command>& specs,
|
73
|
-
std::optional<std::chrono::milliseconds> timeout,
|
74
|
-
movable_lookup_in_any_replica_handler&& handler);
|
75
65
|
} // namespace couchbase::core::impl
|
@@ -20,12 +20,18 @@
|
|
20
20
|
#include "core/cluster.hxx"
|
21
21
|
#include "core/impl/observe_seqno.hxx"
|
22
22
|
|
23
|
+
#include <couchbase/error_codes.hxx>
|
24
|
+
|
25
|
+
#include <asio/steady_timer.hpp>
|
26
|
+
|
23
27
|
#include <memory>
|
24
28
|
#include <mutex>
|
25
29
|
|
26
30
|
namespace couchbase::core::impl
|
27
31
|
{
|
28
|
-
|
32
|
+
namespace
|
33
|
+
{
|
34
|
+
constexpr bool
|
29
35
|
touches_replica(couchbase::persist_to persist_to, couchbase::replicate_to replicate_to)
|
30
36
|
{
|
31
37
|
|
@@ -53,7 +59,7 @@ touches_replica(couchbase::persist_to persist_to, couchbase::replicate_to replic
|
|
53
59
|
return false;
|
54
60
|
}
|
55
61
|
|
56
|
-
|
62
|
+
constexpr std::uint32_t
|
57
63
|
number_of_replica_nodes_required(couchbase::persist_to persist_to)
|
58
64
|
{
|
59
65
|
switch (persist_to) {
|
@@ -72,7 +78,7 @@ number_of_replica_nodes_required(couchbase::persist_to persist_to)
|
|
72
78
|
return 0U;
|
73
79
|
}
|
74
80
|
|
75
|
-
|
81
|
+
constexpr std::uint32_t
|
76
82
|
number_of_replica_nodes_required(couchbase::replicate_to replicate_to)
|
77
83
|
{
|
78
84
|
switch (replicate_to) {
|
@@ -88,7 +94,7 @@ number_of_replica_nodes_required(couchbase::replicate_to replicate_to)
|
|
88
94
|
return 0U;
|
89
95
|
}
|
90
96
|
|
91
|
-
|
97
|
+
std::pair<std::error_code, std::uint32_t>
|
92
98
|
validate_replicas(const topology::configuration& config, couchbase::persist_to persist_to, couchbase::replicate_to replicate_to)
|
93
99
|
{
|
94
100
|
if (config.node_locator != topology::configuration::node_locator_type::vbucket) {
|
@@ -158,8 +164,8 @@ class observe_status
|
|
158
164
|
};
|
159
165
|
|
160
166
|
class observe_context;
|
161
|
-
|
162
|
-
observe_poll(
|
167
|
+
void
|
168
|
+
observe_poll(cluster core, std::shared_ptr<observe_context> ctx);
|
163
169
|
|
164
170
|
class observe_context : public std::enable_shared_from_this<observe_context>
|
165
171
|
{
|
@@ -270,13 +276,13 @@ class observe_context : public std::enable_shared_from_this<observe_context>
|
|
270
276
|
}
|
271
277
|
}
|
272
278
|
|
273
|
-
void on_last_response(std::size_t expected_number_of_responses,
|
279
|
+
void on_last_response(std::size_t expected_number_of_responses, utils::movable_function<void(std::error_code)> handler)
|
274
280
|
{
|
275
281
|
expect_number_of_responses_ = expected_number_of_responses;
|
276
282
|
on_last_response_ = std::move(handler);
|
277
283
|
}
|
278
284
|
|
279
|
-
void execute(
|
285
|
+
void execute(cluster core)
|
280
286
|
{
|
281
287
|
auto requests = std::move(requests_);
|
282
288
|
status_.reset();
|
@@ -287,8 +293,8 @@ class observe_context : public std::enable_shared_from_this<observe_context>
|
|
287
293
|
observe_poll(std::move(core), std::move(ctx));
|
288
294
|
});
|
289
295
|
for (auto&& request : requests) {
|
290
|
-
core
|
291
|
-
|
296
|
+
core.execute(std::move(request),
|
297
|
+
[ctx = shared_from_this()](observe_seqno_response&& response) { ctx->handle_response(std::move(response)); });
|
292
298
|
}
|
293
299
|
}
|
294
300
|
|
@@ -304,16 +310,16 @@ class observe_context : public std::enable_shared_from_this<observe_context>
|
|
304
310
|
std::atomic_size_t expect_number_of_responses_{};
|
305
311
|
std::mutex handler_mutex_{};
|
306
312
|
observe_handler handler_{};
|
307
|
-
|
313
|
+
utils::movable_function<void(std::error_code)> on_last_response_{};
|
308
314
|
std::chrono::milliseconds poll_backoff_interval_{ 500 };
|
309
315
|
std::chrono::milliseconds poll_deadline_interval_{ 5'000 };
|
310
316
|
};
|
311
317
|
|
312
|
-
|
313
|
-
observe_poll(
|
318
|
+
void
|
319
|
+
observe_poll(cluster core, std::shared_ptr<observe_context> ctx)
|
314
320
|
{
|
315
|
-
std::string bucket_name = ctx->bucket_name();
|
316
|
-
core
|
321
|
+
const std::string bucket_name = ctx->bucket_name();
|
322
|
+
core.with_bucket_configuration(
|
317
323
|
bucket_name, [core, ctx = std::move(ctx)](std::error_code ec, const core::topology::configuration& config) mutable {
|
318
324
|
if (ec) {
|
319
325
|
return ctx->finish(ec);
|
@@ -337,9 +343,10 @@ observe_poll(std::shared_ptr<couchbase::core::cluster> core, std::shared_ptr<obs
|
|
337
343
|
ctx->execute(core);
|
338
344
|
});
|
339
345
|
}
|
346
|
+
} // namespace
|
340
347
|
|
341
348
|
void
|
342
|
-
initiate_observe_poll(
|
349
|
+
initiate_observe_poll(cluster core,
|
343
350
|
document_id id,
|
344
351
|
mutation_token token,
|
345
352
|
std::optional<std::chrono::milliseconds> timeout,
|
@@ -348,7 +355,7 @@ initiate_observe_poll(std::shared_ptr<couchbase::core::cluster> core,
|
|
348
355
|
observe_handler&& handler)
|
349
356
|
{
|
350
357
|
auto ctx = std::make_shared<observe_context>(
|
351
|
-
core
|
358
|
+
core.io_context(), std::move(id), std::move(token), timeout, persist_to, replicate_to, std::move(handler));
|
352
359
|
ctx->start();
|
353
360
|
return observe_poll(std::move(core), std::move(ctx));
|
354
361
|
}
|
@@ -38,7 +38,7 @@ namespace impl
|
|
38
38
|
using observe_handler = utils::movable_function<void(std::error_code)>;
|
39
39
|
|
40
40
|
void
|
41
|
-
initiate_observe_poll(
|
41
|
+
initiate_observe_poll(cluster core,
|
42
42
|
document_id id,
|
43
43
|
mutation_token token,
|
44
44
|
std::optional<std::chrono::milliseconds> timeout,
|