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
@@ -0,0 +1,105 @@
|
|
1
|
+
// Copyright 2025 gRPC authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_INPUT_H
|
16
|
+
#define GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_INPUT_H
|
17
|
+
|
18
|
+
#include "absl/strings/str_cat.h"
|
19
|
+
#include "src/core/xds/grpc/xds_common_types.h"
|
20
|
+
#include "src/core/xds/grpc/xds_matcher.h"
|
21
|
+
#include "src/core/xds/grpc/xds_matcher_context.h"
|
22
|
+
#include "src/core/xds/xds_client/xds_resource_type.h"
|
23
|
+
|
24
|
+
namespace grpc_core {
|
25
|
+
|
26
|
+
template <typename T>
|
27
|
+
class XdsMatcherInputFactory final {
|
28
|
+
public:
|
29
|
+
virtual absl::string_view type() const = delete;
|
30
|
+
virtual UniqueTypeName context_type() const = delete;
|
31
|
+
virtual std::unique_ptr<XdsMatcher::InputValue<T>> ParseAndCreateInput(
|
32
|
+
const XdsResourceType::DecodeContext& context,
|
33
|
+
absl::string_view serialized_value,
|
34
|
+
ValidationErrors* errors) const = delete;
|
35
|
+
virtual ~XdsMatcherInputFactory() = default;
|
36
|
+
};
|
37
|
+
|
38
|
+
template <>
|
39
|
+
class XdsMatcherInputFactory<absl::string_view> {
|
40
|
+
public:
|
41
|
+
virtual absl::string_view type() const = 0;
|
42
|
+
virtual UniqueTypeName context_type() const = 0;
|
43
|
+
virtual std::unique_ptr<XdsMatcher::InputValue<absl::string_view>>
|
44
|
+
ParseAndCreateInput(const XdsResourceType::DecodeContext& context,
|
45
|
+
absl::string_view serialized_value,
|
46
|
+
ValidationErrors* errors) const = 0;
|
47
|
+
virtual ~XdsMatcherInputFactory() = default;
|
48
|
+
};
|
49
|
+
|
50
|
+
template <typename T = absl::string_view>
|
51
|
+
class XdsMatcherInputRegistry {
|
52
|
+
public:
|
53
|
+
XdsMatcherInputRegistry();
|
54
|
+
std::unique_ptr<XdsMatcher::InputValue<T>> ParseAndCreateInput(
|
55
|
+
const XdsResourceType::DecodeContext& context, const XdsExtension& input,
|
56
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) const;
|
57
|
+
|
58
|
+
private:
|
59
|
+
using FactoryMap =
|
60
|
+
std::map<absl::string_view, std::unique_ptr<XdsMatcherInputFactory<T>>>;
|
61
|
+
|
62
|
+
FactoryMap factories_;
|
63
|
+
};
|
64
|
+
|
65
|
+
class MetadataInput : public XdsMatcher::InputValue<absl::string_view> {
|
66
|
+
public:
|
67
|
+
explicit MetadataInput(absl::string_view key) : key_(key) {}
|
68
|
+
std::optional<absl::string_view> GetValue(
|
69
|
+
const XdsMatcher::MatchContext& context) const override;
|
70
|
+
static UniqueTypeName Type() {
|
71
|
+
return GRPC_UNIQUE_TYPE_NAME_HERE("MetadataInput");
|
72
|
+
}
|
73
|
+
UniqueTypeName type() const override { return Type(); }
|
74
|
+
bool Equals(
|
75
|
+
const XdsMatcher::InputValue<absl::string_view>& other) const override {
|
76
|
+
if (type() != other.type()) return false;
|
77
|
+
const auto& o = DownCast<const MetadataInput&>(other);
|
78
|
+
return key_ == o.key_;
|
79
|
+
}
|
80
|
+
std::string ToString() const override {
|
81
|
+
return absl::StrCat("MetadataInput(key=", key_, ")");
|
82
|
+
}
|
83
|
+
|
84
|
+
private:
|
85
|
+
std::string key_;
|
86
|
+
};
|
87
|
+
|
88
|
+
class MetadataInputFactory : public XdsMatcherInputFactory<absl::string_view> {
|
89
|
+
public:
|
90
|
+
absl::string_view type() const override { return Type(); }
|
91
|
+
static absl::string_view Type() {
|
92
|
+
return "envoy.type.matcher.v3.HttpRequestHeaderMatchInput";
|
93
|
+
}
|
94
|
+
UniqueTypeName context_type() const override {
|
95
|
+
return RpcMatchContext::Type();
|
96
|
+
}
|
97
|
+
std::unique_ptr<XdsMatcher::InputValue<absl::string_view>>
|
98
|
+
ParseAndCreateInput(const XdsResourceType::DecodeContext& context,
|
99
|
+
absl::string_view serialized_value,
|
100
|
+
ValidationErrors* errors) const override;
|
101
|
+
};
|
102
|
+
|
103
|
+
} // namespace grpc_core
|
104
|
+
|
105
|
+
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_INPUT_H
|
@@ -0,0 +1,356 @@
|
|
1
|
+
// Copyright 2025 gRPC authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#include "src/core/xds/grpc/xds_matcher_parse.h"
|
16
|
+
|
17
|
+
#include <memory>
|
18
|
+
#include <optional>
|
19
|
+
|
20
|
+
#include "src/core/util/upb_utils.h"
|
21
|
+
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
|
22
|
+
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
23
|
+
#include "src/core/xds/grpc/xds_matcher.h"
|
24
|
+
#include "src/core/xds/grpc/xds_matcher_action.h"
|
25
|
+
#include "src/core/xds/grpc/xds_matcher_input.h"
|
26
|
+
#include "src/core/xds/xds_client/xds_client.h"
|
27
|
+
#include "xds/core/v3/extension.upb.h"
|
28
|
+
#include "xds/type/matcher/v3/matcher.upb.h"
|
29
|
+
#include "xds/type/matcher/v3/string.upb.h"
|
30
|
+
|
31
|
+
namespace grpc_core {
|
32
|
+
namespace {
|
33
|
+
|
34
|
+
// Forward declarations
|
35
|
+
std::unique_ptr<XdsMatcherList::Predicate> ParsePredicate(
|
36
|
+
const XdsResourceType::DecodeContext& context,
|
37
|
+
const xds_type_matcher_v3_Matcher_MatcherList_Predicate* predicate,
|
38
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors);
|
39
|
+
|
40
|
+
// Function to parse "xds_core_v3_TypedExtensionConfig" to generate
|
41
|
+
// XdsMatcher::Input<T>
|
42
|
+
// The parsing is for input which return absl::string_view
|
43
|
+
std::unique_ptr<XdsMatcher::InputValue<absl::string_view>> ParseStringInput(
|
44
|
+
const XdsResourceType::DecodeContext& context,
|
45
|
+
const xds_core_v3_TypedExtensionConfig* input,
|
46
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
47
|
+
if (input == nullptr) {
|
48
|
+
errors->AddError("field not present");
|
49
|
+
return nullptr;
|
50
|
+
}
|
51
|
+
const google_protobuf_Any* any =
|
52
|
+
xds_core_v3_TypedExtensionConfig_typed_config(input);
|
53
|
+
auto extension = ExtractXdsExtension(context, any, errors);
|
54
|
+
if (!extension.has_value()) {
|
55
|
+
return nullptr;
|
56
|
+
}
|
57
|
+
const auto& registry =
|
58
|
+
DownCast<const GrpcXdsBootstrap&>(context.client->bootstrap())
|
59
|
+
.matcher_string_input_registry();
|
60
|
+
return registry.ParseAndCreateInput(context, *extension, matcher_context,
|
61
|
+
errors);
|
62
|
+
}
|
63
|
+
|
64
|
+
// Function to parse "xds_core_v3_TypedExtensionConfig" to generate
|
65
|
+
// supported Actions
|
66
|
+
std::unique_ptr<XdsMatcher::Action> ParseAction(
|
67
|
+
const XdsResourceType::DecodeContext& context,
|
68
|
+
const xds_core_v3_TypedExtensionConfig* action,
|
69
|
+
const XdsMatcherActionRegistry& action_registry, ValidationErrors* errors) {
|
70
|
+
const google_protobuf_Any* any =
|
71
|
+
xds_core_v3_TypedExtensionConfig_typed_config(action);
|
72
|
+
auto extension = ExtractXdsExtension(context, any, errors);
|
73
|
+
if (!extension.has_value()) {
|
74
|
+
return nullptr;
|
75
|
+
}
|
76
|
+
return action_registry.ParseAndCreateAction(context, *extension, errors);
|
77
|
+
}
|
78
|
+
|
79
|
+
// Parse and generate input matcher with type string_view
|
80
|
+
// Parsing "xds_type_matcher_v3_StringMatcher" to generate StringMatcher
|
81
|
+
std::unique_ptr<XdsMatcherList::InputMatcher<absl::string_view>>
|
82
|
+
ParseStringMatcher(const XdsResourceType::DecodeContext& context,
|
83
|
+
const xds_type_matcher_v3_StringMatcher* string_matcher_upb,
|
84
|
+
ValidationErrors* errors) {
|
85
|
+
if (string_matcher_upb == nullptr) {
|
86
|
+
errors->AddError("field not present");
|
87
|
+
return nullptr;
|
88
|
+
}
|
89
|
+
auto string_matcher = StringMatcherParse(context, string_matcher_upb, errors);
|
90
|
+
return std::make_unique<XdsMatcherList::StringInputMatcher>(
|
91
|
+
std::move(string_matcher));
|
92
|
+
}
|
93
|
+
|
94
|
+
// Parse OnMatch components of the matcher
|
95
|
+
// TODO(bpawan): b/431645556 this should have a max recursion depth
|
96
|
+
XdsMatcher::OnMatch ParseOnMatch(
|
97
|
+
const XdsResourceType::DecodeContext& context,
|
98
|
+
const xds_type_matcher_v3_Matcher_OnMatch* on_match,
|
99
|
+
const XdsMatcherActionRegistry& action_registry,
|
100
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
101
|
+
if (on_match == nullptr) {
|
102
|
+
errors->AddError("field not present");
|
103
|
+
return XdsMatcher::OnMatch(std::unique_ptr<XdsMatcher::Action>(nullptr),
|
104
|
+
false);
|
105
|
+
}
|
106
|
+
// TODO(bpawan): b/431645620 Parse keep matching once we move to latest xds
|
107
|
+
// protos
|
108
|
+
bool keep_matching = false;
|
109
|
+
// Action is a variant which can have Action or a Nested Matcher
|
110
|
+
if (const auto* action_proto =
|
111
|
+
xds_type_matcher_v3_Matcher_OnMatch_action(on_match);
|
112
|
+
action_proto != nullptr) {
|
113
|
+
ValidationErrors::ScopedField field(errors, ".action");
|
114
|
+
auto action = ParseAction(context, action_proto, action_registry, errors);
|
115
|
+
return XdsMatcher::OnMatch(std::move(action), keep_matching);
|
116
|
+
} else if (const auto* matcher_proto =
|
117
|
+
xds_type_matcher_v3_Matcher_OnMatch_matcher(on_match);
|
118
|
+
matcher_proto != nullptr) {
|
119
|
+
ValidationErrors::ScopedField field(errors, ".matcher");
|
120
|
+
auto nested_matcher = ParseXdsMatcher(
|
121
|
+
context, matcher_proto, action_registry, matcher_context, errors);
|
122
|
+
return XdsMatcher::OnMatch(std::move(nested_matcher), keep_matching);
|
123
|
+
} else {
|
124
|
+
errors->AddError("One of action or matcher should be present");
|
125
|
+
return XdsMatcher::OnMatch(std::unique_ptr<XdsMatcher::Action>(nullptr),
|
126
|
+
false);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
// Parse MatchTree Map
|
131
|
+
absl::flat_hash_map<std::string, XdsMatcher::OnMatch> ParseMatchMap(
|
132
|
+
const XdsResourceType::DecodeContext& context,
|
133
|
+
const xds_type_matcher_v3_Matcher_MatcherTree_MatchMap* match_map,
|
134
|
+
const XdsMatcherActionRegistry& action_registry,
|
135
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
136
|
+
absl::flat_hash_map<std::string, XdsMatcher::OnMatch> result;
|
137
|
+
if (xds_type_matcher_v3_Matcher_MatcherTree_MatchMap_map_size(match_map) ==
|
138
|
+
0) {
|
139
|
+
errors->AddError("map is empty");
|
140
|
+
return result;
|
141
|
+
}
|
142
|
+
auto iter = kUpb_Map_Begin;
|
143
|
+
upb_StringView upb_key;
|
144
|
+
const xds_type_matcher_v3_Matcher_OnMatch* value;
|
145
|
+
while (xds_type_matcher_v3_Matcher_MatcherTree_MatchMap_map_next(
|
146
|
+
match_map, &upb_key, &value, &iter)) {
|
147
|
+
ValidationErrors::ScopedField field(errors, ".on_match");
|
148
|
+
auto on_match =
|
149
|
+
ParseOnMatch(context, value, action_registry, matcher_context, errors);
|
150
|
+
result.emplace(UpbStringToStdString(upb_key), std::move(on_match));
|
151
|
+
}
|
152
|
+
return result;
|
153
|
+
}
|
154
|
+
|
155
|
+
// Parse SinglePredicate
|
156
|
+
std::unique_ptr<XdsMatcherList::Predicate> ParseSinglePredicate(
|
157
|
+
const XdsResourceType::DecodeContext& context,
|
158
|
+
const xds_type_matcher_v3_Matcher_MatcherList_Predicate_SinglePredicate*
|
159
|
+
single_predicate,
|
160
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
161
|
+
std::unique_ptr<XdsMatcherList::InputMatcher<absl::string_view>>
|
162
|
+
input_string_matcher;
|
163
|
+
{
|
164
|
+
ValidationErrors::ScopedField field(errors, ".value_match");
|
165
|
+
// Supporting value match now, need to add custom match
|
166
|
+
const auto* value_match_proto =
|
167
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_SinglePredicate_value_match(
|
168
|
+
single_predicate);
|
169
|
+
input_string_matcher =
|
170
|
+
ParseStringMatcher(context, value_match_proto, errors);
|
171
|
+
}
|
172
|
+
std::unique_ptr<XdsMatcher::InputValue<absl::string_view>> input_string_value;
|
173
|
+
{
|
174
|
+
ValidationErrors::ScopedField field(errors, ".input");
|
175
|
+
auto* input_proto =
|
176
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_SinglePredicate_input(
|
177
|
+
single_predicate);
|
178
|
+
input_string_value =
|
179
|
+
ParseStringInput(context, input_proto, matcher_context, errors);
|
180
|
+
}
|
181
|
+
return XdsMatcherList::CreateSinglePredicate(std::move(input_string_value),
|
182
|
+
std::move(input_string_matcher));
|
183
|
+
}
|
184
|
+
|
185
|
+
std::vector<std::unique_ptr<XdsMatcherList::Predicate>> ParsePredicateList(
|
186
|
+
const XdsResourceType::DecodeContext& context,
|
187
|
+
const xds_type_matcher_v3_Matcher_MatcherList_Predicate_PredicateList*
|
188
|
+
predicate_list,
|
189
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
190
|
+
std::vector<std::unique_ptr<XdsMatcherList::Predicate>> predicates;
|
191
|
+
size_t predicate_list_size;
|
192
|
+
auto list =
|
193
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_PredicateList_predicate(
|
194
|
+
predicate_list, &predicate_list_size);
|
195
|
+
if (predicate_list_size == 0) {
|
196
|
+
errors->AddError("predicate_list is empty");
|
197
|
+
return predicates;
|
198
|
+
}
|
199
|
+
ValidationErrors::ScopedField field(errors, ".predicate_list");
|
200
|
+
for (size_t i = 0; i < predicate_list_size; ++i) {
|
201
|
+
ValidationErrors::ScopedField field(errors, absl::StrCat("[", i, "]"));
|
202
|
+
auto predicate = ParsePredicate(context, list[i], matcher_context, errors);
|
203
|
+
if (predicate) predicates.push_back(std::move(predicate));
|
204
|
+
}
|
205
|
+
return predicates;
|
206
|
+
}
|
207
|
+
|
208
|
+
// Parse Predicate field of the Matcher
|
209
|
+
std::unique_ptr<XdsMatcherList::Predicate> ParsePredicate(
|
210
|
+
const XdsResourceType::DecodeContext& context,
|
211
|
+
const xds_type_matcher_v3_Matcher_MatcherList_Predicate* predicate,
|
212
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
213
|
+
if (predicate == nullptr) {
|
214
|
+
errors->AddError("field not present");
|
215
|
+
return nullptr;
|
216
|
+
}
|
217
|
+
if (xds_type_matcher_v3_Matcher_MatcherList_Predicate_has_single_predicate(
|
218
|
+
predicate)) {
|
219
|
+
ValidationErrors::ScopedField field(errors, ".single_predicate");
|
220
|
+
return ParseSinglePredicate(
|
221
|
+
context,
|
222
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_single_predicate(
|
223
|
+
predicate),
|
224
|
+
matcher_context, errors);
|
225
|
+
} else if (xds_type_matcher_v3_Matcher_MatcherList_Predicate_has_or_matcher(
|
226
|
+
predicate)) {
|
227
|
+
ValidationErrors::ScopedField field(errors, ".or_matcher");
|
228
|
+
auto predicate_list = ParsePredicateList(
|
229
|
+
context,
|
230
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_or_matcher(predicate),
|
231
|
+
matcher_context, errors);
|
232
|
+
return XdsMatcherList::OrPredicate::Create(std::move(predicate_list));
|
233
|
+
} else if (xds_type_matcher_v3_Matcher_MatcherList_Predicate_has_and_matcher(
|
234
|
+
predicate)) {
|
235
|
+
ValidationErrors::ScopedField field(errors, ".and_matcher");
|
236
|
+
auto predicate_list = ParsePredicateList(
|
237
|
+
context,
|
238
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_and_matcher(
|
239
|
+
predicate),
|
240
|
+
matcher_context, errors);
|
241
|
+
return XdsMatcherList::AndPredicate::Create(std::move(predicate_list));
|
242
|
+
} else if (xds_type_matcher_v3_Matcher_MatcherList_Predicate_has_not_matcher(
|
243
|
+
predicate)) {
|
244
|
+
ValidationErrors::ScopedField field(errors, ".not_matcher");
|
245
|
+
auto not_predicate = ParsePredicate(
|
246
|
+
context,
|
247
|
+
xds_type_matcher_v3_Matcher_MatcherList_Predicate_not_matcher(
|
248
|
+
predicate),
|
249
|
+
matcher_context, errors);
|
250
|
+
return XdsMatcherList::NotPredicate::Create(std::move(not_predicate));
|
251
|
+
}
|
252
|
+
errors->AddError("unsupported predicate type");
|
253
|
+
return nullptr;
|
254
|
+
}
|
255
|
+
|
256
|
+
// Parse Field Matchers (List of Predicate-OnMatch pairs)
|
257
|
+
std::vector<XdsMatcherList::FieldMatcher> ParseFieldMatcherList(
|
258
|
+
const XdsResourceType::DecodeContext& context,
|
259
|
+
const xds_type_matcher_v3_Matcher_MatcherList* matcher_list,
|
260
|
+
const XdsMatcherActionRegistry& action_registry,
|
261
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
262
|
+
std::vector<XdsMatcherList::FieldMatcher> field_matcher_list;
|
263
|
+
size_t matcher_list_size;
|
264
|
+
auto field_matchers = xds_type_matcher_v3_Matcher_MatcherList_matchers(
|
265
|
+
matcher_list, &matcher_list_size);
|
266
|
+
if (matcher_list_size == 0) {
|
267
|
+
errors->AddError("matcher_list is empty");
|
268
|
+
return field_matcher_list;
|
269
|
+
}
|
270
|
+
ValidationErrors::ScopedField field(errors, ".matchers");
|
271
|
+
for (size_t i = 0; i < matcher_list_size; ++i) {
|
272
|
+
ValidationErrors::ScopedField field(errors, absl::StrCat("[", i, "]"));
|
273
|
+
auto on_match = [&]() {
|
274
|
+
ValidationErrors::ScopedField field(errors, ".on_match");
|
275
|
+
auto* on_match_upb =
|
276
|
+
xds_type_matcher_v3_Matcher_MatcherList_FieldMatcher_on_match(
|
277
|
+
field_matchers[i]);
|
278
|
+
return ParseOnMatch(context, on_match_upb, action_registry,
|
279
|
+
matcher_context, errors);
|
280
|
+
}();
|
281
|
+
auto predicate = [&]() {
|
282
|
+
ValidationErrors::ScopedField field(errors, ".predicate");
|
283
|
+
auto* predicate_upb =
|
284
|
+
xds_type_matcher_v3_Matcher_MatcherList_FieldMatcher_predicate(
|
285
|
+
field_matchers[i]);
|
286
|
+
return ParsePredicate(context, predicate_upb, matcher_context, errors);
|
287
|
+
}();
|
288
|
+
field_matcher_list.emplace_back(std::move(predicate), std::move(on_match));
|
289
|
+
}
|
290
|
+
return field_matcher_list;
|
291
|
+
}
|
292
|
+
|
293
|
+
} // namespace
|
294
|
+
|
295
|
+
// Parse Matcher Proto
|
296
|
+
// This the top level function expected to be called for the matcher.proto
|
297
|
+
std::unique_ptr<XdsMatcher> ParseXdsMatcher(
|
298
|
+
const XdsResourceType::DecodeContext& context,
|
299
|
+
const xds_type_matcher_v3_Matcher* matcher,
|
300
|
+
const XdsMatcherActionRegistry& action_registry,
|
301
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors) {
|
302
|
+
std::optional<XdsMatcher::OnMatch> on_no_match;
|
303
|
+
if (xds_type_matcher_v3_Matcher_has_on_no_match(matcher)) {
|
304
|
+
ValidationErrors::ScopedField field(errors, ".on_no_match");
|
305
|
+
on_no_match =
|
306
|
+
ParseOnMatch(context, xds_type_matcher_v3_Matcher_on_no_match(matcher),
|
307
|
+
action_registry, matcher_context, errors);
|
308
|
+
}
|
309
|
+
if (xds_type_matcher_v3_Matcher_has_matcher_list(matcher)) {
|
310
|
+
ValidationErrors::ScopedField field(errors, ".matcher_list");
|
311
|
+
auto matcher_list = xds_type_matcher_v3_Matcher_matcher_list(matcher);
|
312
|
+
auto field_matcher_list = ParseFieldMatcherList(
|
313
|
+
context, matcher_list, action_registry, matcher_context, errors);
|
314
|
+
return std::make_unique<XdsMatcherList>(std::move(field_matcher_list),
|
315
|
+
std::move(on_no_match));
|
316
|
+
} else if (xds_type_matcher_v3_Matcher_has_matcher_tree(matcher)) {
|
317
|
+
ValidationErrors::ScopedField field(errors, ".matcher_tree");
|
318
|
+
auto matcher_tree = xds_type_matcher_v3_Matcher_matcher_tree(matcher);
|
319
|
+
std::unique_ptr<XdsMatcher::InputValue<absl::string_view>> input;
|
320
|
+
auto* input_upb =
|
321
|
+
xds_type_matcher_v3_Matcher_MatcherTree_input(matcher_tree);
|
322
|
+
{
|
323
|
+
ValidationErrors::ScopedField field(errors, ".input");
|
324
|
+
input = ParseStringInput(context, input_upb, matcher_context, errors);
|
325
|
+
}
|
326
|
+
if (xds_type_matcher_v3_Matcher_MatcherTree_has_exact_match_map(
|
327
|
+
matcher_tree)) {
|
328
|
+
ValidationErrors::ScopedField field(errors, ".exact_match_map");
|
329
|
+
auto map = ParseMatchMap(
|
330
|
+
context,
|
331
|
+
xds_type_matcher_v3_Matcher_MatcherTree_exact_match_map(matcher_tree),
|
332
|
+
action_registry, matcher_context, errors);
|
333
|
+
return std::make_unique<XdsMatcherExactMap>(
|
334
|
+
std::move(input), std::move(map), std::move(on_no_match));
|
335
|
+
} else if (xds_type_matcher_v3_Matcher_MatcherTree_has_prefix_match_map(
|
336
|
+
matcher_tree)) {
|
337
|
+
ValidationErrors::ScopedField field(errors, ".prefix_match_map");
|
338
|
+
auto map = ParseMatchMap(
|
339
|
+
context,
|
340
|
+
xds_type_matcher_v3_Matcher_MatcherTree_prefix_match_map(
|
341
|
+
matcher_tree),
|
342
|
+
action_registry, matcher_context, errors);
|
343
|
+
return std::make_unique<XdsMatcherPrefixMap>(
|
344
|
+
std::move(input), std::move(map), std::move(on_no_match));
|
345
|
+
} else {
|
346
|
+
errors->AddError("no known match tree type specified");
|
347
|
+
}
|
348
|
+
} else {
|
349
|
+
errors->AddError(
|
350
|
+
"no matcher_list or matcher_tree "
|
351
|
+
"specified.");
|
352
|
+
}
|
353
|
+
return nullptr;
|
354
|
+
}
|
355
|
+
|
356
|
+
} // namespace grpc_core
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Copyright 2025 gRPC authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_PARSE_H
|
16
|
+
#define GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_PARSE_H
|
17
|
+
|
18
|
+
#include <memory>
|
19
|
+
|
20
|
+
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
21
|
+
#include "src/core/xds/grpc/xds_matcher.h"
|
22
|
+
#include "src/core/xds/grpc/xds_matcher_action.h"
|
23
|
+
#include "xds/type/matcher/v3/matcher.upb.h"
|
24
|
+
|
25
|
+
namespace grpc_core {
|
26
|
+
|
27
|
+
// Parses the xDS Matcher proto into an `XdsMatcher` object.
|
28
|
+
// This is the top-level function expected to be called for parsing the
|
29
|
+
// matcher.proto.
|
30
|
+
// TODO(bpawan) : Add support for envoy matcher proto as well.
|
31
|
+
std::unique_ptr<XdsMatcher> ParseXdsMatcher(
|
32
|
+
const XdsResourceType::DecodeContext& context,
|
33
|
+
const xds_type_matcher_v3_Matcher* matcher,
|
34
|
+
const XdsMatcherActionRegistry& action_registry,
|
35
|
+
const UniqueTypeName& matcher_context, ValidationErrors* errors);
|
36
|
+
|
37
|
+
} // namespace grpc_core
|
38
|
+
|
39
|
+
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_MATCHER_PARSE_H
|
@@ -21,17 +21,18 @@
|
|
21
21
|
#include <string>
|
22
22
|
#include <utility>
|
23
23
|
|
24
|
-
#include "absl/log/check.h"
|
25
24
|
#include "absl/strings/str_cat.h"
|
26
25
|
#include "absl/strings/str_join.h"
|
27
26
|
#include "absl/strings/string_view.h"
|
27
|
+
#include "src/core/util/grpc_check.h"
|
28
28
|
|
29
29
|
namespace grpc_core {
|
30
30
|
|
31
31
|
void XdsMetadataMap::Insert(absl::string_view key,
|
32
32
|
std::unique_ptr<XdsMetadataValue> value) {
|
33
|
-
|
34
|
-
|
33
|
+
GRPC_CHECK(value != nullptr);
|
34
|
+
GRPC_CHECK(map_.emplace(key, std::move(value)).second)
|
35
|
+
<< "duplicate key: " << key;
|
35
36
|
}
|
36
37
|
|
37
38
|
const XdsMetadataValue* XdsMetadataMap::Find(absl::string_view key) const {
|
@@ -30,7 +30,6 @@
|
|
30
30
|
#include <variant>
|
31
31
|
#include <vector>
|
32
32
|
|
33
|
-
#include "absl/log/check.h"
|
34
33
|
#include "absl/log/log.h"
|
35
34
|
#include "absl/status/status.h"
|
36
35
|
#include "absl/status/statusor.h"
|
@@ -58,6 +57,7 @@
|
|
58
57
|
#include "src/core/load_balancing/lb_policy_registry.h"
|
59
58
|
#include "src/core/util/down_cast.h"
|
60
59
|
#include "src/core/util/env.h"
|
60
|
+
#include "src/core/util/grpc_check.h"
|
61
61
|
#include "src/core/util/json/json.h"
|
62
62
|
#include "src/core/util/json/json_writer.h"
|
63
63
|
#include "src/core/util/match.h"
|
@@ -219,7 +219,7 @@ std::optional<StringMatcher> RoutePathMatchParse(
|
|
219
219
|
} else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
|
220
220
|
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
221
221
|
envoy_config_route_v3_RouteMatch_safe_regex(match);
|
222
|
-
|
222
|
+
GRPC_CHECK_NE(regex_matcher, nullptr);
|
223
223
|
type = StringMatcher::Type::kSafeRegex;
|
224
224
|
match_string = UpbStringToStdString(
|
225
225
|
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
@@ -248,7 +248,7 @@ void RouteHeaderMatchersParse(const XdsResourceType::DecodeContext& context,
|
|
248
248
|
ValidationErrors::ScopedField field(errors,
|
249
249
|
absl::StrCat(".headers[", i, "]"));
|
250
250
|
const envoy_config_route_v3_HeaderMatcher* header = headers[i];
|
251
|
-
|
251
|
+
GRPC_CHECK_NE(header, nullptr);
|
252
252
|
const std::string name =
|
253
253
|
UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
|
254
254
|
const bool invert_match =
|
@@ -289,7 +289,7 @@ void RouteHeaderMatchersParse(const XdsResourceType::DecodeContext& context,
|
|
289
289
|
header)) {
|
290
290
|
const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
|
291
291
|
envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
|
292
|
-
|
292
|
+
GRPC_CHECK_NE(regex_matcher, nullptr);
|
293
293
|
type = HeaderMatcher::Type::kSafeRegex;
|
294
294
|
match_string = UpbStringToStdString(
|
295
295
|
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
|
@@ -297,7 +297,7 @@ void RouteHeaderMatchersParse(const XdsResourceType::DecodeContext& context,
|
|
297
297
|
type = HeaderMatcher::Type::kRange;
|
298
298
|
const envoy_type_v3_Int64Range* range_matcher =
|
299
299
|
envoy_config_route_v3_HeaderMatcher_range_match(header);
|
300
|
-
|
300
|
+
GRPC_CHECK_NE(range_matcher, nullptr);
|
301
301
|
range_start = envoy_type_v3_Int64Range_start(range_matcher);
|
302
302
|
range_end = envoy_type_v3_Int64Range_end(range_matcher);
|
303
303
|
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
|
@@ -614,7 +614,7 @@ std::optional<XdsRouteConfigResource::Route::RouteAction> RouteActionParse(
|
|
614
614
|
ValidationErrors::ScopedField field(errors, ".weighted_clusters");
|
615
615
|
const envoy_config_route_v3_WeightedCluster* weighted_clusters_proto =
|
616
616
|
envoy_config_route_v3_RouteAction_weighted_clusters(route_action_proto);
|
617
|
-
|
617
|
+
GRPC_CHECK_NE(weighted_clusters_proto, nullptr);
|
618
618
|
std::vector<XdsRouteConfigResource::Route::RouteAction::ClusterWeight>
|
619
619
|
action_weighted_clusters;
|
620
620
|
uint64_t total_weight = 0;
|
@@ -26,12 +26,12 @@
|
|
26
26
|
#include <cctype>
|
27
27
|
#include <utility>
|
28
28
|
|
29
|
-
#include "absl/log/check.h"
|
30
29
|
#include "absl/status/status.h"
|
31
30
|
#include "absl/status/statusor.h"
|
32
31
|
#include "absl/strings/match.h"
|
33
32
|
#include "absl/strings/str_cat.h"
|
34
33
|
#include "src/core/lib/channel/channel_args.h"
|
34
|
+
#include "src/core/util/grpc_check.h"
|
35
35
|
#include "src/core/util/matchers.h"
|
36
36
|
#include "src/core/xds/grpc/xds_http_filter.h"
|
37
37
|
|
@@ -115,7 +115,7 @@ std::optional<size_t> XdsRouting::FindVirtualHostForDomain(
|
|
115
115
|
// than current match.
|
116
116
|
const MatchType match_type = DomainPatternMatchType(domain_pattern);
|
117
117
|
// This should be caught by RouteConfigParse().
|
118
|
-
|
118
|
+
GRPC_CHECK(match_type != INVALID_MATCH);
|
119
119
|
if (match_type > best_match_type) continue;
|
120
120
|
if (match_type == best_match_type &&
|
121
121
|
domain_pattern.size() <= longest_match) {
|
@@ -231,7 +231,7 @@ GeneratePerHTTPFilterConfigs(
|
|
231
231
|
const XdsHttpFilterImpl* filter_impl =
|
232
232
|
http_filter_registry.GetFilterForType(
|
233
233
|
http_filter.config.config_proto_type_name);
|
234
|
-
|
234
|
+
GRPC_CHECK_NE(filter_impl, nullptr);
|
235
235
|
// If there is not actually any C-core filter associated with this
|
236
236
|
// xDS filter, then it won't need any config, so skip it.
|
237
237
|
if (filter_impl->channel_filter() == nullptr) continue;
|