grpc 1.78.0 → 1.80.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 +22 -8
- data/include/grpc/credentials.h +47 -37
- data/include/grpc/credentials_cpp.h +39 -0
- data/include/grpc/event_engine/event_engine.h +8 -3
- data/include/grpc/grpc.h +4 -0
- data/include/grpc/impl/call.h +9 -0
- data/include/grpc/impl/channel_arg_names.h +7 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/private_key_signer.h +104 -0
- data/include/grpc/support/port_platform.h +6 -0
- data/src/core/call/call_filters.h +101 -78
- data/src/core/call/call_spine.h +91 -68
- data/src/core/call/call_state.h +60 -4
- data/src/core/call/client_call.cc +9 -9
- data/src/core/call/client_call.h +1 -1
- data/src/core/call/metadata_batch.cc +2 -0
- data/src/core/call/metadata_batch.h +48 -1
- data/src/core/call/metadata_info.cc +35 -0
- data/src/core/call/metadata_info.h +2 -0
- data/src/core/call/simple_slice_based_metadata.h +2 -1
- data/src/core/channelz/channelz.cc +9 -6
- data/src/core/channelz/channelz.h +7 -4
- data/src/core/channelz/property_list.h +5 -0
- data/src/core/channelz/v2tov1/convert.cc +1 -1
- data/src/core/channelz/v2tov1/legacy_api.cc +164 -307
- data/src/core/client_channel/buffered_call.cc +7 -3
- data/src/core/client_channel/buffered_call.h +11 -5
- data/src/core/client_channel/client_channel.cc +106 -44
- data/src/core/client_channel/client_channel.h +3 -6
- data/src/core/client_channel/client_channel_filter.cc +90 -64
- data/src/core/client_channel/client_channel_filter.h +3 -6
- data/src/core/client_channel/client_channel_internal.h +5 -0
- data/src/core/client_channel/config_selector.h +17 -12
- data/src/core/client_channel/dynamic_filters.cc +8 -7
- data/src/core/client_channel/dynamic_filters.h +7 -5
- data/src/core/client_channel/retry_filter.cc +1 -1
- data/src/core/client_channel/retry_filter.h +2 -2
- data/src/core/client_channel/subchannel.cc +1682 -266
- data/src/core/client_channel/subchannel.h +411 -134
- data/src/core/client_channel/subchannel_stream_client.cc +22 -18
- data/src/core/client_channel/subchannel_stream_client.h +8 -9
- data/src/core/client_channel/subchannel_stream_limiter.cc +76 -0
- data/src/core/client_channel/subchannel_stream_limiter.h +51 -0
- data/src/core/config/config_vars.cc +9 -1
- data/src/core/config/config_vars.h +6 -0
- data/src/core/credentials/call/call_creds_registry.h +51 -22
- data/src/core/credentials/call/call_creds_registry_init.cc +86 -2
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +2 -2
- data/src/core/credentials/call/external/external_account_credentials.cc +11 -4
- data/src/core/credentials/call/external/file_external_account_credentials.cc +2 -2
- data/src/core/credentials/transport/channel_creds_registry.h +71 -20
- data/src/core/credentials/transport/channel_creds_registry_init.cc +338 -29
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +43 -24
- data/src/core/credentials/transport/ssl/ssl_credentials.h +7 -1
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +2 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -3
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +25 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +7 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +181 -109
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +55 -42
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +28 -23
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +26 -23
- data/src/core/credentials/transport/tls/spiffe_utils.cc +2 -2
- data/src/core/credentials/transport/tls/ssl_utils.cc +18 -18
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -10
- data/src/core/credentials/transport/tls/tls_security_connector.cc +106 -74
- data/src/core/credentials/transport/tls/tls_security_connector.h +12 -8
- data/src/core/credentials/transport/xds/xds_credentials.cc +76 -32
- data/src/core/credentials/transport/xds/xds_credentials.h +4 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +117 -35
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +42 -4
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +58 -29
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +19 -11
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +82 -25
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +28 -3
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +9 -7
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +1 -1
- data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +7 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +117 -67
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +2 -15
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
- data/src/core/ext/transport/chttp2/transport/goaway.cc +17 -2
- data/src/core/ext/transport/chttp2/transport/goaway.h +27 -6
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +8 -21
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +101 -40
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +923 -772
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +406 -423
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +8 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +25 -13
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +71 -24
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +25 -49
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +29 -9
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -2
- data/src/core/ext/transport/chttp2/transport/keepalive.cc +14 -20
- data/src/core/ext/transport/chttp2/transport/keepalive.h +9 -6
- data/src/core/ext/transport/chttp2/transport/parsing.cc +11 -0
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +34 -74
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +123 -79
- data/src/core/ext/transport/chttp2/transport/security_frame.h +233 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +152 -73
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +155 -85
- data/src/core/ext/transport/chttp2/transport/transport_common.h +0 -5
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +8 -7
- data/src/core/ext/transport/chttp2/transport/write_cycle.cc +86 -0
- data/src/core/ext/transport/chttp2/transport/write_cycle.h +355 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +31 -29
- data/src/core/ext/upb-gen/cel/expr/checked.upb.h +1875 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +409 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +56 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +2223 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +489 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +60 -0
- data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +130 -18
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +18 -13
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +70 -38
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +20 -17
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +495 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +114 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +36 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +121 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +54 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +143 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +18 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +112 -11
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +22 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +276 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +60 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +4 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +72 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +23 -2
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +129 -13
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +36 -10
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +31 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +63 -0
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +12 -7
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +97 -81
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +40 -23
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +604 -228
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +146 -100
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +35 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +7 -4
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +66 -14
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +22 -11
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +87 -0
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +29 -2
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +20 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +5 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +239 -60
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +59 -28
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +89 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +50 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +135 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +53 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +105 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +51 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +6 -3
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +206 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +41 -8
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +31 -5
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +283 -14
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +48 -11
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +144 -6
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -7
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +42 -21
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +9 -8
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +164 -1
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +37 -6
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +26 -11
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +8 -8
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +33 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +14 -3
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +90 -10
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +18 -7
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.c +248 -0
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.h +97 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.c +283 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.h +107 -0
- data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +213 -211
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +635 -614
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1012 -1000
- data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +276 -273
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.c +152 -0
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +149 -144
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +367 -370
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +297 -284
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +492 -469
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +74 -43
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +60 -59
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +202 -184
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +354 -339
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +28 -19
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +30 -27
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +71 -66
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +94 -91
- data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +386 -369
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +60 -57
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +1974 -1884
- data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +119 -112
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +62 -51
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +109 -88
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +54 -36
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +78 -84
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +48 -46
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1041 -984
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +304 -290
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +94 -77
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +246 -193
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +37 -23
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +5 -3
- data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +4 -4
- data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +4 -5
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +113 -87
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +6 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +25 -30
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +14 -20
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +180 -183
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +56 -47
- data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +69 -47
- data/src/core/filter/filter_chain.h +95 -0
- data/src/core/handshaker/http_connect/{http_connect_handshaker.cc → http_connect_client_handshaker.cc} +32 -31
- data/src/core/handshaker/http_connect/{http_connect_handshaker.h → http_connect_client_handshaker.h} +4 -4
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +14 -13
- data/src/core/handshaker/security/secure_endpoint.cc +282 -68
- data/src/core/handshaker/security/secure_endpoint.h +0 -7
- data/src/core/lib/channel/channel_args.h +1 -1
- data/src/core/lib/channel/promise_based_filter.cc +17 -4
- data/src/core/lib/channel/promise_based_filter.h +3 -2
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +35 -8
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +1 -2
- data/src/core/lib/event_engine/event_engine.cc +9 -0
- data/src/core/lib/event_engine/extensions/tcp_trace.h +0 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +24 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +141 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +19 -2
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +7 -0
- data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +21 -3
- data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +16 -0
- data/src/core/lib/experiments/experiments.cc +309 -201
- data/src/core/lib/experiments/experiments.h +141 -80
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
- data/src/core/lib/iomgr/resolve_address.h +0 -2
- data/src/core/lib/iomgr/resolved_address.h +0 -2
- data/src/core/lib/iomgr/tcp_posix.cc +13 -5
- data/src/core/lib/iomgr/tcp_server.cc +0 -5
- data/src/core/lib/iomgr/tcp_server.h +0 -7
- data/src/core/lib/iomgr/tcp_server_posix.cc +0 -17
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +12 -51
- data/src/core/lib/promise/all_ok.h +17 -12
- data/src/core/lib/promise/cancel_callback.h +12 -13
- data/src/core/lib/promise/detail/join_state.h +626 -0
- data/src/core/lib/promise/detail/promise_factory.h +14 -14
- data/src/core/lib/promise/for_each.h +32 -8
- data/src/core/lib/promise/if.h +9 -7
- data/src/core/lib/promise/loop.h +18 -16
- data/src/core/lib/promise/map.h +54 -47
- data/src/core/lib/promise/mpsc.h +11 -10
- data/src/core/lib/promise/observable.h +6 -6
- data/src/core/lib/promise/party.h +25 -19
- data/src/core/lib/promise/poll.h +5 -5
- data/src/core/lib/promise/prioritized_race.h +10 -7
- data/src/core/lib/promise/promise.h +16 -11
- data/src/core/lib/promise/race.h +6 -5
- data/src/core/lib/promise/seq.h +109 -74
- data/src/core/lib/promise/try_join.h +14 -6
- data/src/core/lib/promise/try_seq.h +76 -60
- data/src/core/lib/resource_quota/api.cc +7 -0
- data/src/core/lib/resource_quota/arena.h +1 -1
- data/src/core/lib/resource_quota/memory_quota.cc +4 -1
- data/src/core/lib/resource_quota/resource_quota.cc +2 -1
- data/src/core/lib/resource_quota/resource_quota.h +3 -0
- data/src/core/lib/resource_quota/stream_quota.cc +77 -1
- data/src/core/lib/resource_quota/stream_quota.h +64 -1
- data/src/core/lib/resource_quota/telemetry.h +1 -1
- data/src/core/lib/surface/call.cc +13 -0
- data/src/core/lib/surface/call_utils.h +58 -43
- data/src/core/lib/surface/channel.h +1 -4
- data/src/core/lib/surface/completion_queue.cc +13 -6
- data/src/core/lib/surface/validate_metadata.cc +20 -15
- data/src/core/lib/surface/validate_metadata.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.cc +1 -1
- data/src/core/lib/transport/promise_endpoint.h +1 -1
- data/src/core/lib/transport/transport.h +5 -0
- data/src/core/load_balancing/health_check_client.cc +1 -15
- data/src/core/load_balancing/health_check_client_internal.h +0 -2
- data/src/core/load_balancing/oob_backend_metric.cc +1 -5
- data/src/core/load_balancing/oob_backend_metric_internal.h +0 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +12 -9
- data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -2
- data/src/core/resolver/xds/xds_resolver.cc +162 -116
- data/src/core/server/server.cc +18 -1
- data/src/core/server/server.h +2 -0
- data/src/core/server/xds_server_config_fetcher.cc +4 -4
- data/src/core/telemetry/call_tracer.cc +87 -2
- data/src/core/telemetry/call_tracer.h +46 -8
- data/src/core/telemetry/instrument.cc +102 -40
- data/src/core/telemetry/instrument.h +246 -65
- data/src/core/tsi/fake_transport_security.cc +3 -1
- data/src/core/tsi/ssl_transport_security.cc +516 -137
- data/src/core/tsi/ssl_transport_security.h +28 -22
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -2
- data/src/core/tsi/ssl_transport_security_utils.h +2 -2
- data/src/core/util/bitset.h +6 -0
- data/src/core/util/function_signature.h +3 -1
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/json/json_reader.cc +0 -4
- data/src/core/xds/grpc/certificate_provider_store.cc +2 -1
- data/src/core/xds/grpc/certificate_provider_store.h +3 -17
- data/src/core/xds/grpc/certificate_provider_store_interface.h +61 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +48 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +18 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -2
- data/src/core/xds/grpc/xds_certificate_provider.h +13 -2
- data/src/core/xds/grpc/xds_client_grpc.cc +13 -6
- data/src/core/xds/grpc/xds_client_grpc.h +10 -7
- data/src/core/xds/grpc/xds_cluster.cc +18 -4
- data/src/core/xds/grpc/xds_cluster.h +17 -2
- data/src/core/xds/grpc/xds_cluster_parser.cc +36 -11
- data/src/core/xds/grpc/xds_common_types.cc +45 -0
- data/src/core/xds/grpc/xds_common_types.h +31 -0
- data/src/core/xds/grpc/xds_common_types_parser.cc +274 -16
- data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +128 -24
- data/src/core/xds/grpc/xds_http_fault_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_filter.cc +38 -0
- data/src/core/xds/grpc/xds_http_filter.h +70 -47
- data/src/core/xds/grpc/xds_http_filter_registry.cc +48 -14
- data/src/core/xds/grpc/xds_http_filter_registry.h +29 -15
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +88 -22
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +22 -11
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +36 -20
- data/src/core/xds/grpc/xds_http_rbac_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +143 -26
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -10
- data/src/core/xds/grpc/xds_listener.cc +4 -1
- data/src/core/xds/grpc/xds_listener.h +10 -2
- data/src/core/xds/grpc/xds_listener_parser.cc +23 -18
- data/src/core/xds/grpc/xds_matcher.cc +40 -5
- data/src/core/xds/grpc/xds_matcher.h +13 -0
- data/src/core/xds/grpc/xds_matcher_action.h +1 -1
- data/src/core/xds/grpc/xds_matcher_parse.cc +60 -40
- data/src/core/xds/grpc/xds_matcher_parse.h +2 -1
- data/src/core/xds/grpc/xds_route_config.cc +12 -1
- data/src/core/xds/grpc/xds_route_config.h +15 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +11 -5
- data/src/core/xds/grpc/xds_routing.cc +181 -6
- data/src/core/xds/grpc/xds_routing.h +57 -0
- data/src/core/xds/grpc/xds_server_grpc.cc +55 -43
- data/src/core/xds/grpc/xds_server_grpc.h +13 -6
- data/src/core/xds/grpc/xds_server_grpc_interface.h +3 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +12 -6
- data/src/core/xds/grpc/xds_transport_grpc.h +5 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -12
- data/src/ruby/lib/grpc/grpc.rb +7 -9
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +1 -1
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_spec.rb +3 -4
- data/src/ruby/spec/spec_helper.rb +1 -1
- metadata +64 -14
- data/src/core/ext/transport/chttp2/transport/security_frame.cc +0 -31
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +0 -597
|
@@ -137,8 +137,8 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
|
|
|
137
137
|
template <typename A, typename F>
|
|
138
138
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t<
|
|
139
139
|
!IsVoidCallable<ResultOf<F()>>::value, PromiseLike<RemoveCVRef<F>>>
|
|
140
|
-
PromiseFactoryImpl(OnceToken, F f, A&&) {
|
|
141
|
-
return PromiseLike<F>(std::
|
|
140
|
+
PromiseFactoryImpl(OnceToken, F&& f, A&&) {
|
|
141
|
+
return PromiseLike<F>(std::forward<RemoveCVRef<F>>(f));
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// Promote a callable() -> Poll<T> to a PromiseFactory() -> Promise<T>
|
|
@@ -147,8 +147,8 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t<
|
|
|
147
147
|
!IsVoidCallable<ResultOf<F()>>::value &&
|
|
148
148
|
PollTraits<ResultOf<F()>>::is_poll(),
|
|
149
149
|
PromiseLike<RemoveCVRef<F>>>
|
|
150
|
-
PromiseFactoryImpl(OnceToken, F f) {
|
|
151
|
-
return PromiseLike<F
|
|
150
|
+
PromiseFactoryImpl(OnceToken, F&& f) {
|
|
151
|
+
return PromiseLike<RemoveCVRef<F>>(std::forward<F>(f));
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// Promote a callable() -> T to a PromiseFactory() -> Immediate<T>
|
|
@@ -158,7 +158,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto PromiseFactoryImpl(
|
|
|
158
158
|
!PollTraits<ResultOf<F()>>::is_poll() &&
|
|
159
159
|
!std::is_same_v<ResultOf<F()>, void>,
|
|
160
160
|
OnceToken>,
|
|
161
|
-
F f) {
|
|
161
|
+
F&& f) {
|
|
162
162
|
auto f2 = [x = f()]() mutable { return std::move(x); };
|
|
163
163
|
return PromiseLike<decltype(f2)>(std::move(f2));
|
|
164
164
|
}
|
|
@@ -168,7 +168,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto PromiseFactoryImpl(
|
|
|
168
168
|
!PollTraits<ResultOf<F()>>::is_poll() &&
|
|
169
169
|
std::is_same_v<ResultOf<F()>, void>,
|
|
170
170
|
OnceToken>,
|
|
171
|
-
F f) {
|
|
171
|
+
F&& f) {
|
|
172
172
|
f();
|
|
173
173
|
auto f2 = []() { return Empty{}; };
|
|
174
174
|
return PromiseLike<decltype(f2)>(std::move(f2));
|
|
@@ -225,8 +225,8 @@ class OncePromiseFactory {
|
|
|
225
225
|
std::declval<A>()));
|
|
226
226
|
using UnderlyingFactory = F;
|
|
227
227
|
|
|
228
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit OncePromiseFactory(F f)
|
|
229
|
-
: f_(std::
|
|
228
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit OncePromiseFactory(F&& f)
|
|
229
|
+
: f_(std::forward<F>(f)) {}
|
|
230
230
|
|
|
231
231
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Promise Make(Arg&& a) {
|
|
232
232
|
return PromiseFactoryImpl(OnceToken{}, std::move(f_), std::forward<Arg>(a));
|
|
@@ -243,8 +243,8 @@ class OncePromiseFactory<void, F> {
|
|
|
243
243
|
using Promise = decltype(PromiseFactoryImpl(OnceToken{}, std::move(f_)));
|
|
244
244
|
using UnderlyingFactory = F;
|
|
245
245
|
|
|
246
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit OncePromiseFactory(F f)
|
|
247
|
-
: f_(std::
|
|
246
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit OncePromiseFactory(F&& f)
|
|
247
|
+
: f_(std::forward<F>(f)) {}
|
|
248
248
|
|
|
249
249
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Promise Make() {
|
|
250
250
|
return PromiseFactoryImpl(OnceToken{}, std::move(f_));
|
|
@@ -265,8 +265,8 @@ class RepeatedPromiseFactory {
|
|
|
265
265
|
using Promise =
|
|
266
266
|
decltype(PromiseFactoryImpl(RepeatableToken{}, f_, std::declval<A>()));
|
|
267
267
|
|
|
268
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit RepeatedPromiseFactory(F f)
|
|
269
|
-
: f_(std::
|
|
268
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit RepeatedPromiseFactory(F&& f)
|
|
269
|
+
: f_(std::forward<F>(f)) {}
|
|
270
270
|
|
|
271
271
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Promise Make(Arg&& a) const {
|
|
272
272
|
return PromiseFactoryImpl(RepeatableToken{}, f_, std::forward<Arg>(a));
|
|
@@ -293,8 +293,8 @@ class RepeatedPromiseFactory<void, F> {
|
|
|
293
293
|
using Arg = void;
|
|
294
294
|
using Promise = decltype(PromiseFactoryImpl(RepeatableToken{}, f_));
|
|
295
295
|
|
|
296
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit RepeatedPromiseFactory(F f)
|
|
297
|
-
: f_(std::
|
|
296
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit RepeatedPromiseFactory(F&& f)
|
|
297
|
+
: f_(std::forward<F>(f)) {}
|
|
298
298
|
|
|
299
299
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Promise Make() const {
|
|
300
300
|
return PromiseFactoryImpl(RepeatableToken{}, f_);
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include <stdint.h>
|
|
20
20
|
|
|
21
21
|
#include <string>
|
|
22
|
+
#include <type_traits>
|
|
22
23
|
#include <utility>
|
|
23
24
|
|
|
24
25
|
#include "src/core/lib/debug/trace.h"
|
|
@@ -124,10 +125,10 @@ class ForEach {
|
|
|
124
125
|
public:
|
|
125
126
|
using Result = decltype(Done<ActionResult>::Make(false));
|
|
126
127
|
|
|
127
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ForEach(Reader reader, Action action,
|
|
128
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ForEach(Reader&& reader, Action&& action,
|
|
128
129
|
DebugLocation whence = {})
|
|
129
|
-
: reader_(std::
|
|
130
|
-
action_factory_(std::
|
|
130
|
+
: reader_(std::forward<Reader>(reader)),
|
|
131
|
+
action_factory_(std::forward<Action>(action)),
|
|
131
132
|
whence_(whence) {
|
|
132
133
|
Construct(&reader_next_, reader_.Next());
|
|
133
134
|
}
|
|
@@ -164,10 +165,33 @@ class ForEach {
|
|
|
164
165
|
return PollAction();
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
void ToProto(grpc_channelz_v2_Promise* promise_proto,
|
|
169
|
+
upb_Arena* arena) const {
|
|
170
|
+
auto* for_each_promise =
|
|
171
|
+
grpc_channelz_v2_Promise_mutable_for_each_promise(promise_proto, arena);
|
|
172
|
+
|
|
173
|
+
grpc_channelz_v2_Promise_ForEach_set_reader_factory(
|
|
174
|
+
for_each_promise, StdStringToUpbString(TypeName<Reader>()));
|
|
175
|
+
grpc_channelz_v2_Promise_ForEach_set_action_factory(
|
|
176
|
+
for_each_promise, StdStringToUpbString(TypeName<ActionFactory>()));
|
|
177
|
+
if (reading_next_) {
|
|
178
|
+
PromiseAsProto(reader_next_,
|
|
179
|
+
grpc_channelz_v2_Promise_ForEach_mutable_reader_promise(
|
|
180
|
+
for_each_promise, arena),
|
|
181
|
+
arena);
|
|
182
|
+
} else {
|
|
183
|
+
PromiseAsProto(in_action_.promise,
|
|
184
|
+
grpc_channelz_v2_Promise_ForEach_mutable_action_promise(
|
|
185
|
+
for_each_promise, arena),
|
|
186
|
+
arena);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
167
190
|
private:
|
|
168
191
|
struct InAction {
|
|
169
|
-
InAction(ActionPromise promise, ReaderResult result)
|
|
170
|
-
: promise(std::
|
|
192
|
+
InAction(ActionPromise&& promise, ReaderResult&& result)
|
|
193
|
+
: promise(std::forward<ActionPromise>(promise)),
|
|
194
|
+
result(std::forward<ReaderResult>(result)) {}
|
|
171
195
|
ActionPromise promise;
|
|
172
196
|
ReaderResult result;
|
|
173
197
|
};
|
|
@@ -240,9 +264,9 @@ class ForEach {
|
|
|
240
264
|
template <typename Reader, typename Action>
|
|
241
265
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline for_each_detail::ForEach<Reader,
|
|
242
266
|
Action>
|
|
243
|
-
ForEach(Reader reader, Action action, DebugLocation whence = {}) {
|
|
244
|
-
return for_each_detail::ForEach<Reader
|
|
245
|
-
|
|
267
|
+
ForEach(Reader&& reader, Action&& action, DebugLocation whence = {}) {
|
|
268
|
+
return for_each_detail::ForEach<std::decay_t<Reader>, std::decay_t<Action>>(
|
|
269
|
+
std::forward<Reader>(reader), std::forward<Action>(action), whence);
|
|
246
270
|
}
|
|
247
271
|
|
|
248
272
|
} // namespace grpc_core
|
data/src/core/lib/promise/if.h
CHANGED
|
@@ -113,10 +113,11 @@ class If {
|
|
|
113
113
|
typename PollTraits<decltype(std::declval<TruePromise>()())>::Type;
|
|
114
114
|
|
|
115
115
|
public:
|
|
116
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION If(C condition, T if_true,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION If(C&& condition, T&& if_true,
|
|
117
|
+
F&& if_false)
|
|
118
|
+
: state_(Evaluating{ConditionPromise(std::forward<C>(condition)),
|
|
119
|
+
TrueFactory(std::forward<T>(if_true)),
|
|
120
|
+
FalseFactory(std::forward<F>(if_false))}) {}
|
|
120
121
|
|
|
121
122
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll<Result> operator()() {
|
|
122
123
|
return std::visit(CallPoll<false>{this}, state_);
|
|
@@ -173,10 +174,11 @@ class If<bool, T, F> {
|
|
|
173
174
|
typename PollTraits<decltype(std::declval<TruePromise>()())>::Type;
|
|
174
175
|
|
|
175
176
|
public:
|
|
176
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION If(bool condition, T if_true,
|
|
177
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION If(bool condition, T&& if_true,
|
|
178
|
+
F&& if_false)
|
|
177
179
|
: condition_(condition) {
|
|
178
|
-
TrueFactory true_factory(std::
|
|
179
|
-
FalseFactory false_factory(std::
|
|
180
|
+
TrueFactory true_factory(std::forward<T>(if_true));
|
|
181
|
+
FalseFactory false_factory(std::forward<F>(if_false));
|
|
180
182
|
if (condition_) {
|
|
181
183
|
Construct(&if_true_, true_factory.Make());
|
|
182
184
|
} else {
|
data/src/core/lib/promise/loop.h
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
#include <grpc/support/port_platform.h>
|
|
19
19
|
|
|
20
|
+
#include <cstddef>
|
|
20
21
|
#include <utility>
|
|
21
22
|
#include <variant>
|
|
22
23
|
|
|
@@ -137,8 +138,8 @@ class Loop {
|
|
|
137
138
|
public:
|
|
138
139
|
using Result = typename promise_detail::LoopTraits<PromiseResult>::Result;
|
|
139
140
|
|
|
140
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit Loop(F f)
|
|
141
|
-
: factory_(std::
|
|
141
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit Loop(F&& f)
|
|
142
|
+
: factory_(std::forward<F>(f)) {}
|
|
142
143
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~Loop() {
|
|
143
144
|
if (started_) Destruct(&promise_);
|
|
144
145
|
}
|
|
@@ -223,18 +224,18 @@ Loop(F) -> Loop<F, false>;
|
|
|
223
224
|
// A version of Loop that yields the activity to another promise once per
|
|
224
225
|
// iteration.
|
|
225
226
|
template <typename F>
|
|
226
|
-
auto YieldingLoop(F f) {
|
|
227
|
-
return Loop<F, true>(std::
|
|
227
|
+
auto YieldingLoop(F&& f) {
|
|
228
|
+
return Loop<F, true>(std::forward<F>(f));
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
template <typename PromiseFactory>
|
|
231
|
-
auto NTimes(size_t times, PromiseFactory promise_factory) {
|
|
232
|
+
auto NTimes(size_t times, PromiseFactory&& promise_factory) {
|
|
232
233
|
DCHECK_GT(times, 1u);
|
|
233
234
|
return Loop(
|
|
234
235
|
[i = size_t{0}, times,
|
|
235
236
|
promise_factory =
|
|
236
237
|
promise_detail::RepeatedPromiseFactory<size_t, PromiseFactory>(
|
|
237
|
-
std::
|
|
238
|
+
std::forward<PromiseFactory>(promise_factory))]() mutable {
|
|
238
239
|
return Seq(promise_factory.Make(i), [&i, times](auto result) {
|
|
239
240
|
using Result = decltype(result);
|
|
240
241
|
LoopCtl<Result> lc = std::move(result);
|
|
@@ -246,16 +247,17 @@ auto NTimes(size_t times, PromiseFactory promise_factory) {
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
template <typename PromiseFactory>
|
|
249
|
-
auto WhilstSuccessful(PromiseFactory promise_factory) {
|
|
250
|
-
return Loop(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
auto WhilstSuccessful(PromiseFactory&& promise_factory) {
|
|
251
|
+
return Loop(
|
|
252
|
+
[promise_factory =
|
|
253
|
+
promise_detail::RepeatedPromiseFactory<void, PromiseFactory>(
|
|
254
|
+
std::forward<PromiseFactory>(promise_factory))]() mutable {
|
|
255
|
+
return Seq(promise_factory.Make(), [](auto result) {
|
|
256
|
+
using Result = decltype(result);
|
|
257
|
+
if (result.ok()) return LoopCtl<Result>(Continue());
|
|
258
|
+
return LoopCtl<Result>(std::move(result));
|
|
259
|
+
});
|
|
260
|
+
});
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
} // namespace grpc_core
|
data/src/core/lib/promise/map.h
CHANGED
|
@@ -135,8 +135,8 @@ class Map {
|
|
|
135
135
|
using PromiseType = promise_detail::PromiseLike<Promise>;
|
|
136
136
|
|
|
137
137
|
public:
|
|
138
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Map(Promise promise, Fn fn)
|
|
139
|
-
: promise_(std::
|
|
138
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Map(Promise&& promise, Fn&& fn)
|
|
139
|
+
: promise_(std::forward<Promise>(promise)), fn_(std::forward<Fn>(fn)) {}
|
|
140
140
|
|
|
141
141
|
Map(const Map&) = delete;
|
|
142
142
|
Map& operator=(const Map&) = delete;
|
|
@@ -185,9 +185,9 @@ class Map<Map<Promise, Fn0>, Fn1> {
|
|
|
185
185
|
using PromiseType = typename Map<Promise, Fn0>::PromiseType;
|
|
186
186
|
|
|
187
187
|
public:
|
|
188
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Map(Map<Promise, Fn0> map, Fn1 fn1)
|
|
188
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Map(Map<Promise, Fn0> map, Fn1&& fn1)
|
|
189
189
|
: promise_(std::move(map.promise_)),
|
|
190
|
-
fn_(FusedFn(std::move(map.fn_), std::
|
|
190
|
+
fn_(FusedFn(std::move(map.fn_), std::forward<Fn1>(fn1))) {}
|
|
191
191
|
|
|
192
192
|
Map(const Map&) = delete;
|
|
193
193
|
Map& operator=(const Map&) = delete;
|
|
@@ -228,23 +228,25 @@ class Map<Map<Promise, Fn0>, Fn1> {
|
|
|
228
228
|
};
|
|
229
229
|
|
|
230
230
|
template <typename Promise, typename Fn>
|
|
231
|
-
Map(Promise
|
|
231
|
+
Map(Promise&&, Fn&&) -> Map<std::decay_t<Promise>, std::decay_t<Fn>>;
|
|
232
232
|
|
|
233
233
|
// Maps a promise to a new promise that returns a tuple of the original result
|
|
234
234
|
// and a bool indicating whether there was ever a Pending{} value observed from
|
|
235
235
|
// polling.
|
|
236
236
|
template <typename Promise>
|
|
237
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto CheckDelayed(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
237
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto CheckDelayed(
|
|
238
|
+
Promise&& promise) {
|
|
239
|
+
using P = promise_detail::PromiseLike<std::decay_t<Promise>>;
|
|
240
|
+
return
|
|
241
|
+
[delayed = false, promise = P(std::forward<Promise>(promise))]() mutable
|
|
242
|
+
-> Poll<std::tuple<typename P::Result, bool>> {
|
|
243
|
+
auto r = promise();
|
|
244
|
+
if (r.pending()) {
|
|
245
|
+
delayed = true;
|
|
246
|
+
return Pending{};
|
|
247
|
+
}
|
|
248
|
+
return std::tuple(std::move(r.value()), delayed);
|
|
249
|
+
};
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
// Callable that takes a tuple and returns one element
|
|
@@ -266,7 +268,7 @@ namespace promise_detail {
|
|
|
266
268
|
template <typename Fn>
|
|
267
269
|
class MapError {
|
|
268
270
|
public:
|
|
269
|
-
explicit MapError(Fn fn) : fn_(std::
|
|
271
|
+
explicit MapError(Fn&& fn) : fn_(std::forward<Fn>(fn)) {}
|
|
270
272
|
absl::Status operator()(absl::Status status) {
|
|
271
273
|
if (status.ok()) return status;
|
|
272
274
|
return fn_(std::move(status));
|
|
@@ -284,33 +286,37 @@ class MapError {
|
|
|
284
286
|
|
|
285
287
|
// Map status->better status in the case of errors
|
|
286
288
|
template <typename Promise, typename Fn>
|
|
287
|
-
auto MapErrors(Promise promise, Fn fn) {
|
|
288
|
-
return Map(std::
|
|
289
|
+
auto MapErrors(Promise&& promise, Fn&& fn) {
|
|
290
|
+
return Map(std::forward<Promise>(promise),
|
|
291
|
+
promise_detail::MapError<std::decay_t<Fn>>(std::forward<Fn>(fn)));
|
|
289
292
|
}
|
|
290
293
|
|
|
291
294
|
// Simple mapper to add a prefix to the message of an error
|
|
292
295
|
template <typename Promise>
|
|
293
|
-
auto AddErrorPrefix(absl::string_view prefix, Promise promise) {
|
|
294
|
-
return MapErrors(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
auto AddErrorPrefix(absl::string_view prefix, Promise&& promise) {
|
|
297
|
+
return MapErrors(
|
|
298
|
+
std::forward<Promise>(promise), [prefix](absl::Status status) {
|
|
299
|
+
absl::Status out(status.code(), absl::StrCat(prefix, status.message()));
|
|
300
|
+
status.ForEachPayload(
|
|
301
|
+
[&out](absl::string_view name, const absl::Cord& value) {
|
|
302
|
+
out.SetPayload(name, value);
|
|
303
|
+
});
|
|
304
|
+
return out;
|
|
305
|
+
});
|
|
302
306
|
}
|
|
303
307
|
|
|
304
308
|
template <typename Gen, typename Promise>
|
|
305
|
-
auto AddGeneratedErrorPrefix(Gen prefix, Promise promise) {
|
|
306
|
-
return MapErrors(std::
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
auto AddGeneratedErrorPrefix(Gen&& prefix, Promise&& promise) {
|
|
310
|
+
return MapErrors(std::forward<Promise>(promise),
|
|
311
|
+
[prefix = std::forward<Gen>(prefix)](absl::Status status) {
|
|
312
|
+
absl::Status out(status.code(),
|
|
313
|
+
absl::StrCat(prefix(), status.message()));
|
|
314
|
+
status.ForEachPayload([&out](absl::string_view name,
|
|
315
|
+
const absl::Cord& value) {
|
|
316
|
+
out.SetPayload(name, value);
|
|
317
|
+
});
|
|
318
|
+
return out;
|
|
319
|
+
});
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
// Input : A promise that resolves to Type T
|
|
@@ -321,26 +327,27 @@ auto AddGeneratedErrorPrefix(Gen prefix, Promise promise) {
|
|
|
321
327
|
// gives an error. DiscardResult helps to discard the return value of the
|
|
322
328
|
// promise.
|
|
323
329
|
template <typename Promise>
|
|
324
|
-
auto DiscardResult(Promise promise) {
|
|
325
|
-
return Map(std::
|
|
330
|
+
auto DiscardResult(Promise&& promise) {
|
|
331
|
+
return Map(std::forward<Promise>(promise), [](auto) {});
|
|
326
332
|
}
|
|
327
333
|
|
|
328
334
|
// Given a promise, and N values, return a tuple with the resolved promise
|
|
329
335
|
// first, and then the N values stapled to it.
|
|
330
336
|
template <typename Promise, typename... Values>
|
|
331
|
-
auto Staple(Promise promise, Values&&... values) {
|
|
332
|
-
return Map(std::
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
auto Staple(Promise&& promise, Values&&... values) {
|
|
338
|
+
return Map(std::forward<Promise>(promise),
|
|
339
|
+
[values = std::tuple(std::forward<Values>(values)...)](
|
|
340
|
+
auto first_value) mutable {
|
|
341
|
+
return std::tuple_cat(std::tuple(std::move(first_value)),
|
|
342
|
+
std::move(values));
|
|
343
|
+
});
|
|
337
344
|
}
|
|
338
345
|
|
|
339
346
|
// Same as Staple, but assumes a StatusOr<X>, and returns X, Values.
|
|
340
347
|
template <typename Promise, typename... Values>
|
|
341
|
-
auto TryStaple(Promise promise, Values&&... values) {
|
|
348
|
+
auto TryStaple(Promise&& promise, Values&&... values) {
|
|
342
349
|
return Map(
|
|
343
|
-
std::
|
|
350
|
+
std::forward<Promise>(promise),
|
|
344
351
|
[values = std::tuple(std::forward<std::remove_reference_t<Values>>(
|
|
345
352
|
values)...)](auto first_value) mutable
|
|
346
353
|
-> absl::StatusOr<
|
data/src/core/lib/promise/mpsc.h
CHANGED
|
@@ -264,8 +264,8 @@ template <typename T>
|
|
|
264
264
|
class Center : public RefCounted<Center<T>, NonPolymorphicRefCount> {
|
|
265
265
|
private:
|
|
266
266
|
struct Node final : public Mpsc::Node {
|
|
267
|
-
explicit Node(uint32_t tokens, T value)
|
|
268
|
-
: Mpsc::Node(tokens), value(std::
|
|
267
|
+
explicit Node(uint32_t tokens, T&& value)
|
|
268
|
+
: Mpsc::Node(tokens), value(std::forward<T>(value)) {}
|
|
269
269
|
T value;
|
|
270
270
|
};
|
|
271
271
|
|
|
@@ -316,12 +316,13 @@ class Center : public RefCounted<Center<T>, NonPolymorphicRefCount> {
|
|
|
316
316
|
RefCountedPtr<Center<T>> center_;
|
|
317
317
|
};
|
|
318
318
|
|
|
319
|
-
auto Send(T value, uint32_t tokens) {
|
|
320
|
-
return mpsc_.Send(new Node(tokens, std::
|
|
319
|
+
auto Send(T&& value, uint32_t tokens) {
|
|
320
|
+
return mpsc_.Send(new Node(tokens, std::forward<T>(value)));
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
StatusFlag UnbufferedImmediateSend(T value, uint32_t tokens) {
|
|
324
|
-
return mpsc_.UnbufferedImmediateSend(
|
|
323
|
+
StatusFlag UnbufferedImmediateSend(T&& value, uint32_t tokens) {
|
|
324
|
+
return mpsc_.UnbufferedImmediateSend(
|
|
325
|
+
new Node(tokens, std::forward<T>(value)));
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
auto Next() {
|
|
@@ -392,13 +393,13 @@ class MpscSender {
|
|
|
392
393
|
// The promise returned is thread safe. We can use multiple send calls
|
|
393
394
|
// in parallel to generate multiple such send promises and these promises can
|
|
394
395
|
// be run in parallel in a thread safe way.
|
|
395
|
-
auto Send(T t, uint32_t tokens) {
|
|
396
|
-
return Map(center_->Send(std::
|
|
396
|
+
auto Send(T&& t, uint32_t tokens) {
|
|
397
|
+
return Map(center_->Send(std::forward<T>(t), tokens),
|
|
397
398
|
[c = center_](auto x) { return x; });
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
StatusFlag UnbufferedImmediateSend(T t, uint32_t tokens) {
|
|
401
|
-
return center_->UnbufferedImmediateSend(std::
|
|
401
|
+
StatusFlag UnbufferedImmediateSend(T&& t, uint32_t tokens) {
|
|
402
|
+
return center_->UnbufferedImmediateSend(std::forward<T>(t), tokens);
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
private:
|
|
@@ -31,8 +31,8 @@ template <typename T>
|
|
|
31
31
|
class Observable {
|
|
32
32
|
public:
|
|
33
33
|
// We need to assign a value initially.
|
|
34
|
-
explicit Observable(T initial)
|
|
35
|
-
: state_(MakeRefCounted<State>(std::
|
|
34
|
+
explicit Observable(T&& initial)
|
|
35
|
+
: state_(MakeRefCounted<State>(std::forward<T>(initial))) {}
|
|
36
36
|
|
|
37
37
|
// Update the value to something new. Awakes any waiters.
|
|
38
38
|
void Set(T value) { state_->Set(std::move(value)); }
|
|
@@ -41,8 +41,8 @@ class Observable {
|
|
|
41
41
|
// that value.
|
|
42
42
|
// is_acceptable is any invocable that takes a `const T&` and returns a bool.
|
|
43
43
|
template <typename F>
|
|
44
|
-
auto NextWhen(F is_acceptable) {
|
|
45
|
-
return ObserverWhen<F>(state_, std::
|
|
44
|
+
auto NextWhen(F&& is_acceptable) {
|
|
45
|
+
return ObserverWhen<F>(state_, std::forward<F>(is_acceptable));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Returns a promise that resolves to a T when the value becomes != current.
|
|
@@ -157,9 +157,9 @@ class Observable {
|
|
|
157
157
|
template <typename F>
|
|
158
158
|
class ObserverWhen : public Observer {
|
|
159
159
|
public:
|
|
160
|
-
ObserverWhen(RefCountedPtr<State> state, F is_acceptable)
|
|
160
|
+
ObserverWhen(RefCountedPtr<State> state, F&& is_acceptable)
|
|
161
161
|
: Observer(std::move(state)),
|
|
162
|
-
is_acceptable_(std::
|
|
162
|
+
is_acceptable_(std::forward<F>(is_acceptable)) {}
|
|
163
163
|
|
|
164
164
|
ObserverWhen(ObserverWhen&& other) noexcept
|
|
165
165
|
: Observer(std::move(other)),
|
|
@@ -280,10 +280,12 @@ class Party : public Activity, private Wakeable {
|
|
|
280
280
|
// spawning of promises is expected to be serialized by some external entity
|
|
281
281
|
// (usually this is a Seq running on a different party).
|
|
282
282
|
template <class Factory>
|
|
283
|
-
void Spawn(Factory factory) {
|
|
283
|
+
void Spawn(Factory&& factory) {
|
|
284
284
|
auto empty_completion = [](Empty) {};
|
|
285
|
-
next_.Push(new ParticipantImpl<Factory
|
|
286
|
-
|
|
285
|
+
next_.Push(new ParticipantImpl<std::decay_t<Factory>,
|
|
286
|
+
decltype(empty_completion)>(
|
|
287
|
+
"SpawnSerializer", std::forward<Factory>(factory),
|
|
288
|
+
std::move(empty_completion)));
|
|
287
289
|
party_->WakeupFromState<false>(
|
|
288
290
|
party_->state_.load(std::memory_order_relaxed), wakeup_mask_);
|
|
289
291
|
}
|
|
@@ -338,11 +340,11 @@ class Party : public Activity, private Wakeable {
|
|
|
338
340
|
// A party can hold upto 16 unresolved promises at a time. However, this
|
|
339
341
|
// number might change in the future.
|
|
340
342
|
template <typename Factory, typename OnComplete>
|
|
341
|
-
void Spawn(absl::string_view name, Factory promise_factory,
|
|
342
|
-
OnComplete on_complete);
|
|
343
|
+
void Spawn(absl::string_view name, Factory&& promise_factory,
|
|
344
|
+
OnComplete&& on_complete);
|
|
343
345
|
|
|
344
346
|
template <typename Factory>
|
|
345
|
-
auto SpawnWaitable(absl::string_view name, Factory factory);
|
|
347
|
+
auto SpawnWaitable(absl::string_view name, Factory&& factory);
|
|
346
348
|
|
|
347
349
|
void Orphan() final { Crash("unused"); }
|
|
348
350
|
|
|
@@ -430,10 +432,10 @@ class Party : public Activity, private Wakeable {
|
|
|
430
432
|
using Promise = typename Factory::Promise;
|
|
431
433
|
|
|
432
434
|
public:
|
|
433
|
-
ParticipantImpl(absl::string_view, SuppliedFactory promise_factory,
|
|
434
|
-
OnComplete on_complete)
|
|
435
|
-
: on_complete_(std::
|
|
436
|
-
Construct(&factory_, std::
|
|
435
|
+
ParticipantImpl(absl::string_view, SuppliedFactory&& promise_factory,
|
|
436
|
+
OnComplete&& on_complete)
|
|
437
|
+
: on_complete_(std::forward<OnComplete>(on_complete)) {
|
|
438
|
+
Construct(&factory_, std::forward<SuppliedFactory>(promise_factory));
|
|
437
439
|
}
|
|
438
440
|
~ParticipantImpl() {
|
|
439
441
|
if (!started_) {
|
|
@@ -492,8 +494,9 @@ class Party : public Activity, private Wakeable {
|
|
|
492
494
|
using Result = typename Promise::Result;
|
|
493
495
|
|
|
494
496
|
public:
|
|
495
|
-
PromiseParticipantImpl(absl::string_view,
|
|
496
|
-
|
|
497
|
+
PromiseParticipantImpl(absl::string_view,
|
|
498
|
+
SuppliedFactory&& promise_factory) {
|
|
499
|
+
Construct(&factory_, std::forward<SuppliedFactory>(promise_factory));
|
|
497
500
|
}
|
|
498
501
|
|
|
499
502
|
~PromiseParticipantImpl() {
|
|
@@ -716,18 +719,21 @@ struct ContextSubclass<Party> {
|
|
|
716
719
|
};
|
|
717
720
|
|
|
718
721
|
template <typename Factory, typename OnComplete>
|
|
719
|
-
void Party::Spawn(absl::string_view name, Factory promise_factory,
|
|
720
|
-
OnComplete on_complete) {
|
|
722
|
+
void Party::Spawn(absl::string_view name, Factory&& promise_factory,
|
|
723
|
+
OnComplete&& on_complete) {
|
|
721
724
|
GRPC_TRACE_LOG(party_state, INFO) << "PARTY[" << this << "]: spawn " << name;
|
|
722
|
-
MaybeAsyncAddParticipant(
|
|
723
|
-
|
|
725
|
+
MaybeAsyncAddParticipant(
|
|
726
|
+
new ParticipantImpl<std::decay_t<Factory>, std::decay_t<OnComplete>>(
|
|
727
|
+
name, std::forward<Factory>(promise_factory),
|
|
728
|
+
std::forward<OnComplete>(on_complete)));
|
|
724
729
|
}
|
|
725
730
|
|
|
726
731
|
template <typename Factory>
|
|
727
|
-
auto Party::SpawnWaitable(absl::string_view name, Factory promise_factory) {
|
|
732
|
+
auto Party::SpawnWaitable(absl::string_view name, Factory&& promise_factory) {
|
|
728
733
|
GRPC_TRACE_LOG(party_state, INFO) << "PARTY[" << this << "]: spawn " << name;
|
|
729
|
-
auto participant =
|
|
730
|
-
|
|
734
|
+
auto participant =
|
|
735
|
+
MakeRefCounted<PromiseParticipantImpl<std::decay_t<Factory>>>(
|
|
736
|
+
name, std::forward<Factory>(promise_factory));
|
|
731
737
|
Participant* p = participant->Ref().release();
|
|
732
738
|
MaybeAsyncAddParticipant(p);
|
|
733
739
|
return [participant = std::move(participant)]() mutable {
|
data/src/core/lib/promise/poll.h
CHANGED
|
@@ -248,27 +248,27 @@ struct PollCastImpl<T, Poll<U>> {
|
|
|
248
248
|
template <typename T, typename U>
|
|
249
249
|
struct PollCastImpl<T, U, std::enable_if<!PollTraits<U>::is_poll()>> {
|
|
250
250
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Poll<T> Cast(U&& poll) {
|
|
251
|
-
return Poll<T>(T(std::
|
|
251
|
+
return Poll<T>(T(std::forward<U>(poll)));
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
template <typename T>
|
|
256
256
|
struct PollCastImpl<T, T> {
|
|
257
257
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Poll<T> Cast(T&& poll) {
|
|
258
|
-
return Poll<T>(std::
|
|
258
|
+
return Poll<T>(std::forward<T>(poll));
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
template <typename T>
|
|
263
263
|
struct PollCastImpl<T, Poll<T>> {
|
|
264
264
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Poll<T> Cast(Poll<T>&& poll) {
|
|
265
|
-
return std::
|
|
265
|
+
return std::forward<Poll<T>>(poll);
|
|
266
266
|
}
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
template <typename T, typename U>
|
|
270
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline Poll<T> poll_cast(U poll) {
|
|
271
|
-
return PollCastImpl<T, U>::Cast(std::
|
|
270
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline Poll<T> poll_cast(U&& poll) {
|
|
271
|
+
return PollCastImpl<T, U>::Cast(std::forward<U>(poll));
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
template <typename T>
|