grpc 1.49.0.pre1-x86_64-linux → 1.50.0.pre1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +19 -16
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +32 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
@@ -57,7 +57,6 @@
|
|
57
57
|
#include "src/core/lib/iomgr/error.h"
|
58
58
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
59
59
|
#include "src/core/lib/iomgr/timer.h"
|
60
|
-
#include "src/core/lib/profiling/timers.h"
|
61
60
|
#include "src/core/lib/slice/slice.h"
|
62
61
|
#include "src/core/lib/slice/slice_internal.h"
|
63
62
|
#include "src/core/lib/transport/bdp_estimator.h"
|
@@ -112,7 +111,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
|
|
112
111
|
// in a loop while draining the currently-held combiner. Also see
|
113
112
|
// https://github.com/grpc/grpc/issues/26079.
|
114
113
|
grpc_core::ExecCtx::Get()->InvalidateNow();
|
115
|
-
grpc_core::Timestamp now = grpc_core::
|
114
|
+
grpc_core::Timestamp now = grpc_core::Timestamp::Now();
|
116
115
|
|
117
116
|
grpc_core::Duration next_allowed_ping_interval = grpc_core::Duration::Zero();
|
118
117
|
if (t->is_client) {
|
@@ -266,17 +265,6 @@ class WriteContext {
|
|
266
265
|
public:
|
267
266
|
explicit WriteContext(grpc_chttp2_transport* t) : t_(t) {
|
268
267
|
GRPC_STATS_INC_HTTP2_WRITES_BEGUN();
|
269
|
-
GPR_TIMER_SCOPE("grpc_chttp2_begin_write", 0);
|
270
|
-
}
|
271
|
-
|
272
|
-
// TODO(ctiller): make this the destructor
|
273
|
-
void FlushStats() {
|
274
|
-
GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE(
|
275
|
-
initial_metadata_writes_);
|
276
|
-
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(message_writes_);
|
277
|
-
GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE(
|
278
|
-
trailing_metadata_writes_);
|
279
|
-
GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(flow_control_writes_);
|
280
268
|
}
|
281
269
|
|
282
270
|
void FlushSettings() {
|
@@ -515,9 +503,11 @@ class StreamWriteContext {
|
|
515
503
|
|
516
504
|
if (!data_send_context.AnyOutgoing()) {
|
517
505
|
if (t_->flow_control.remote_window() <= 0) {
|
506
|
+
GRPC_STATS_INC_HTTP2_TRANSPORT_STALLS();
|
518
507
|
report_stall(t_, s_, "transport");
|
519
508
|
grpc_chttp2_list_add_stalled_by_transport(t_, s_);
|
520
509
|
} else if (data_send_context.stream_remote_window() <= 0) {
|
510
|
+
GRPC_STATS_INC_HTTP2_STREAM_STALLS();
|
521
511
|
report_stall(t_, s_, "stream");
|
522
512
|
grpc_chttp2_list_add_stalled_by_stream(t_, s_);
|
523
513
|
}
|
@@ -672,7 +662,6 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
|
|
672
662
|
}
|
673
663
|
|
674
664
|
void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error_handle error) {
|
675
|
-
GPR_TIMER_SCOPE("grpc_chttp2_end_write", 0);
|
676
665
|
grpc_chttp2_stream* s;
|
677
666
|
|
678
667
|
if (t->channelz_socket != nullptr) {
|
@@ -33,7 +33,6 @@
|
|
33
33
|
#include "absl/strings/str_cat.h"
|
34
34
|
#include "absl/strings/string_view.h"
|
35
35
|
#include "absl/types/optional.h"
|
36
|
-
#include "absl/utility/utility.h"
|
37
36
|
|
38
37
|
#include <grpc/grpc.h>
|
39
38
|
#include <grpc/impl/codegen/connectivity_state.h>
|
@@ -54,7 +53,6 @@
|
|
54
53
|
#include "src/core/lib/iomgr/error.h"
|
55
54
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
56
55
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
57
|
-
#include "src/core/lib/iomgr/pollset.h"
|
58
56
|
#include "src/core/lib/resource_quota/arena.h"
|
59
57
|
#include "src/core/lib/slice/slice.h"
|
60
58
|
#include "src/core/lib/slice/slice_buffer.h"
|
@@ -86,7 +84,7 @@ void fill_in_metadata(inproc_stream* s, const grpc_metadata_batch* metadata,
|
|
86
84
|
grpc_metadata_batch* out_md, bool* markfilled);
|
87
85
|
|
88
86
|
void ResetSendMessage(grpc_transport_stream_op_batch* batch) {
|
89
|
-
|
87
|
+
std::exchange(batch->payload->send_message.send_message, nullptr)->Clear();
|
90
88
|
}
|
91
89
|
|
92
90
|
struct shared_mu {
|
@@ -20,12 +20,70 @@
|
|
20
20
|
|
21
21
|
#include "src/core/ext/xds/certificate_provider_store.h"
|
22
22
|
|
23
|
+
#include "absl/strings/str_cat.h"
|
24
|
+
|
23
25
|
#include <grpc/support/log.h>
|
24
26
|
|
25
|
-
#include "src/core/
|
27
|
+
#include "src/core/lib/config/core_configuration.h"
|
28
|
+
#include "src/core/lib/iomgr/error.h"
|
29
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
|
26
30
|
|
27
31
|
namespace grpc_core {
|
28
32
|
|
33
|
+
//
|
34
|
+
// CertificateProviderStore::PluginDefinition
|
35
|
+
//
|
36
|
+
|
37
|
+
const JsonLoaderInterface*
|
38
|
+
CertificateProviderStore::PluginDefinition::JsonLoader(const JsonArgs&) {
|
39
|
+
static const auto* loader =
|
40
|
+
JsonObjectLoader<PluginDefinition>()
|
41
|
+
.Field("plugin_name", &PluginDefinition::plugin_name)
|
42
|
+
.Finish();
|
43
|
+
return loader;
|
44
|
+
}
|
45
|
+
|
46
|
+
void CertificateProviderStore::PluginDefinition::JsonPostLoad(
|
47
|
+
const Json& json, const JsonArgs&, ValidationErrors* errors) {
|
48
|
+
// Check that plugin is supported.
|
49
|
+
CertificateProviderFactory* factory = nullptr;
|
50
|
+
if (!plugin_name.empty()) {
|
51
|
+
ValidationErrors::ScopedField field(errors, ".plugin_name");
|
52
|
+
factory = CoreConfiguration::Get()
|
53
|
+
.certificate_provider_registry()
|
54
|
+
.LookupCertificateProviderFactory(plugin_name);
|
55
|
+
if (factory == nullptr) {
|
56
|
+
errors->AddError(absl::StrCat("Unrecognized plugin name: ", plugin_name));
|
57
|
+
return; // No point checking config.
|
58
|
+
}
|
59
|
+
}
|
60
|
+
// Parse the config field.
|
61
|
+
{
|
62
|
+
ValidationErrors::ScopedField field(errors, ".config");
|
63
|
+
auto it = json.object_value().find("config");
|
64
|
+
// The config field is optional; if not present, we use an empty JSON
|
65
|
+
// object.
|
66
|
+
Json::Object config_json;
|
67
|
+
if (it != json.object_value().end()) {
|
68
|
+
if (it->second.type() != Json::Type::OBJECT) {
|
69
|
+
errors->AddError("is not an object");
|
70
|
+
return; // No point parsing config.
|
71
|
+
} else {
|
72
|
+
config_json = it->second.object_value();
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if (factory == nullptr) return;
|
76
|
+
// Use plugin to validate and parse config.
|
77
|
+
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
78
|
+
config =
|
79
|
+
factory->CreateCertificateProviderConfig(config_json, &parse_error);
|
80
|
+
if (!GRPC_ERROR_IS_NONE(parse_error)) {
|
81
|
+
errors->AddError(grpc_error_std_string(parse_error));
|
82
|
+
GRPC_ERROR_UNREF(parse_error);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
29
87
|
//
|
30
88
|
// CertificateProviderStore::CertificateProviderWrapper
|
31
89
|
//
|
@@ -70,8 +128,10 @@ CertificateProviderStore::CreateCertificateProviderLocked(
|
|
70
128
|
return nullptr;
|
71
129
|
}
|
72
130
|
CertificateProviderFactory* factory =
|
73
|
-
|
74
|
-
|
131
|
+
CoreConfiguration::Get()
|
132
|
+
.certificate_provider_registry()
|
133
|
+
.LookupCertificateProviderFactory(
|
134
|
+
plugin_config_it->second.plugin_name);
|
75
135
|
if (factory == nullptr) {
|
76
136
|
// This should never happen since an entry is only inserted in the
|
77
137
|
// plugin_config_map_ if the corresponding factory was found when parsing
|
@@ -30,13 +30,17 @@
|
|
30
30
|
|
31
31
|
#include <grpc/grpc_security.h>
|
32
32
|
|
33
|
-
#include "src/core/ext/xds/certificate_provider_factory.h"
|
34
33
|
#include "src/core/lib/gpr/useful.h"
|
35
34
|
#include "src/core/lib/gprpp/orphanable.h"
|
36
35
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
37
36
|
#include "src/core/lib/gprpp/sync.h"
|
38
37
|
#include "src/core/lib/gprpp/unique_type_name.h"
|
38
|
+
#include "src/core/lib/gprpp/validation_errors.h"
|
39
39
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
40
|
+
#include "src/core/lib/json/json.h"
|
41
|
+
#include "src/core/lib/json/json_args.h"
|
42
|
+
#include "src/core/lib/json/json_object_loader.h"
|
43
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_factory.h"
|
40
44
|
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h"
|
41
45
|
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
|
42
46
|
|
@@ -49,6 +53,10 @@ class CertificateProviderStore
|
|
49
53
|
struct PluginDefinition {
|
50
54
|
std::string plugin_name;
|
51
55
|
RefCountedPtr<CertificateProviderFactory::Config> config;
|
56
|
+
|
57
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
|
58
|
+
void JsonPostLoad(const Json& json, const JsonArgs&,
|
59
|
+
ValidationErrors* errors);
|
52
60
|
};
|
53
61
|
|
54
62
|
// Maps plugin instance (opaque) name to plugin defition.
|
@@ -31,8 +31,9 @@
|
|
31
31
|
#include <grpc/support/log.h>
|
32
32
|
#include <grpc/support/time.h>
|
33
33
|
|
34
|
-
#include "src/core/
|
34
|
+
#include "src/core/lib/config/core_configuration.h"
|
35
35
|
#include "src/core/lib/json/json_util.h"
|
36
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
|
36
37
|
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
|
37
38
|
|
38
39
|
namespace grpc_core {
|
@@ -143,11 +144,10 @@ FileWatcherCertificateProviderFactory::CreateCertificateProvider(
|
|
143
144
|
file_watcher_config->refresh_interval().millis() / GPR_MS_PER_SEC);
|
144
145
|
}
|
145
146
|
|
146
|
-
void
|
147
|
-
|
147
|
+
void RegisterFileWatcherCertificateProvider(
|
148
|
+
CoreConfiguration::Builder* builder) {
|
149
|
+
builder->certificate_provider_registry()->RegisterCertificateProviderFactory(
|
148
150
|
absl::make_unique<FileWatcherCertificateProviderFactory>());
|
149
151
|
}
|
150
152
|
|
151
|
-
void FileWatcherCertificateProviderShutdown() {}
|
152
|
-
|
153
153
|
} // namespace grpc_core
|
@@ -25,11 +25,11 @@
|
|
25
25
|
|
26
26
|
#include <grpc/grpc_security.h>
|
27
27
|
|
28
|
-
#include "src/core/ext/xds/certificate_provider_factory.h"
|
29
28
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
30
29
|
#include "src/core/lib/gprpp/time.h"
|
31
30
|
#include "src/core/lib/iomgr/error.h"
|
32
31
|
#include "src/core/lib/json/json.h"
|
32
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_factory.h"
|
33
33
|
|
34
34
|
namespace grpc_core {
|
35
35
|
|
data/src/core/ext/xds/xds_api.cc
CHANGED
@@ -201,34 +201,34 @@ void PopulateNode(const XdsApiContext& context, const XdsBootstrap::Node* node,
|
|
201
201
|
const std::string& user_agent_version,
|
202
202
|
envoy_config_core_v3_Node* node_msg) {
|
203
203
|
if (node != nullptr) {
|
204
|
-
if (!node->id.empty()) {
|
204
|
+
if (!node->id().empty()) {
|
205
205
|
envoy_config_core_v3_Node_set_id(node_msg,
|
206
|
-
StdStringToUpbString(node->id));
|
206
|
+
StdStringToUpbString(node->id()));
|
207
207
|
}
|
208
|
-
if (!node->cluster.empty()) {
|
208
|
+
if (!node->cluster().empty()) {
|
209
209
|
envoy_config_core_v3_Node_set_cluster(
|
210
|
-
node_msg, StdStringToUpbString(node->cluster));
|
210
|
+
node_msg, StdStringToUpbString(node->cluster()));
|
211
211
|
}
|
212
|
-
if (!node->metadata
|
212
|
+
if (!node->metadata().empty()) {
|
213
213
|
google_protobuf_Struct* metadata =
|
214
214
|
envoy_config_core_v3_Node_mutable_metadata(node_msg, context.arena);
|
215
|
-
PopulateMetadata(context, metadata, node->metadata
|
215
|
+
PopulateMetadata(context, metadata, node->metadata());
|
216
216
|
}
|
217
|
-
if (!node->locality_region.empty() || !node->locality_zone.empty() ||
|
218
|
-
!node->locality_sub_zone.empty()) {
|
217
|
+
if (!node->locality_region().empty() || !node->locality_zone().empty() ||
|
218
|
+
!node->locality_sub_zone().empty()) {
|
219
219
|
envoy_config_core_v3_Locality* locality =
|
220
220
|
envoy_config_core_v3_Node_mutable_locality(node_msg, context.arena);
|
221
|
-
if (!node->locality_region.empty()) {
|
221
|
+
if (!node->locality_region().empty()) {
|
222
222
|
envoy_config_core_v3_Locality_set_region(
|
223
|
-
locality, StdStringToUpbString(node->locality_region));
|
223
|
+
locality, StdStringToUpbString(node->locality_region()));
|
224
224
|
}
|
225
|
-
if (!node->locality_zone.empty()) {
|
225
|
+
if (!node->locality_zone().empty()) {
|
226
226
|
envoy_config_core_v3_Locality_set_zone(
|
227
|
-
locality, StdStringToUpbString(node->locality_zone));
|
227
|
+
locality, StdStringToUpbString(node->locality_zone()));
|
228
228
|
}
|
229
|
-
if (!node->locality_sub_zone.empty()) {
|
229
|
+
if (!node->locality_sub_zone().empty()) {
|
230
230
|
envoy_config_core_v3_Locality_set_sub_zone(
|
231
|
-
locality, StdStringToUpbString(node->locality_sub_zone));
|
231
|
+
locality, StdStringToUpbString(node->locality_sub_zone()));
|
232
232
|
}
|
233
233
|
}
|
234
234
|
}
|
@@ -390,13 +390,14 @@ absl::Status XdsApi::ParseAdsResponse(const XdsBootstrap::XdsServer& server,
|
|
390
390
|
absl::string_view serialized_resource =
|
391
391
|
UpbStringToAbsl(google_protobuf_Any_value(resources[i]));
|
392
392
|
// Unwrap Resource messages, if so wrapped.
|
393
|
+
absl::string_view resource_name;
|
393
394
|
if (type_url == "envoy.api.v2.Resource" ||
|
394
395
|
type_url == "envoy.service.discovery.v3.Resource") {
|
395
396
|
const auto* resource_wrapper = envoy_service_discovery_v3_Resource_parse(
|
396
397
|
serialized_resource.data(), serialized_resource.size(), arena.ptr());
|
397
398
|
if (resource_wrapper == nullptr) {
|
398
|
-
|
399
|
-
|
399
|
+
parser->ResourceWrapperParsingFailed(i);
|
400
|
+
continue;
|
400
401
|
}
|
401
402
|
const auto* resource =
|
402
403
|
envoy_service_discovery_v3_Resource_resource(resource_wrapper);
|
@@ -405,8 +406,11 @@ absl::Status XdsApi::ParseAdsResponse(const XdsBootstrap::XdsServer& server,
|
|
405
406
|
"type.googleapis.com/");
|
406
407
|
serialized_resource =
|
407
408
|
UpbStringToAbsl(google_protobuf_Any_value(resource));
|
409
|
+
resource_name = UpbStringToAbsl(
|
410
|
+
envoy_service_discovery_v3_Resource_name(resource_wrapper));
|
408
411
|
}
|
409
|
-
parser->ParseResource(context.arena, i, type_url,
|
412
|
+
parser->ParseResource(context.arena, i, type_url, resource_name,
|
413
|
+
serialized_resource);
|
410
414
|
}
|
411
415
|
return absl::OkStatus();
|
412
416
|
}
|
data/src/core/ext/xds/xds_api.h
CHANGED
@@ -67,9 +67,16 @@ class XdsApi {
|
|
67
67
|
virtual absl::Status ProcessAdsResponseFields(AdsResponseFields fields) = 0;
|
68
68
|
|
69
69
|
// Called to parse each individual resource in the ADS response.
|
70
|
+
// Note that resource_name is non-empty only when the resource was
|
71
|
+
// wrapped in a Resource wrapper proto.
|
70
72
|
virtual void ParseResource(upb_Arena* arena, size_t idx,
|
71
73
|
absl::string_view type_url,
|
74
|
+
absl::string_view resource_name,
|
72
75
|
absl::string_view serialized_resource) = 0;
|
76
|
+
|
77
|
+
// Called when a resource is wrapped in a Resource wrapper proto but
|
78
|
+
// we fail to deserialize the wrapper proto.
|
79
|
+
virtual void ResourceWrapperParsingFailed(size_t idx) = 0;
|
73
80
|
};
|
74
81
|
|
75
82
|
struct ClusterLoadReport {
|