grpc 1.75.0.pre1 → 1.76.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +18 -5
- data/include/grpc/credentials.h +21 -5
- data/src/core/call/call_filters.cc +4 -4
- data/src/core/call/call_filters.h +36 -36
- data/src/core/call/call_spine.h +27 -27
- data/src/core/call/client_call.cc +6 -5
- data/src/core/call/filter_fusion.h +5 -5
- data/src/core/call/metadata_batch.h +3 -3
- data/src/core/call/security_context.cc +1 -1
- data/src/core/call/server_call.cc +4 -4
- data/src/core/call/server_call.h +1 -1
- data/src/core/channelz/channelz.cc +12 -18
- data/src/core/channelz/channelz.h +32 -16
- data/src/core/channelz/channelz_registry.h +11 -0
- data/src/core/channelz/property_list.cc +18 -0
- data/src/core/channelz/property_list.h +10 -1
- data/src/core/channelz/text_encode.cc +66 -0
- data/src/core/channelz/text_encode.h +29 -0
- data/src/core/channelz/v2tov1/convert.cc +11 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
- data/src/core/channelz/ztrace_collector.h +247 -86
- data/src/core/client_channel/backup_poller.cc +5 -6
- data/src/core/client_channel/client_channel.cc +20 -13
- data/src/core/client_channel/client_channel_filter.cc +53 -45
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +3 -4
- data/src/core/client_channel/config_selector.h +3 -3
- data/src/core/client_channel/dynamic_filters.cc +3 -3
- data/src/core/client_channel/global_subchannel_pool.cc +0 -37
- data/src/core/client_channel/global_subchannel_pool.h +0 -27
- data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
- data/src/core/client_channel/local_subchannel_pool.cc +4 -4
- data/src/core/client_channel/retry_filter.h +3 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
- data/src/core/client_channel/subchannel.cc +8 -8
- data/src/core/client_channel/subchannel_stream_client.cc +4 -4
- data/src/core/config/config_vars.cc +30 -1
- data/src/core/config/config_vars.h +21 -0
- data/src/core/config/core_configuration.cc +5 -5
- data/src/core/config/core_configuration.h +7 -7
- data/src/core/config/load_config.cc +12 -0
- data/src/core/config/load_config.h +2 -0
- data/src/core/credentials/call/call_credentials.h +2 -2
- data/src/core/credentials/call/call_creds_util.cc +4 -3
- data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
- data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
- data/src/core/credentials/call/jwt/json_token.cc +3 -3
- data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
- data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
- data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
- data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
- data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
- data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
- data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
- data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
- data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
- data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
- data/src/core/credentials/transport/security_connector.cc +5 -5
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
- data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
- data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
- data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
- data/src/core/credentials/transport/transport_credentials.cc +2 -2
- data/src/core/credentials/transport/transport_credentials.h +2 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
- data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
- data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
- data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
- data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
- data/src/core/filter/auth/server_auth_filter.cc +2 -2
- data/src/core/handshaker/handshaker.cc +3 -3
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
- data/src/core/handshaker/security/secure_endpoint.cc +16 -6
- data/src/core/handshaker/security/security_handshaker.cc +3 -3
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
- data/src/core/lib/channel/channel_stack.cc +8 -5
- data/src/core/lib/channel/channel_stack.h +3 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.cc +69 -64
- data/src/core/lib/channel/promise_based_filter.h +16 -15
- data/src/core/lib/compression/compression_internal.cc +2 -2
- data/src/core/lib/compression/message_compress.cc +7 -7
- data/src/core/lib/event_engine/ares_resolver.cc +22 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
- data/src/core/lib/event_engine/extensions/channelz.h +2 -2
- data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +3 -3
- data/src/core/lib/event_engine/shim.cc +8 -11
- data/src/core/lib/event_engine/shim.h +2 -1
- data/src/core/lib/event_engine/slice.cc +2 -2
- data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
- data/src/core/lib/event_engine/windows/iocp.cc +10 -10
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
- data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
- data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
- data/src/core/lib/experiments/experiments.cc +105 -18
- data/src/core/lib/experiments/experiments.h +43 -11
- data/src/core/lib/iomgr/call_combiner.cc +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
- data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +8 -8
- data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
- data/src/core/lib/iomgr/lockfree_event.cc +2 -2
- data/src/core/lib/iomgr/polling_entity.cc +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_posix.cc +42 -42
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +7 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
- data/src/core/lib/iomgr/tcp_windows.cc +7 -7
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
- data/src/core/lib/promise/activity.cc +2 -2
- data/src/core/lib/promise/activity.h +6 -6
- data/src/core/lib/promise/context.h +2 -2
- data/src/core/lib/promise/detail/join_state.h +9 -9
- data/src/core/lib/promise/detail/seq_state.h +13 -13
- data/src/core/lib/promise/detail/status.h +2 -2
- data/src/core/lib/promise/for_each.h +5 -5
- data/src/core/lib/promise/interceptor_list.h +2 -2
- data/src/core/lib/promise/latch.h +7 -7
- data/src/core/lib/promise/mpsc.cc +26 -26
- data/src/core/lib/promise/mpsc.h +2 -2
- data/src/core/lib/promise/observable.h +4 -4
- data/src/core/lib/promise/party.cc +32 -25
- data/src/core/lib/promise/party.h +16 -19
- data/src/core/lib/promise/pipe.h +15 -15
- data/src/core/lib/promise/poll.h +5 -4
- data/src/core/lib/promise/promise.h +0 -2
- data/src/core/lib/promise/sleep.cc +3 -1
- data/src/core/lib/promise/status_flag.h +7 -7
- data/src/core/lib/promise/try_join.h +2 -2
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +15 -2
- data/src/core/lib/resource_quota/connection_quota.cc +9 -7
- data/src/core/lib/resource_quota/memory_quota.cc +45 -24
- data/src/core/lib/resource_quota/memory_quota.h +48 -16
- data/src/core/lib/resource_quota/telemetry.h +54 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -2
- data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
- data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
- data/src/core/lib/surface/call.cc +16 -14
- data/src/core/lib/surface/call.h +1 -1
- data/src/core/lib/surface/call_utils.cc +2 -2
- data/src/core/lib/surface/call_utils.h +2 -2
- data/src/core/lib/surface/channel.cc +4 -4
- data/src/core/lib/surface/channel_create.cc +10 -6
- data/src/core/lib/surface/channel_init.cc +80 -23
- data/src/core/lib/surface/channel_init.h +26 -11
- data/src/core/lib/surface/completion_queue.cc +17 -16
- data/src/core/lib/surface/completion_queue_factory.cc +7 -7
- data/src/core/lib/surface/connection_context.h +45 -2
- data/src/core/lib/surface/filter_stack_call.cc +12 -23
- data/src/core/lib/surface/filter_stack_call.h +3 -4
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/validate_metadata.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/promise_endpoint.cc +3 -3
- data/src/core/lib/transport/promise_endpoint.h +8 -8
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/load_balancing/child_policy_handler.cc +4 -4
- data/src/core/load_balancing/endpoint_list.cc +2 -2
- data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
- data/src/core/load_balancing/health_check_client.cc +4 -4
- data/src/core/load_balancing/health_check_client_internal.h +2 -2
- data/src/core/load_balancing/lb_policy_registry.cc +2 -2
- data/src/core/load_balancing/oob_backend_metric.cc +4 -4
- data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
- data/src/core/load_balancing/priority/priority.cc +23 -24
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
- data/src/core/load_balancing/rls/rls.cc +13 -13
- data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
- data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
- data/src/core/load_balancing/xds/cds.cc +76 -32
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
- data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
- data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
- data/src/core/resolver/endpoint_addresses.cc +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
- data/src/core/resolver/polling_resolver.cc +3 -3
- data/src/core/resolver/resolver_registry.cc +5 -4
- data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
- data/src/core/resolver/xds/xds_resolver.cc +9 -9
- data/src/core/server/server.cc +38 -38
- data/src/core/server/server_call_tracer_filter.h +4 -4
- data/src/core/server/server_config_selector_filter.cc +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +9 -8
- data/src/core/service_config/service_config_impl.h +2 -2
- data/src/core/telemetry/call_tracer.cc +39 -49
- data/src/core/telemetry/call_tracer.h +199 -22
- data/src/core/telemetry/histogram.h +205 -0
- data/src/core/telemetry/instrument.cc +719 -0
- data/src/core/telemetry/instrument.h +932 -0
- data/src/core/telemetry/metrics.cc +13 -5
- data/src/core/telemetry/metrics.h +3 -1
- data/src/core/telemetry/stats_data.cc +0 -19
- data/src/core/telemetry/stats_data.h +0 -19
- data/src/core/transport/auth_context.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +26 -25
- data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
- data/src/core/util/chunked_vector.h +4 -4
- data/src/core/util/event_log.cc +2 -2
- data/src/core/util/gcp_metadata_query.cc +2 -2
- data/src/core/util/grpc_check.cc +22 -0
- data/src/core/util/grpc_check.h +103 -0
- data/src/core/util/http_client/httpcli.cc +3 -3
- data/src/core/util/http_client/parser.cc +4 -4
- data/src/core/util/latent_see.h +7 -4
- data/src/core/util/lru_cache.h +4 -4
- data/src/core/util/memory_usage.h +16 -0
- data/src/core/util/posix/directory_reader.cc +3 -2
- data/src/core/util/posix/sync.cc +24 -24
- data/src/core/util/postmortem_emit.cc +52 -0
- data/src/core/util/postmortem_emit.h +30 -0
- data/src/core/util/ref_counted_ptr.h +5 -0
- data/src/core/util/trie_lookup.h +170 -0
- data/src/core/util/unique_ptr_with_bitset.h +5 -5
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
- data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
- data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
- data/src/core/xds/grpc/xds_client_grpc.h +4 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
- data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
- data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
- data/src/core/xds/grpc/xds_matcher.cc +277 -0
- data/src/core/xds/grpc/xds_matcher.h +432 -0
- data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
- data/src/core/xds/grpc/xds_matcher_action.h +48 -0
- data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
- data/src/core/xds/grpc/xds_matcher_context.h +46 -0
- data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
- data/src/core/xds/grpc/xds_matcher_input.h +105 -0
- data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
- data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
- data/src/core/xds/grpc/xds_metadata.cc +4 -3
- data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
- data/src/core/xds/grpc/xds_routing.cc +3 -3
- data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
- data/src/core/xds/xds_client/lrs_client.cc +6 -6
- data/src/core/xds/xds_client/xds_client.cc +9 -9
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
- metadata +37 -2
@@ -28,15 +28,18 @@
|
|
28
28
|
#include <set>
|
29
29
|
#include <string>
|
30
30
|
#include <type_traits>
|
31
|
+
#include <vector>
|
31
32
|
|
32
|
-
#include "absl/log/check.h"
|
33
33
|
#include "absl/log/log.h"
|
34
34
|
#include "absl/strings/str_cat.h"
|
35
35
|
#include "absl/strings/str_join.h"
|
36
36
|
#include "absl/strings/string_view.h"
|
37
|
+
#include "src/core/channelz/channelz.h"
|
38
|
+
#include "src/core/channelz/property_list.h"
|
37
39
|
#include "src/core/lib/debug/trace.h"
|
38
40
|
#include "src/core/lib/surface/channel_stack_type.h"
|
39
41
|
#include "src/core/util/crash.h"
|
42
|
+
#include "src/core/util/grpc_check.h"
|
40
43
|
#include "src/core/util/sync.h"
|
41
44
|
#include "src/core/util/unique_type_name.h"
|
42
45
|
|
@@ -69,6 +72,11 @@ struct CompareFusedChannelFiltersByName {
|
|
69
72
|
}
|
70
73
|
};
|
71
74
|
|
75
|
+
struct Node {
|
76
|
+
const grpc_channel_filter* filter;
|
77
|
+
int next;
|
78
|
+
};
|
79
|
+
|
72
80
|
} // namespace
|
73
81
|
|
74
82
|
ChannelInit::FilterRegistration& ChannelInit::FilterRegistration::After(
|
@@ -177,9 +185,8 @@ class ChannelInit::DependencyTracker {
|
|
177
185
|
|
178
186
|
FilterRegistration* Next() {
|
179
187
|
if (ready_dependencies_.empty()) {
|
180
|
-
|
181
|
-
|
182
|
-
<< GraphString();
|
188
|
+
GRPC_CHECK_EQ(nodes_taken_, nodes_.size())
|
189
|
+
<< "Unresolvable graph of channel filters :\n " << GraphString();
|
183
190
|
return nullptr;
|
184
191
|
}
|
185
192
|
auto next = ready_dependencies_.top();
|
@@ -189,13 +196,13 @@ class ChannelInit::DependencyTracker {
|
|
189
196
|
// Constraint: if we use ordering other than default, then we must have an
|
190
197
|
// unambiguous pick. If there is ambiguity, we must fix it by adding
|
191
198
|
// explicit ordering constraints.
|
192
|
-
|
193
|
-
|
199
|
+
GRPC_CHECK_NE(next.node->ordering(),
|
200
|
+
ready_dependencies_.top().node->ordering())
|
194
201
|
<< "Ambiguous ordering between " << next.node->name() << " and "
|
195
202
|
<< ready_dependencies_.top().node->name();
|
196
203
|
}
|
197
204
|
for (Node* dependent : next.node->dependents) {
|
198
|
-
|
205
|
+
GRPC_CHECK_GT(dependent->waiting_dependencies, 0u);
|
199
206
|
--dependent->waiting_dependencies;
|
200
207
|
if (dependent->waiting_dependencies == 0) {
|
201
208
|
ready_dependencies_.emplace(dependent);
|
@@ -220,7 +227,7 @@ class ChannelInit::DependencyTracker {
|
|
220
227
|
|
221
228
|
absl::Span<const UniqueTypeName> DependenciesFor(UniqueTypeName name) const {
|
222
229
|
auto it = nodes_.find(name);
|
223
|
-
|
230
|
+
GRPC_CHECK(it != nodes_.end()) << "Filter " << name.name() << " not found";
|
224
231
|
return it->second.all_dependencies;
|
225
232
|
}
|
226
233
|
|
@@ -274,21 +281,29 @@ std::vector<ChannelInit::FilterNode> ChannelInit::SelectFiltersByPredicate(
|
|
274
281
|
return filter_list;
|
275
282
|
}
|
276
283
|
|
277
|
-
void ChannelInit::
|
278
|
-
|
284
|
+
void ChannelInit::MergeFusedFilters(ChannelStackBuilder* builder,
|
285
|
+
const std::vector<Filter>& fused_filters) {
|
279
286
|
int i = 0;
|
280
287
|
int j = 0;
|
288
|
+
auto& stack = *builder->mutable_stack();
|
289
|
+
std::vector<Node> filter_list;
|
290
|
+
for (const auto filter : stack) {
|
291
|
+
filter_list.push_back({filter, ++i});
|
292
|
+
}
|
293
|
+
filter_list.back().next = -1;
|
281
294
|
// Iterate through fused filters (by size) and check if a given fused filter
|
282
295
|
// can replace one of the existing sequence of filters.
|
283
296
|
for (auto& curr_fused_filter : fused_filters) {
|
284
297
|
i = 0;
|
285
298
|
while (i != -1 && filter_list[i].next != -1) {
|
286
|
-
std::string fused_prefix(
|
299
|
+
std::string fused_prefix(
|
300
|
+
NameFromChannelFilter(filter_list[i].filter).name());
|
287
301
|
j = filter_list[i].next;
|
288
302
|
do {
|
289
|
-
absl::StrAppend(&fused_prefix, "+",
|
303
|
+
absl::StrAppend(&fused_prefix, "+",
|
304
|
+
NameFromChannelFilter(filter_list[j].filter).name());
|
290
305
|
if (fused_prefix == curr_fused_filter.name.name()) {
|
291
|
-
filter_list[i].
|
306
|
+
filter_list[i].filter = curr_fused_filter.filter;
|
292
307
|
filter_list[i].next = filter_list[j].next;
|
293
308
|
}
|
294
309
|
j = filter_list[j].next;
|
@@ -296,6 +311,13 @@ void ChannelInit::MergeFilters(std::vector<FilterNode>& filter_list,
|
|
296
311
|
i = filter_list[i].next;
|
297
312
|
}
|
298
313
|
}
|
314
|
+
// Replace the stack with the new filter list.
|
315
|
+
stack.clear();
|
316
|
+
i = 0;
|
317
|
+
while (i != -1 && !filter_list.empty()) {
|
318
|
+
builder->AppendFilter(filter_list[i].filter);
|
319
|
+
i = filter_list[i].next;
|
320
|
+
};
|
299
321
|
}
|
300
322
|
|
301
323
|
void ChannelInit::AppendFiltersToBuilder(
|
@@ -311,7 +333,7 @@ std::tuple<std::vector<ChannelInit::Filter>, std::vector<ChannelInit::Filter>>
|
|
311
333
|
ChannelInit::SortFilterRegistrationsByDependencies(
|
312
334
|
const std::vector<std::unique_ptr<ChannelInit::FilterRegistration>>&
|
313
335
|
filter_registrations,
|
314
|
-
grpc_channel_stack_type type) {
|
336
|
+
grpc_channel_stack_type type, channelz::PropertyTable& filter_ordering) {
|
315
337
|
// Phase 1: Build a map from filter to the set of filters that must be
|
316
338
|
// initialized before it.
|
317
339
|
// We order this map (and the set of dependent filters) by filter name to
|
@@ -322,10 +344,10 @@ ChannelInit::SortFilterRegistrationsByDependencies(
|
|
322
344
|
std::vector<Filter> terminal_filters;
|
323
345
|
for (const auto& registration : filter_registrations) {
|
324
346
|
if (registration->terminal_) {
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
347
|
+
GRPC_CHECK(registration->after_.empty());
|
348
|
+
GRPC_CHECK(registration->before_.empty());
|
349
|
+
GRPC_CHECK(!registration->before_all_);
|
350
|
+
GRPC_CHECK_EQ(registration->ordering_, Ordering::kDefault);
|
329
351
|
terminal_filters.emplace_back(
|
330
352
|
registration->name_, registration->filter_, nullptr,
|
331
353
|
std::move(registration->predicates_), registration->version_,
|
@@ -362,6 +384,19 @@ ChannelInit::SortFilterRegistrationsByDependencies(
|
|
362
384
|
std::move(registration->predicates_), registration->version_,
|
363
385
|
registration->ordering_, registration->registration_source_);
|
364
386
|
}
|
387
|
+
|
388
|
+
for (const auto& filter : filters) {
|
389
|
+
auto after = dependencies.DependenciesFor(filter.name);
|
390
|
+
std::string ordering_str;
|
391
|
+
if (!after.empty()) {
|
392
|
+
ordering_str = absl::StrCat("after ", absl::StrJoin(after, ", "));
|
393
|
+
}
|
394
|
+
absl::StrAppend(&ordering_str, " [", filter.ordering, "/", filter.version,
|
395
|
+
"]");
|
396
|
+
filter_ordering.AppendRow(channelz::PropertyList()
|
397
|
+
.Set("name", filter.name.name())
|
398
|
+
.Set("ordering", ordering_str));
|
399
|
+
}
|
365
400
|
// Log out the graph we built if that's been requested.
|
366
401
|
if (GRPC_TRACE_FLAG_ENABLED(channel_stack)) {
|
367
402
|
PrintChannelStackTrace(type, filter_registrations, dependencies, filters,
|
@@ -376,7 +411,7 @@ std::vector<ChannelInit::Filter> ChannelInit::SortFusedFilterRegistrations(
|
|
376
411
|
std::vector<FilterRegistration*> fused_filter_registrations;
|
377
412
|
std::vector<Filter> filters;
|
378
413
|
for (const auto& registration : filter_registrations) {
|
379
|
-
|
414
|
+
GRPC_CHECK(!registration->terminal_);
|
380
415
|
fused_filter_registrations.push_back(registration.get());
|
381
416
|
}
|
382
417
|
std::sort(fused_filter_registrations.begin(),
|
@@ -406,9 +441,10 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
|
|
406
441
|
if (post_processors[i] == nullptr) continue;
|
407
442
|
post_processor_functions.emplace_back(std::move(post_processors[i]));
|
408
443
|
}
|
444
|
+
channelz::PropertyTable filter_ordering;
|
409
445
|
|
410
|
-
auto sorted_filters =
|
411
|
-
|
446
|
+
auto sorted_filters = SortFilterRegistrationsByDependencies(
|
447
|
+
filter_registrations, type, filter_ordering);
|
412
448
|
std::vector<Filter> filters = std::move(std::get<0>(sorted_filters));
|
413
449
|
std::vector<Filter> terminal_filters = std::move(std::get<1>(sorted_filters));
|
414
450
|
|
@@ -432,7 +468,7 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
|
|
432
468
|
}
|
433
469
|
return StackConfig{std::move(filters), std::move(fused_filters),
|
434
470
|
std::move(terminal_filters),
|
435
|
-
std::move(post_processor_functions)};
|
471
|
+
std::move(post_processor_functions), filter_ordering};
|
436
472
|
};
|
437
473
|
|
438
474
|
void ChannelInit::PrintChannelStackTrace(
|
@@ -574,13 +610,17 @@ bool ChannelInit::CreateStack(ChannelStackBuilder* builder) const {
|
|
574
610
|
return false;
|
575
611
|
}
|
576
612
|
|
577
|
-
MergeFilters(filter_list, stack_config.fused_filters);
|
578
613
|
AppendFiltersToBuilder(filter_list, builder);
|
579
614
|
AppendFiltersToBuilder(terminal_filter_list, builder);
|
580
615
|
|
581
616
|
for (const auto& post_processor : stack_config.post_processors) {
|
582
617
|
post_processor(*builder);
|
583
618
|
}
|
619
|
+
|
620
|
+
// Only perform the merge with fused filters operation after running
|
621
|
+
// through all the post processors. This ensures that modifications made by
|
622
|
+
// post processors are taken into account before finding fusions to match.
|
623
|
+
MergeFusedFilters(builder, stack_config.fused_filters);
|
584
624
|
return true;
|
585
625
|
}
|
586
626
|
|
@@ -600,4 +640,21 @@ void ChannelInit::AddToInterceptionChainBuilder(
|
|
600
640
|
}
|
601
641
|
}
|
602
642
|
|
643
|
+
void ChannelInit::AddData(channelz::DataSink sink,
|
644
|
+
grpc_channel_stack_type type) const {
|
645
|
+
const auto& stack_config = stack_configs_[type];
|
646
|
+
sink.AddData(
|
647
|
+
"channel_stack_filters",
|
648
|
+
channelz::PropertyList().Set("elements", stack_config.filter_ordering));
|
649
|
+
sink.AddData("fused_filters",
|
650
|
+
channelz::PropertyList().Set("elements", [&stack_config]() {
|
651
|
+
channelz::PropertyTable elements;
|
652
|
+
for (const auto& filter : stack_config.fused_filters) {
|
653
|
+
elements.AppendRow(channelz::PropertyList().Set(
|
654
|
+
"name", filter.name.name()));
|
655
|
+
}
|
656
|
+
return elements;
|
657
|
+
}()));
|
658
|
+
}
|
659
|
+
|
603
660
|
} // namespace grpc_core
|
@@ -29,14 +29,16 @@
|
|
29
29
|
#include <vector>
|
30
30
|
|
31
31
|
#include "absl/functional/any_invocable.h"
|
32
|
-
#include "absl/log/check.h"
|
33
32
|
#include "src/core/call/call_filters.h"
|
34
33
|
#include "src/core/call/interception_chain.h"
|
34
|
+
#include "src/core/channelz/channelz.h"
|
35
|
+
#include "src/core/channelz/property_list.h"
|
35
36
|
#include "src/core/lib/channel/channel_args.h"
|
36
37
|
#include "src/core/lib/channel/channel_fwd.h"
|
37
38
|
#include "src/core/lib/channel/channel_stack_builder.h"
|
38
39
|
#include "src/core/lib/surface/channel_stack_type.h"
|
39
40
|
#include "src/core/util/debug_location.h"
|
41
|
+
#include "src/core/util/grpc_check.h"
|
40
42
|
#include "src/core/util/unique_type_name.h"
|
41
43
|
|
42
44
|
/// This module provides a way for plugins (and the grpc core library itself)
|
@@ -246,26 +248,36 @@ class ChannelInit {
|
|
246
248
|
// stack.
|
247
249
|
FilterRegistration& ExcludeFromMinimalStack();
|
248
250
|
FilterRegistration& SkipV3() {
|
249
|
-
|
251
|
+
GRPC_CHECK_EQ(version_, Version::kAny);
|
250
252
|
version_ = Version::kV2;
|
251
253
|
return *this;
|
252
254
|
}
|
253
255
|
FilterRegistration& SkipV2() {
|
254
|
-
|
256
|
+
GRPC_CHECK_EQ(version_, Version::kAny);
|
255
257
|
version_ = Version::kV3;
|
256
258
|
return *this;
|
257
259
|
}
|
258
260
|
// Request this filter be placed as high as possible in the stack (given
|
259
261
|
// before/after constraints).
|
260
262
|
FilterRegistration& FloatToTop() {
|
261
|
-
|
263
|
+
GRPC_CHECK_EQ(ordering_, Ordering::kDefault);
|
264
|
+
ordering_ = Ordering::kTop;
|
265
|
+
return *this;
|
266
|
+
}
|
267
|
+
// Request this filter be placed as high as possible in the stack (given
|
268
|
+
// before/after constraints).
|
269
|
+
FilterRegistration& FloatToTopIf(bool predicate) {
|
270
|
+
if (!predicate) {
|
271
|
+
return *this;
|
272
|
+
}
|
273
|
+
GRPC_CHECK_EQ(ordering_, Ordering::kDefault);
|
262
274
|
ordering_ = Ordering::kTop;
|
263
275
|
return *this;
|
264
276
|
}
|
265
277
|
// Request this filter be placed as low as possible in the stack (given
|
266
278
|
// before/after constraints).
|
267
279
|
FilterRegistration& SinkToBottom() {
|
268
|
-
|
280
|
+
GRPC_CHECK_EQ(ordering_, Ordering::kDefault);
|
269
281
|
ordering_ = Ordering::kBottom;
|
270
282
|
return *this;
|
271
283
|
}
|
@@ -303,7 +315,7 @@ class ChannelInit {
|
|
303
315
|
FilterRegistration& RegisterFilter(
|
304
316
|
grpc_channel_stack_type type, const grpc_channel_filter* filter,
|
305
317
|
SourceLocation registration_source = {}) {
|
306
|
-
|
318
|
+
GRPC_CHECK(filter != nullptr);
|
307
319
|
return RegisterFilter(type, NameFromChannelFilter(filter), filter,
|
308
320
|
nullptr, registration_source);
|
309
321
|
}
|
@@ -338,7 +350,7 @@ class ChannelInit {
|
|
338
350
|
void RegisterFusedFilter(grpc_channel_stack_type type,
|
339
351
|
const grpc_channel_filter* filter,
|
340
352
|
SourceLocation registration_source = {}) {
|
341
|
-
|
353
|
+
GRPC_CHECK(filter != nullptr);
|
342
354
|
RegisterFusedFilter(type, NameFromChannelFilter(filter), filter, nullptr,
|
343
355
|
registration_source);
|
344
356
|
}
|
@@ -361,7 +373,7 @@ class ChannelInit {
|
|
361
373
|
PostProcessorSlot slot,
|
362
374
|
PostProcessor post_processor) {
|
363
375
|
auto& slot_value = post_processors_[type][static_cast<int>(slot)];
|
364
|
-
|
376
|
+
GRPC_CHECK(slot_value == nullptr);
|
365
377
|
slot_value = std::move(post_processor);
|
366
378
|
}
|
367
379
|
|
@@ -385,6 +397,8 @@ class ChannelInit {
|
|
385
397
|
void AddToInterceptionChainBuilder(grpc_channel_stack_type type,
|
386
398
|
InterceptionChainBuilder& builder) const;
|
387
399
|
|
400
|
+
void AddData(channelz::DataSink sink, grpc_channel_stack_type type) const;
|
401
|
+
|
388
402
|
private:
|
389
403
|
// The type of object returned by a filter's Create method.
|
390
404
|
template <typename T>
|
@@ -425,6 +439,7 @@ class ChannelInit {
|
|
425
439
|
std::vector<Filter> fused_filters;
|
426
440
|
std::vector<Filter> terminators;
|
427
441
|
std::vector<PostProcessor> post_processors;
|
442
|
+
channelz::PropertyTable filter_ordering;
|
428
443
|
};
|
429
444
|
|
430
445
|
StackConfig stack_configs_[GRPC_NUM_CHANNEL_STACK_TYPES];
|
@@ -433,7 +448,7 @@ class ChannelInit {
|
|
433
448
|
SortFilterRegistrationsByDependencies(
|
434
449
|
const std::vector<std::unique_ptr<FilterRegistration>>&
|
435
450
|
filter_registrations,
|
436
|
-
grpc_channel_stack_type type);
|
451
|
+
grpc_channel_stack_type type, channelz::PropertyTable& filter_ordering);
|
437
452
|
|
438
453
|
static std::vector<Filter> SortFusedFilterRegistrations(
|
439
454
|
const std::vector<std::unique_ptr<FilterRegistration>>&
|
@@ -443,8 +458,8 @@ class ChannelInit {
|
|
443
458
|
static std::vector<FilterNode> SelectFiltersByPredicate(
|
444
459
|
const std::vector<Filter>& filters, ChannelStackBuilder* builder);
|
445
460
|
|
446
|
-
static void
|
447
|
-
|
461
|
+
static void MergeFusedFilters(ChannelStackBuilder* builder,
|
462
|
+
const std::vector<Filter>& fused_filters);
|
448
463
|
|
449
464
|
static void AppendFiltersToBuilder(const std::vector<FilterNode>& filter_list,
|
450
465
|
ChannelStackBuilder* builder);
|
@@ -32,7 +32,6 @@
|
|
32
32
|
#include <utility>
|
33
33
|
#include <vector>
|
34
34
|
|
35
|
-
#include "absl/log/check.h"
|
36
35
|
#include "absl/log/log.h"
|
37
36
|
#include "absl/status/status.h"
|
38
37
|
#include "absl/strings/str_format.h"
|
@@ -46,6 +45,7 @@
|
|
46
45
|
#include "src/core/telemetry/stats_data.h"
|
47
46
|
#include "src/core/util/atomic_utils.h"
|
48
47
|
#include "src/core/util/debug_location.h"
|
48
|
+
#include "src/core/util/grpc_check.h"
|
49
49
|
#include "src/core/util/ref_counted.h"
|
50
50
|
#include "src/core/util/spinlock.h"
|
51
51
|
#include "src/core/util/status_helper.h"
|
@@ -166,7 +166,7 @@ grpc_error_handle non_polling_poller_kick(
|
|
166
166
|
|
167
167
|
void non_polling_poller_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
|
168
168
|
non_polling_poller* p = reinterpret_cast<non_polling_poller*>(pollset);
|
169
|
-
|
169
|
+
GRPC_CHECK_NE(closure, nullptr);
|
170
170
|
p->shutdown = closure;
|
171
171
|
if (p->root == nullptr) {
|
172
172
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, absl::OkStatus());
|
@@ -311,7 +311,7 @@ class CqEventQueue {
|
|
311
311
|
|
312
312
|
struct cq_next_data {
|
313
313
|
~cq_next_data() {
|
314
|
-
|
314
|
+
GRPC_CHECK_EQ(queue.num_items(), 0);
|
315
315
|
#ifndef NDEBUG
|
316
316
|
if (pending_events.load(std::memory_order_acquire) != 0) {
|
317
317
|
LOG(ERROR) << "Destroying CQ without draining it fully.";
|
@@ -341,7 +341,8 @@ struct cq_pluck_data {
|
|
341
341
|
}
|
342
342
|
|
343
343
|
~cq_pluck_data() {
|
344
|
-
|
344
|
+
GRPC_CHECK(completed_head.next ==
|
345
|
+
reinterpret_cast<uintptr_t>(&completed_head));
|
345
346
|
#ifndef NDEBUG
|
346
347
|
if (pending_events.load(std::memory_order_acquire) != 0) {
|
347
348
|
LOG(ERROR) << "Destroying CQ without draining it fully.";
|
@@ -710,7 +711,7 @@ static void cq_check_tag(grpc_completion_queue* cq, void* tag, bool lock_cq) {
|
|
710
711
|
gpr_mu_unlock(cq->mu);
|
711
712
|
}
|
712
713
|
|
713
|
-
|
714
|
+
GRPC_CHECK(found);
|
714
715
|
}
|
715
716
|
#else
|
716
717
|
static void cq_check_tag(grpc_completion_queue* /*cq*/, void* /*tag*/,
|
@@ -940,7 +941,7 @@ class ExecCtxNext : public grpc_core::ExecCtx {
|
|
940
941
|
static_cast<cq_is_finished_arg*>(check_ready_to_finish_arg_);
|
941
942
|
grpc_completion_queue* cq = a->cq;
|
942
943
|
cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
|
943
|
-
|
944
|
+
GRPC_CHECK_EQ(a->stolen_completion, nullptr);
|
944
945
|
|
945
946
|
intptr_t current_last_seen_things_queued_ever =
|
946
947
|
cqd->things_queued_ever.load(std::memory_order_relaxed);
|
@@ -994,7 +995,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
|
|
994
995
|
<< ", tv_nsec: " << deadline.tv_nsec
|
995
996
|
<< ", clock_type: " << (int)deadline.clock_type
|
996
997
|
<< " }, reserved=" << reserved << ")";
|
997
|
-
|
998
|
+
GRPC_CHECK(!reserved);
|
998
999
|
|
999
1000
|
dump_pending_tags(cq);
|
1000
1001
|
|
@@ -1100,7 +1101,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
|
|
1100
1101
|
GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, &ret);
|
1101
1102
|
GRPC_CQ_INTERNAL_UNREF(cq, "next");
|
1102
1103
|
|
1103
|
-
|
1104
|
+
GRPC_CHECK_EQ(is_finished_arg.stolen_completion, nullptr);
|
1104
1105
|
|
1105
1106
|
return ret;
|
1106
1107
|
}
|
@@ -1114,8 +1115,8 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
|
|
1114
1115
|
static void cq_finish_shutdown_next(grpc_completion_queue* cq) {
|
1115
1116
|
cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
|
1116
1117
|
|
1117
|
-
|
1118
|
-
|
1118
|
+
GRPC_CHECK(cqd->shutdown_called);
|
1119
|
+
GRPC_CHECK_EQ(cqd->pending_events.load(std::memory_order_relaxed), 0);
|
1119
1120
|
|
1120
1121
|
cq->poller_vtable->shutdown(POLLSET_FROM_CQ(cq), &cq->pollset_shutdown_done);
|
1121
1122
|
}
|
@@ -1188,7 +1189,7 @@ class ExecCtxPluck : public grpc_core::ExecCtx {
|
|
1188
1189
|
grpc_completion_queue* cq = a->cq;
|
1189
1190
|
cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
|
1190
1191
|
|
1191
|
-
|
1192
|
+
GRPC_CHECK_EQ(a->stolen_completion, nullptr);
|
1192
1193
|
gpr_atm current_last_seen_things_queued_ever =
|
1193
1194
|
cqd->things_queued_ever.load(std::memory_order_relaxed);
|
1194
1195
|
if (current_last_seen_things_queued_ever !=
|
@@ -1236,7 +1237,7 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag,
|
|
1236
1237
|
<< ", clock_type: " << (int)deadline.clock_type
|
1237
1238
|
<< " }, reserved=" << reserved << ")";
|
1238
1239
|
}
|
1239
|
-
|
1240
|
+
GRPC_CHECK(!reserved);
|
1240
1241
|
|
1241
1242
|
dump_pending_tags(cq);
|
1242
1243
|
|
@@ -1326,7 +1327,7 @@ done:
|
|
1326
1327
|
GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, &ret);
|
1327
1328
|
GRPC_CQ_INTERNAL_UNREF(cq, "pluck");
|
1328
1329
|
|
1329
|
-
|
1330
|
+
GRPC_CHECK_EQ(is_finished_arg.stolen_completion, nullptr);
|
1330
1331
|
|
1331
1332
|
return ret;
|
1332
1333
|
}
|
@@ -1339,8 +1340,8 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
|
|
1339
1340
|
static void cq_finish_shutdown_pluck(grpc_completion_queue* cq) {
|
1340
1341
|
cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
|
1341
1342
|
|
1342
|
-
|
1343
|
-
|
1343
|
+
GRPC_CHECK(cqd->shutdown_called);
|
1344
|
+
GRPC_CHECK(!cqd->shutdown.load(std::memory_order_relaxed));
|
1344
1345
|
cqd->shutdown.store(true, std::memory_order_relaxed);
|
1345
1346
|
|
1346
1347
|
cq->poller_vtable->shutdown(POLLSET_FROM_CQ(cq), &cq->pollset_shutdown_done);
|
@@ -1376,7 +1377,7 @@ static void cq_finish_shutdown_callback(grpc_completion_queue* cq) {
|
|
1376
1377
|
cq_callback_data* cqd = static_cast<cq_callback_data*> DATA_FROM_CQ(cq);
|
1377
1378
|
auto* callback = cqd->shutdown_callback;
|
1378
1379
|
|
1379
|
-
|
1380
|
+
GRPC_CHECK(cqd->shutdown_called);
|
1380
1381
|
|
1381
1382
|
cq->poller_vtable->shutdown(POLLSET_FROM_CQ(cq), &cq->pollset_shutdown_done);
|
1382
1383
|
|
@@ -21,9 +21,9 @@
|
|
21
21
|
#include <grpc/grpc.h>
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
-
#include "absl/log/check.h"
|
25
24
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
26
25
|
#include "src/core/lib/surface/completion_queue.h"
|
26
|
+
#include "src/core/util/grpc_check.h"
|
27
27
|
|
28
28
|
//
|
29
29
|
// == Default completion queue factory implementation ==
|
@@ -47,8 +47,8 @@ static const grpc_completion_queue_factory g_default_cq_factory = {
|
|
47
47
|
|
48
48
|
const grpc_completion_queue_factory* grpc_completion_queue_factory_lookup(
|
49
49
|
const grpc_completion_queue_attributes* attributes) {
|
50
|
-
|
51
|
-
|
50
|
+
GRPC_CHECK(attributes->version >= 1 &&
|
51
|
+
attributes->version <= GRPC_CQ_CURRENT_VERSION);
|
52
52
|
|
53
53
|
// The default factory can handle version 1 of the attributes structure. We
|
54
54
|
// may have to change this as more fields are added to the structure
|
@@ -61,7 +61,7 @@ const grpc_completion_queue_factory* grpc_completion_queue_factory_lookup(
|
|
61
61
|
|
62
62
|
grpc_completion_queue* grpc_completion_queue_create_for_next(void* reserved) {
|
63
63
|
grpc_core::ExecCtx exec_ctx;
|
64
|
-
|
64
|
+
GRPC_CHECK(!reserved);
|
65
65
|
grpc_completion_queue_attributes attr = {1, GRPC_CQ_NEXT,
|
66
66
|
GRPC_CQ_DEFAULT_POLLING, nullptr};
|
67
67
|
return g_default_cq_factory.vtable->create(&g_default_cq_factory, &attr);
|
@@ -69,7 +69,7 @@ grpc_completion_queue* grpc_completion_queue_create_for_next(void* reserved) {
|
|
69
69
|
|
70
70
|
grpc_completion_queue* grpc_completion_queue_create_for_pluck(void* reserved) {
|
71
71
|
grpc_core::ExecCtx exec_ctx;
|
72
|
-
|
72
|
+
GRPC_CHECK(!reserved);
|
73
73
|
grpc_completion_queue_attributes attr = {1, GRPC_CQ_PLUCK,
|
74
74
|
GRPC_CQ_DEFAULT_POLLING, nullptr};
|
75
75
|
return g_default_cq_factory.vtable->create(&g_default_cq_factory, &attr);
|
@@ -78,7 +78,7 @@ grpc_completion_queue* grpc_completion_queue_create_for_pluck(void* reserved) {
|
|
78
78
|
grpc_completion_queue* grpc_completion_queue_create_for_callback(
|
79
79
|
grpc_completion_queue_functor* shutdown_callback, void* reserved) {
|
80
80
|
grpc_core::ExecCtx exec_ctx;
|
81
|
-
|
81
|
+
GRPC_CHECK(!reserved);
|
82
82
|
grpc_completion_queue_attributes attr = {
|
83
83
|
2, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING, shutdown_callback};
|
84
84
|
return g_default_cq_factory.vtable->create(&g_default_cq_factory, &attr);
|
@@ -88,6 +88,6 @@ grpc_completion_queue* grpc_completion_queue_create(
|
|
88
88
|
const grpc_completion_queue_factory* factory,
|
89
89
|
const grpc_completion_queue_attributes* attr, void* reserved) {
|
90
90
|
grpc_core::ExecCtx exec_ctx;
|
91
|
-
|
91
|
+
GRPC_CHECK(!reserved);
|
92
92
|
return factory->vtable->create(factory, attr);
|
93
93
|
}
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#include <stddef.h>
|
24
24
|
|
25
25
|
#include <cstdint>
|
26
|
+
#include <type_traits>
|
26
27
|
#include <vector>
|
27
28
|
|
28
29
|
#include "src/core/util/no_destruct.h"
|
@@ -74,6 +75,31 @@ class BaseConnectionContextPropertiesTraits {
|
|
74
75
|
}
|
75
76
|
};
|
76
77
|
|
78
|
+
template <class T, typename Ignored = void>
|
79
|
+
struct HasRef {
|
80
|
+
static constexpr bool value = false;
|
81
|
+
};
|
82
|
+
|
83
|
+
template <class T>
|
84
|
+
struct HasRef<T, std::enable_if_t<std::is_same<
|
85
|
+
const T*, decltype(std::declval<T>().Ref())>::value>> {
|
86
|
+
static constexpr bool value = true;
|
87
|
+
};
|
88
|
+
|
89
|
+
template <class T, typename Ignored = void>
|
90
|
+
struct HasUnref {
|
91
|
+
static constexpr bool value = false;
|
92
|
+
};
|
93
|
+
|
94
|
+
template <class T>
|
95
|
+
struct HasUnref<T, std::enable_if_t<std::is_same<
|
96
|
+
void, decltype(std::declval<T>().Unref())>::value>> {
|
97
|
+
static constexpr bool value = true;
|
98
|
+
};
|
99
|
+
|
100
|
+
template <class T>
|
101
|
+
constexpr bool IsRefCounted = HasRef<T>::value && HasUnref<T>::value;
|
102
|
+
|
77
103
|
template <typename T>
|
78
104
|
class ConnectionContextPropertiesTraits
|
79
105
|
: public BaseConnectionContextPropertiesTraits {
|
@@ -83,7 +109,13 @@ class ConnectionContextPropertiesTraits
|
|
83
109
|
static T* Construct(Args&&... args) {
|
84
110
|
return new T(std::forward<Args>(args)...);
|
85
111
|
}
|
86
|
-
static void Destruct(void* p) {
|
112
|
+
static void Destruct(void* p) {
|
113
|
+
if constexpr (IsRefCounted<T>) {
|
114
|
+
reinterpret_cast<T*>(p)->Unref();
|
115
|
+
} else {
|
116
|
+
delete reinterpret_cast<T*>(p);
|
117
|
+
}
|
118
|
+
}
|
87
119
|
|
88
120
|
protected:
|
89
121
|
static const uint16_t id_;
|
@@ -132,13 +164,24 @@ class ConnectionContext final : public Orphanable {
|
|
132
164
|
// Returns the value of a registered property. If the property is not set,
|
133
165
|
// returns nullptr.
|
134
166
|
template <typename Which>
|
135
|
-
|
167
|
+
Which* Get() {
|
136
168
|
return static_cast<Which*>(
|
137
169
|
registered_properties()
|
138
170
|
[connection_context_detail::ConnectionContextPropertiesTraits<
|
139
171
|
Which>::id()]);
|
140
172
|
}
|
141
173
|
|
174
|
+
// Takes ownership of the value which is set.
|
175
|
+
template <typename Which>
|
176
|
+
void Set(Which* value) {
|
177
|
+
if constexpr (connection_context_detail::IsRefCounted<Which>) {
|
178
|
+
value->Ref();
|
179
|
+
}
|
180
|
+
registered_properties()
|
181
|
+
[connection_context_detail::ConnectionContextPropertiesTraits<
|
182
|
+
Which>::id()] = value;
|
183
|
+
}
|
184
|
+
|
142
185
|
void Orphan() override;
|
143
186
|
|
144
187
|
~ConnectionContext() override;
|