couchbase 4.4.2 → 4.4.4
Sign up to get free protection for your applications and to get access to all the features.
- package/BUILDING.md +182 -0
- package/CMakeLists.txt +13 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -2
- package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/BUILDING.md +206 -0
- package/deps/couchbase-cxx-client/CMakeLists.txt +18 -13
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/deps/couchbase-cxx-client/cmake/APKBUILD.in +54 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +0 -5
- package/deps/couchbase-cxx-client/cmake/Packaging.cmake +177 -10
- package/deps/couchbase-cxx-client/cmake/RPath.cmake +10 -0
- package/deps/couchbase-cxx-client/cmake/Testing.cmake +1 -1
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +28 -2
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +45 -6
- package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +2 -2
- package/deps/couchbase-cxx-client/cmake/debian/changelog.in +5 -0
- package/deps/couchbase-cxx-client/cmake/debian/compat +1 -0
- package/deps/couchbase-cxx-client/cmake/debian/control +40 -0
- package/deps/couchbase-cxx-client/cmake/debian/rules +41 -0
- package/deps/couchbase-cxx-client/cmake/debian/source/format +1 -0
- package/deps/couchbase-cxx-client/core/agent_group.cxx +8 -0
- package/deps/couchbase-cxx-client/core/agent_group.hxx +4 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +16 -20
- package/deps/couchbase-cxx-client/core/bucket.hxx +12 -12
- package/deps/couchbase-cxx-client/core/cluster.cxx +44 -52
- package/deps/couchbase-cxx-client/core/cluster_agent.cxx +8 -0
- package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -0
- package/deps/couchbase-cxx-client/core/collections_component.cxx +2 -2
- package/deps/couchbase-cxx-client/core/columnar/agent.cxx +2 -2
- package/deps/couchbase-cxx-client/core/columnar/agent.hxx +1 -1
- package/deps/couchbase-cxx-client/core/columnar/management_component.cxx +3 -3
- package/deps/couchbase-cxx-client/core/columnar/query_component.cxx +103 -45
- package/deps/couchbase-cxx-client/core/columnar/query_component.hxx +1 -0
- package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +8 -0
- package/deps/couchbase-cxx-client/core/http_component.cxx +55 -24
- package/deps/couchbase-cxx-client/core/http_component.hxx +4 -0
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +15 -15
- package/deps/couchbase-cxx-client/core/impl/bootstrap_error.hxx +10 -2
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +36 -40
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +29 -5
- package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +5 -5
- package/deps/couchbase-cxx-client/core/impl/error.cxx +24 -3
- package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +13 -5
- package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -3
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/search.cxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +12 -12
- package/deps/couchbase-cxx-client/core/io/http_command.hxx +31 -20
- package/deps/couchbase-cxx-client/core/io/http_session.cxx +5 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +17 -4
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +97 -49
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +15 -14
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
- package/deps/couchbase-cxx-client/core/io/streams.cxx +256 -0
- package/deps/couchbase-cxx-client/core/io/streams.hxx +31 -155
- package/deps/couchbase-cxx-client/core/logger/configuration.hxx +5 -0
- package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +2 -3
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +39 -7
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +7 -0
- package/deps/couchbase-cxx-client/core/meta/features.hxx +11 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +47 -6
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.cxx +188 -0
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.hxx +73 -0
- package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +23 -17
- package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +23 -15
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +4 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +4 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +4 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +37 -17
- package/deps/couchbase-cxx-client/core/platform/base64.cc +1 -1
- package/deps/couchbase-cxx-client/core/platform/random.cc +2 -0
- package/deps/couchbase-cxx-client/core/platform/uuid.h +6 -6
- package/deps/couchbase-cxx-client/core/row_streamer.cxx +1 -1
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +1 -1
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.h +4 -4
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +2 -0
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +8 -0
- package/deps/couchbase-cxx-client/core/tracing/constants.hxx +3 -0
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.cxx +87 -0
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.hxx +57 -0
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +9 -21
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +6 -33
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +57 -56
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +17 -18
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +0 -20
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +2 -2
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +128 -52
- package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/common_options.hxx +16 -1
- package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +16 -20
- package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +1 -1
- package/dist/analyticsindexmanager.d.ts +98 -14
- package/dist/analyticsindexmanager.js +452 -411
- package/dist/binding.d.ts +53 -4
- package/dist/bindingutilities.d.ts +26 -1
- package/dist/bindingutilities.js +108 -1
- package/dist/couchbase.d.ts +3 -1
- package/dist/couchbase.js +2 -0
- package/dist/rangeScan.d.ts +1 -1
- package/dist/rangeScan.js +1 -1
- package/dist/transactions.d.ts +34 -3
- package/dist/transactions.js +25 -18
- package/dist/transcoders.d.ts +68 -0
- package/dist/transcoders.js +194 -1
- package/dist/usermanager.d.ts +14 -14
- package/dist/usermanager.js +178 -228
- package/dist/utilities.js +4 -6
- package/dist/utilities_internal.js +1 -2
- package/package.json +9 -8
- package/src/binding.cpp +13 -13
- package/src/connection.cpp +22 -0
- package/src/connection.hpp +12 -0
- package/src/connection_autogen.cpp +100 -0
- package/src/jstocbpp_autogen.hpp +315 -8
- package/src/jstocbpp_transactions.hpp +1 -2
- package/tools/gen-bindings-js.js +38 -3
- package/tools/gen-bindings-json.py +575 -328
@@ -0,0 +1,256 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-2024 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 "streams.hxx"
|
19
|
+
|
20
|
+
#include "core/platform/uuid.h"
|
21
|
+
|
22
|
+
#include <asio.hpp>
|
23
|
+
#include <asio/error.hpp>
|
24
|
+
#include <asio/ssl.hpp>
|
25
|
+
|
26
|
+
namespace couchbase::core::io
|
27
|
+
{
|
28
|
+
stream_impl::stream_impl(asio::io_context& ctx, bool is_tls)
|
29
|
+
: strand_(asio::make_strand(ctx))
|
30
|
+
, tls_(is_tls)
|
31
|
+
, id_(uuid::to_string(uuid::random()))
|
32
|
+
{
|
33
|
+
}
|
34
|
+
|
35
|
+
auto
|
36
|
+
stream_impl::log_prefix() const -> std::string_view
|
37
|
+
{
|
38
|
+
return tls_ ? "tls" : "plain";
|
39
|
+
}
|
40
|
+
|
41
|
+
auto
|
42
|
+
stream_impl::id() const -> const std::string&
|
43
|
+
{
|
44
|
+
return id_;
|
45
|
+
}
|
46
|
+
|
47
|
+
plain_stream_impl::plain_stream_impl(asio::io_context& ctx)
|
48
|
+
: stream_impl(ctx, false)
|
49
|
+
, stream_(std::make_shared<asio::ip::tcp::socket>(strand_))
|
50
|
+
{
|
51
|
+
}
|
52
|
+
|
53
|
+
auto
|
54
|
+
plain_stream_impl::local_endpoint() const -> asio::ip::tcp::endpoint
|
55
|
+
{
|
56
|
+
if (!stream_) {
|
57
|
+
return {};
|
58
|
+
}
|
59
|
+
std::error_code ec;
|
60
|
+
auto res = stream_->local_endpoint(ec);
|
61
|
+
if (ec) {
|
62
|
+
return {};
|
63
|
+
}
|
64
|
+
return res;
|
65
|
+
}
|
66
|
+
|
67
|
+
auto
|
68
|
+
plain_stream_impl::is_open() const -> bool
|
69
|
+
{
|
70
|
+
if (stream_) {
|
71
|
+
return stream_->is_open();
|
72
|
+
}
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
|
76
|
+
void
|
77
|
+
plain_stream_impl::close(utils::movable_function<void(std::error_code)>&& handler)
|
78
|
+
{
|
79
|
+
if (!stream_) {
|
80
|
+
return handler(asio::error::bad_descriptor);
|
81
|
+
}
|
82
|
+
return asio::post(strand_, [stream = std::move(stream_), handler = std::move(handler)]() {
|
83
|
+
asio::error_code ec{};
|
84
|
+
stream->shutdown(asio::socket_base::shutdown_both, ec);
|
85
|
+
stream->close(ec);
|
86
|
+
handler(ec);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
void
|
91
|
+
plain_stream_impl::set_options()
|
92
|
+
{
|
93
|
+
if (!is_open()) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
std::error_code ec{};
|
97
|
+
stream_->set_option(asio::ip::tcp::no_delay{ true }, ec);
|
98
|
+
stream_->set_option(asio::socket_base::keep_alive{ true }, ec);
|
99
|
+
}
|
100
|
+
|
101
|
+
void
|
102
|
+
plain_stream_impl::async_connect(
|
103
|
+
const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
104
|
+
utils::movable_function<void(std::error_code)>&& handler)
|
105
|
+
{
|
106
|
+
if (!stream_) {
|
107
|
+
id_ = uuid::to_string(uuid::random());
|
108
|
+
stream_ = std::make_shared<asio::ip::tcp::socket>(strand_);
|
109
|
+
}
|
110
|
+
return stream_->async_connect(endpoint,
|
111
|
+
[stream = stream_, handler = std::move(handler)](auto ec) {
|
112
|
+
return handler(ec);
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
void
|
117
|
+
plain_stream_impl::async_write(
|
118
|
+
std::vector<asio::const_buffer>& buffers,
|
119
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler)
|
120
|
+
{
|
121
|
+
if (!is_open()) {
|
122
|
+
return handler(asio::error::bad_descriptor, {});
|
123
|
+
}
|
124
|
+
return asio::async_write(
|
125
|
+
*stream_,
|
126
|
+
buffers,
|
127
|
+
[stream = stream_, handler = std::move(handler)](auto ec, auto bytes_transferred) {
|
128
|
+
return handler(ec, bytes_transferred);
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
void
|
133
|
+
plain_stream_impl::async_read_some(
|
134
|
+
asio::mutable_buffer buffer,
|
135
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler)
|
136
|
+
{
|
137
|
+
if (!is_open()) {
|
138
|
+
return handler(asio::error::bad_descriptor, {});
|
139
|
+
}
|
140
|
+
return stream_->async_read_some(buffer, std::move(handler));
|
141
|
+
}
|
142
|
+
|
143
|
+
tls_stream_impl::tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls)
|
144
|
+
: stream_impl(ctx, true)
|
145
|
+
, tls_(tls)
|
146
|
+
, stream_(
|
147
|
+
std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(asio::ip::tcp::socket(strand_),
|
148
|
+
tls_))
|
149
|
+
{
|
150
|
+
}
|
151
|
+
|
152
|
+
auto
|
153
|
+
tls_stream_impl::local_endpoint() const -> asio::ip::tcp::endpoint
|
154
|
+
{
|
155
|
+
if (!stream_) {
|
156
|
+
return {};
|
157
|
+
}
|
158
|
+
std::error_code ec;
|
159
|
+
auto res = stream_->lowest_layer().local_endpoint(ec);
|
160
|
+
if (ec) {
|
161
|
+
return {};
|
162
|
+
}
|
163
|
+
return res;
|
164
|
+
}
|
165
|
+
|
166
|
+
auto
|
167
|
+
tls_stream_impl::is_open() const -> bool
|
168
|
+
{
|
169
|
+
if (stream_) {
|
170
|
+
return stream_->lowest_layer().is_open();
|
171
|
+
}
|
172
|
+
return false;
|
173
|
+
}
|
174
|
+
|
175
|
+
void
|
176
|
+
tls_stream_impl::close(utils::movable_function<void(std::error_code)>&& handler)
|
177
|
+
{
|
178
|
+
if (!stream_) {
|
179
|
+
return handler(asio::error::bad_descriptor);
|
180
|
+
}
|
181
|
+
return asio::post(strand_, [stream = std::move(stream_), handler = std::move(handler)]() {
|
182
|
+
asio::error_code ec{};
|
183
|
+
stream->lowest_layer().shutdown(asio::socket_base::shutdown_both, ec);
|
184
|
+
stream->lowest_layer().close(ec);
|
185
|
+
handler(ec);
|
186
|
+
});
|
187
|
+
}
|
188
|
+
|
189
|
+
void
|
190
|
+
tls_stream_impl::set_options()
|
191
|
+
{
|
192
|
+
if (!is_open()) {
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
std::error_code ec{};
|
196
|
+
stream_->lowest_layer().set_option(asio::ip::tcp::no_delay{ true }, ec);
|
197
|
+
stream_->lowest_layer().set_option(asio::socket_base::keep_alive{ true }, ec);
|
198
|
+
}
|
199
|
+
|
200
|
+
void
|
201
|
+
tls_stream_impl::async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
202
|
+
utils::movable_function<void(std::error_code)>&& handler)
|
203
|
+
{
|
204
|
+
if (!stream_) {
|
205
|
+
id_ = uuid::to_string(uuid::random());
|
206
|
+
stream_ = std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(
|
207
|
+
asio::ip::tcp::socket(strand_), tls_);
|
208
|
+
}
|
209
|
+
return stream_->lowest_layer().async_connect(
|
210
|
+
endpoint, [stream = stream_, handler = std::move(handler)](std::error_code ec_connect) mutable {
|
211
|
+
if (ec_connect == asio::error::operation_aborted) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
if (ec_connect) {
|
215
|
+
return handler(ec_connect);
|
216
|
+
}
|
217
|
+
stream->async_handshake(
|
218
|
+
asio::ssl::stream_base::client,
|
219
|
+
[stream, handler = std::move(handler)](std::error_code ec_handshake) mutable {
|
220
|
+
if (ec_handshake == asio::error::operation_aborted) {
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
return handler(ec_handshake);
|
224
|
+
});
|
225
|
+
});
|
226
|
+
}
|
227
|
+
|
228
|
+
void
|
229
|
+
tls_stream_impl::async_write(std::vector<asio::const_buffer>& buffers,
|
230
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler)
|
231
|
+
{
|
232
|
+
if (!is_open()) {
|
233
|
+
return handler(asio::error::bad_descriptor, {});
|
234
|
+
}
|
235
|
+
return asio::async_write(
|
236
|
+
*stream_,
|
237
|
+
buffers,
|
238
|
+
[stream = stream_, handler = std::move(handler)](auto ec, auto bytes_transferred) {
|
239
|
+
return handler(ec, bytes_transferred);
|
240
|
+
});
|
241
|
+
}
|
242
|
+
|
243
|
+
void
|
244
|
+
tls_stream_impl::async_read_some(
|
245
|
+
asio::mutable_buffer buffer,
|
246
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler)
|
247
|
+
{
|
248
|
+
if (!is_open()) {
|
249
|
+
return handler(asio::error::bad_descriptor, {});
|
250
|
+
}
|
251
|
+
return stream_->async_read_some(
|
252
|
+
buffer, [stream = stream_, handler = std::move(handler)](auto ec, auto bytes_transferred) {
|
253
|
+
return handler(ec, bytes_transferred);
|
254
|
+
});
|
255
|
+
}
|
256
|
+
} // namespace couchbase::core::io
|
@@ -20,10 +20,15 @@
|
|
20
20
|
#include "core/utils/movable_function.hxx"
|
21
21
|
#include "ip_protocol.hxx"
|
22
22
|
|
23
|
-
#include <asio.hpp>
|
24
|
-
#include <asio/
|
23
|
+
#include <asio/error.hpp>
|
24
|
+
#include <asio/io_context.hpp>
|
25
|
+
#include <asio/ip/tcp.hpp>
|
26
|
+
#include <asio/ssl/context.hpp>
|
27
|
+
#include <asio/ssl/stream.hpp>
|
28
|
+
#include <asio/strand.hpp>
|
25
29
|
|
26
|
-
#include <
|
30
|
+
#include <string>
|
31
|
+
#include <vector>
|
27
32
|
|
28
33
|
namespace couchbase::core::io
|
29
34
|
{
|
@@ -59,43 +64,26 @@ protected:
|
|
59
64
|
asio::strand<asio::io_context::executor_type> strand_;
|
60
65
|
bool tls_;
|
61
66
|
std::string id_{};
|
62
|
-
std::atomic_bool open_{ false };
|
63
67
|
|
64
68
|
public:
|
65
|
-
stream_impl(asio::io_context& ctx, bool is_tls)
|
66
|
-
: strand_(asio::make_strand(ctx))
|
67
|
-
, tls_(is_tls)
|
68
|
-
, id_(uuid::to_string(uuid::random()))
|
69
|
-
{
|
70
|
-
}
|
69
|
+
stream_impl(asio::io_context& ctx, bool is_tls);
|
71
70
|
|
72
71
|
virtual ~stream_impl() = default;
|
73
72
|
|
74
|
-
[[nodiscard]] auto log_prefix() const -> std::string_view
|
75
|
-
{
|
76
|
-
return tls_ ? "tls" : "plain";
|
77
|
-
}
|
78
|
-
|
79
|
-
[[nodiscard]] auto id() const -> const std::string&
|
80
|
-
{
|
81
|
-
return id_;
|
82
|
-
}
|
73
|
+
[[nodiscard]] auto log_prefix() const -> std::string_view;
|
83
74
|
|
84
|
-
[[nodiscard]] auto
|
85
|
-
{
|
86
|
-
return open_;
|
87
|
-
}
|
75
|
+
[[nodiscard]] auto id() const -> const std::string&;
|
88
76
|
|
89
|
-
auto get_executor() const noexcept
|
77
|
+
[[nodiscard]] auto get_executor() const noexcept
|
90
78
|
{
|
91
79
|
return strand_;
|
92
80
|
}
|
93
81
|
|
94
82
|
[[nodiscard]] virtual auto local_endpoint() const -> asio::ip::tcp::endpoint = 0;
|
95
83
|
|
96
|
-
virtual
|
84
|
+
[[nodiscard]] virtual auto is_open() const -> bool = 0;
|
97
85
|
|
98
|
-
virtual void
|
86
|
+
virtual void close(utils::movable_function<void(std::error_code)>&& handler) = 0;
|
99
87
|
|
100
88
|
virtual void set_options() = 0;
|
101
89
|
|
@@ -117,165 +105,53 @@ private:
|
|
117
105
|
std::shared_ptr<asio::ip::tcp::socket> stream_;
|
118
106
|
|
119
107
|
public:
|
120
|
-
explicit plain_stream_impl(asio::io_context& ctx)
|
121
|
-
: stream_impl(ctx, false)
|
122
|
-
, stream_(std::make_shared<asio::ip::tcp::socket>(strand_))
|
123
|
-
{
|
124
|
-
}
|
108
|
+
explicit plain_stream_impl(asio::io_context& ctx);
|
125
109
|
|
126
|
-
[[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override
|
127
|
-
{
|
128
|
-
std::error_code ec;
|
129
|
-
auto res = stream_->local_endpoint(ec);
|
130
|
-
if (ec) {
|
131
|
-
return {};
|
132
|
-
}
|
133
|
-
return res;
|
134
|
-
}
|
110
|
+
[[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override;
|
135
111
|
|
136
|
-
|
137
|
-
{
|
138
|
-
open_ = false;
|
139
|
-
return asio::post(strand_, [stream = stream_, h = std::move(handler)]() {
|
140
|
-
asio::error_code ec{};
|
141
|
-
stream->shutdown(asio::socket_base::shutdown_both, ec);
|
142
|
-
stream->close(ec);
|
143
|
-
h(ec);
|
144
|
-
});
|
145
|
-
}
|
112
|
+
[[nodiscard]] auto is_open() const -> bool override;
|
146
113
|
|
147
|
-
void
|
148
|
-
{
|
149
|
-
return close([this](std::error_code) {
|
150
|
-
id_ = uuid::to_string(uuid::random());
|
151
|
-
stream_ = std::make_shared<asio::ip::tcp::socket>(strand_);
|
152
|
-
});
|
153
|
-
}
|
114
|
+
void close(utils::movable_function<void(std::error_code)>&& handler) override;
|
154
115
|
|
155
|
-
void set_options() override
|
156
|
-
{
|
157
|
-
if (!open_ || !stream_) {
|
158
|
-
return;
|
159
|
-
}
|
160
|
-
std::error_code ec{};
|
161
|
-
stream_->set_option(asio::ip::tcp::no_delay{ true }, ec);
|
162
|
-
stream_->set_option(asio::socket_base::keep_alive{ true }, ec);
|
163
|
-
}
|
116
|
+
void set_options() override;
|
164
117
|
|
165
118
|
void async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
166
|
-
utils::movable_function<void(std::error_code)>&& handler) override
|
167
|
-
{
|
168
|
-
return stream_->async_connect(endpoint, [this, h = std::move(handler)](std::error_code ec) {
|
169
|
-
open_ = stream_->is_open();
|
170
|
-
h(ec);
|
171
|
-
});
|
172
|
-
}
|
119
|
+
utils::movable_function<void(std::error_code)>&& handler) override;
|
173
120
|
|
174
121
|
void async_write(std::vector<asio::const_buffer>& buffers,
|
175
|
-
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override
|
176
|
-
{
|
177
|
-
return asio::async_write(*stream_, buffers, std::move(handler));
|
178
|
-
}
|
122
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override;
|
179
123
|
|
180
124
|
void async_read_some(
|
181
125
|
asio::mutable_buffer buffer,
|
182
|
-
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override
|
183
|
-
{
|
184
|
-
return stream_->async_read_some(buffer, std::move(handler));
|
185
|
-
}
|
126
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override;
|
186
127
|
};
|
187
128
|
|
188
129
|
class tls_stream_impl : public stream_impl
|
189
130
|
{
|
190
131
|
private:
|
191
|
-
std::shared_ptr<asio::ssl::stream<asio::ip::tcp::socket>> stream_;
|
192
132
|
asio::ssl::context& tls_;
|
133
|
+
std::shared_ptr<asio::ssl::stream<asio::ip::tcp::socket>> stream_;
|
193
134
|
|
194
135
|
public:
|
195
|
-
tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls)
|
196
|
-
: stream_impl(ctx, true)
|
197
|
-
, stream_(
|
198
|
-
std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(asio::ip::tcp::socket(strand_),
|
199
|
-
tls))
|
200
|
-
, tls_(tls)
|
201
|
-
{
|
202
|
-
}
|
136
|
+
tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls);
|
203
137
|
|
204
|
-
[[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override
|
205
|
-
{
|
206
|
-
std::error_code ec;
|
207
|
-
auto res = stream_->lowest_layer().local_endpoint(ec);
|
208
|
-
if (ec) {
|
209
|
-
return {};
|
210
|
-
}
|
211
|
-
return res;
|
212
|
-
}
|
138
|
+
[[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override;
|
213
139
|
|
214
|
-
|
215
|
-
{
|
216
|
-
open_ = false;
|
217
|
-
return asio::post(strand_, [stream = stream_, h = std::move(handler)]() {
|
218
|
-
asio::error_code ec{};
|
219
|
-
stream->lowest_layer().shutdown(asio::socket_base::shutdown_both, ec);
|
220
|
-
stream->lowest_layer().close(ec);
|
221
|
-
h(ec);
|
222
|
-
});
|
223
|
-
}
|
140
|
+
[[nodiscard]] auto is_open() const -> bool override;
|
224
141
|
|
225
|
-
void
|
226
|
-
{
|
227
|
-
return close([this](std::error_code) {
|
228
|
-
id_ = uuid::to_string(uuid::random());
|
229
|
-
stream_ = std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(
|
230
|
-
asio::ip::tcp::socket(strand_), tls_);
|
231
|
-
});
|
232
|
-
}
|
142
|
+
void close(utils::movable_function<void(std::error_code)>&& handler) override;
|
233
143
|
|
234
|
-
void set_options() override
|
235
|
-
{
|
236
|
-
if (!open_ || !stream_) {
|
237
|
-
return;
|
238
|
-
}
|
239
|
-
std::error_code ec{};
|
240
|
-
stream_->lowest_layer().set_option(asio::ip::tcp::no_delay{ true }, ec);
|
241
|
-
stream_->lowest_layer().set_option(asio::socket_base::keep_alive{ true }, ec);
|
242
|
-
}
|
144
|
+
void set_options() override;
|
243
145
|
|
244
146
|
void async_connect(const asio::ip::tcp::resolver::results_type::endpoint_type& endpoint,
|
245
|
-
utils::movable_function<void(std::error_code)>&& handler) override
|
246
|
-
{
|
247
|
-
return stream_->lowest_layer().async_connect(
|
248
|
-
endpoint, [this, handler = std::move(handler)](std::error_code ec_connect) mutable {
|
249
|
-
if (ec_connect == asio::error::operation_aborted) {
|
250
|
-
return;
|
251
|
-
}
|
252
|
-
if (ec_connect) {
|
253
|
-
return handler(ec_connect);
|
254
|
-
}
|
255
|
-
open_ = stream_->lowest_layer().is_open();
|
256
|
-
stream_->async_handshake(
|
257
|
-
asio::ssl::stream_base::client,
|
258
|
-
[handler = std::move(handler)](std::error_code ec_handshake) mutable {
|
259
|
-
if (ec_handshake == asio::error::operation_aborted) {
|
260
|
-
return;
|
261
|
-
}
|
262
|
-
return handler(ec_handshake);
|
263
|
-
});
|
264
|
-
});
|
265
|
-
}
|
147
|
+
utils::movable_function<void(std::error_code)>&& handler) override;
|
266
148
|
|
267
149
|
void async_write(std::vector<asio::const_buffer>& buffers,
|
268
|
-
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override
|
269
|
-
{
|
270
|
-
return asio::async_write(*stream_, buffers, std::move(handler));
|
271
|
-
}
|
150
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override;
|
272
151
|
|
273
152
|
void async_read_some(
|
274
153
|
asio::mutable_buffer buffer,
|
275
|
-
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override
|
276
|
-
{
|
277
|
-
return stream_->async_read_some(buffer, std::move(handler));
|
278
|
-
}
|
154
|
+
utils::movable_function<void(std::error_code, std::size_t)>&& handler) override;
|
279
155
|
};
|
280
156
|
|
281
157
|
} // namespace couchbase::core::io
|
@@ -24,6 +24,7 @@
|
|
24
24
|
|
25
25
|
#include "core/platform/dirutils.h"
|
26
26
|
|
27
|
+
#include <algorithm>
|
27
28
|
#include <gsl/assert>
|
28
29
|
#include <memory>
|
29
30
|
#include <spdlog/details/file_helper.h>
|
@@ -49,9 +50,7 @@ find_first_logfile_id(const std::string& basename) -> unsigned long
|
|
49
50
|
if (index != std::string::npos) {
|
50
51
|
try {
|
51
52
|
const unsigned long value = std::stoul(file.substr(index + 1));
|
52
|
-
|
53
|
-
id = value;
|
54
|
-
}
|
53
|
+
id = std::max(value, id);
|
55
54
|
} catch (const std::invalid_argument&) {
|
56
55
|
continue; /* ignore */
|
57
56
|
} catch (const std::out_of_range&) {
|
@@ -25,6 +25,7 @@
|
|
25
25
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
26
26
|
#include <spdlog/spdlog.h>
|
27
27
|
|
28
|
+
#include <algorithm>
|
28
29
|
#include <atomic>
|
29
30
|
#include <chrono>
|
30
31
|
#include <memory>
|
@@ -77,8 +78,10 @@ update_file_logger(const std::shared_ptr<spdlog::logger>& new_logger)
|
|
77
78
|
const std::scoped_lock lock(file_logger_mutex);
|
78
79
|
// delete if already exists
|
79
80
|
spdlog::drop(file_logger_name);
|
80
|
-
|
81
|
-
|
81
|
+
if (new_logger) {
|
82
|
+
file_logger = new_logger;
|
83
|
+
spdlog::register_logger(new_logger);
|
84
|
+
}
|
82
85
|
++file_logger_version;
|
83
86
|
}
|
84
87
|
|
@@ -112,6 +115,28 @@ translate_level(level level) -> spdlog::level::level_enum
|
|
112
115
|
return spdlog::level::level_enum::trace;
|
113
116
|
}
|
114
117
|
|
118
|
+
auto
|
119
|
+
translate_level(spdlog::level::level_enum spdlog_level) -> level
|
120
|
+
{
|
121
|
+
switch (spdlog_level) {
|
122
|
+
case spdlog::level::level_enum::trace:
|
123
|
+
return level::trace;
|
124
|
+
case spdlog::level::debug:
|
125
|
+
return level::debug;
|
126
|
+
case spdlog::level::info:
|
127
|
+
return level::info;
|
128
|
+
case spdlog::level::warn:
|
129
|
+
return level::warn;
|
130
|
+
case spdlog::level::err:
|
131
|
+
return level::err;
|
132
|
+
case spdlog::level::critical:
|
133
|
+
return level::critical;
|
134
|
+
default:
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
return level::off;
|
138
|
+
}
|
139
|
+
|
115
140
|
auto
|
116
141
|
level_from_str(const std::string& str) -> level
|
117
142
|
{
|
@@ -248,11 +273,7 @@ create_file_logger_impl(const std::string& logger_name, const configuration& log
|
|
248
273
|
|
249
274
|
// Set the formatting pattern of this sink
|
250
275
|
stderrsink->set_pattern(log_pattern);
|
251
|
-
|
252
|
-
stderrsink->set_level(spdlog::level::trace);
|
253
|
-
} else {
|
254
|
-
stderrsink->set_level(spdlog::level::err);
|
255
|
-
}
|
276
|
+
stderrsink->set_level(translate_level(logger_settings.console_sink_log_level));
|
256
277
|
sink->add_sink(stderrsink);
|
257
278
|
}
|
258
279
|
if (nullptr != logger_settings.sink) {
|
@@ -410,6 +431,17 @@ check_log_levels(level lvl) -> bool
|
|
410
431
|
return correct;
|
411
432
|
}
|
412
433
|
|
434
|
+
auto
|
435
|
+
get_lowest_log_level() -> level
|
436
|
+
{
|
437
|
+
auto lowest = spdlog::level::off;
|
438
|
+
// Apply the function to each registered spdlog::logger except protocol logger
|
439
|
+
spdlog::apply_all([&lowest](const std::shared_ptr<spdlog::logger>& l) {
|
440
|
+
lowest = std::min(l->level(), lowest);
|
441
|
+
});
|
442
|
+
return translate_level(lowest);
|
443
|
+
}
|
444
|
+
|
413
445
|
void
|
414
446
|
set_log_levels(level lvl)
|
415
447
|
{
|
@@ -148,6 +148,13 @@ check_log_levels(level lvl) -> bool;
|
|
148
148
|
void
|
149
149
|
set_log_levels(level lvl);
|
150
150
|
|
151
|
+
/**
|
152
|
+
* Get the lowest (most verbose) level among the registered loggers
|
153
|
+
* @return log severity level
|
154
|
+
*/
|
155
|
+
auto
|
156
|
+
get_lowest_log_level() -> level;
|
157
|
+
|
151
158
|
/**
|
152
159
|
* Checks whether a specific level should be logged based on the current
|
153
160
|
* configuration.
|
@@ -195,3 +195,14 @@
|
|
195
195
|
* encode document content or decode results.
|
196
196
|
*/
|
197
197
|
#define COUCHBASE_CXX_CLIENT_PUBLIC_API_USES_TAO_JSON_ONLY_FOR_CONTENT
|
198
|
+
|
199
|
+
/**
|
200
|
+
* couchbase::metrics::otel_meter uses the GA version of the OpenTelemetry Metrics API.
|
201
|
+
* The Metrics API for OpenTelemetry was GA'd in version 1.7.0.
|
202
|
+
*/
|
203
|
+
#define COUCHBASE_CXX_CLIENT_OTEL_METER_USES_GA_METRICS_API 1
|
204
|
+
|
205
|
+
/**
|
206
|
+
* All options classes in the Public API expose the parent_span option.
|
207
|
+
*/
|
208
|
+
#define COUCHBASE_CXX_CLIENT_PUBLIC_API_PARENT_SPAN 1
|