grpc 1.34.0 → 1.35.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +808 -2787
- data/etc/roots.pem +257 -573
- data/include/grpc/compression.h +1 -1
- data/include/grpc/grpc.h +14 -0
- data/include/grpc/grpc_security.h +61 -3
- data/include/grpc/impl/codegen/atm_windows.h +4 -0
- data/include/grpc/impl/codegen/byte_buffer.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +1 -1
- data/include/grpc/impl/codegen/log.h +0 -2
- data/include/grpc/impl/codegen/sync_windows.h +4 -0
- data/include/grpc/slice_buffer.h +3 -3
- data/include/grpc/support/sync.h +3 -3
- data/include/grpc/support/time.h +7 -7
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +2734 -1498
- data/src/core/ext/filters/client_channel/client_channel.h +0 -4
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.h +4 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +186 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -6
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -2
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +4 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +21 -20
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +32 -30
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +162 -20
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +24 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +5 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1262 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +7 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +454 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -9
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +18 -31
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -5
- data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
- data/src/core/ext/filters/client_channel/resolver_registry.cc +40 -39
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +11 -13
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +8 -8
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +3 -1
- data/src/core/ext/filters/client_channel/service_config_call_data.h +19 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +34 -50
- data/src/core/ext/filters/client_channel/subchannel.h +12 -18
- data/src/core/ext/filters/deadline/deadline_filter.cc +4 -2
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -6
- data/src/core/ext/filters/http/http_filters_plugin.cc +6 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
- data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
- data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +20 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +21 -10
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +26 -14
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +178 -86
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +12 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +42 -8
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -27
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +139 -40
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -13
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +44 -17
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -111
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +424 -241
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +13 -5
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +22 -22
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +47 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +21 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +88 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +15 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +44 -44
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +200 -78
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +17 -17
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +72 -35
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +27 -11
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +30 -30
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +136 -49
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +39 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +157 -89
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +17 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +47 -47
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +163 -78
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +9 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +13 -13
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +59 -36
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +16 -16
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +61 -29
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +26 -26
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +101 -66
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +11 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +28 -28
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +122 -77
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +106 -54
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +16 -16
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +81 -35
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +38 -22
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +203 -203
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +845 -495
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +26 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +17 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +87 -87
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +343 -204
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +20 -20
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +85 -46
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +33 -11
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +32 -32
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +118 -67
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +29 -29
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +120 -82
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -16
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +25 -11
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +29 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +16 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +19 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +46 -3
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +41 -8
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +15 -2
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -0
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +7 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +34 -34
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +149 -72
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +34 -34
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +142 -59
- data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
- data/src/core/ext/upb-generated/google/api/http.upb.h +25 -6
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +90 -90
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +455 -292
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +22 -3
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +55 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +10 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +41 -41
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +149 -76
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -6
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +13 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +82 -25
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +19 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +9 -2
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +5 -5
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +21 -7
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +4 -4
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +17 -8
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +7 -7
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +31 -18
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +5 -5
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +19 -11
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +7 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +64 -64
- data/src/core/ext/upb-generated/validate/validate.upb.h +296 -157
- data/src/core/ext/xds/certificate_provider_store.cc +10 -7
- data/src/core/ext/xds/certificate_provider_store.h +12 -7
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +25 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -4
- data/src/core/ext/xds/xds_api.cc +220 -31
- data/src/core/ext/xds/xds_api.h +41 -10
- data/src/core/ext/xds/xds_bootstrap.h +0 -1
- data/src/core/ext/xds/xds_certificate_provider.cc +61 -2
- data/src/core/ext/xds/xds_certificate_provider.h +40 -2
- data/src/core/ext/xds/xds_client.cc +31 -29
- data/src/core/ext/xds/xds_client.h +6 -1
- data/src/core/ext/xds/xds_client_stats.cc +2 -2
- data/src/core/ext/xds/xds_server_config_fetcher.cc +131 -0
- data/src/core/lib/channel/channel_args.cc +8 -8
- data/src/core/lib/channel/channel_trace.h +1 -1
- data/src/core/lib/channel/channelz.cc +13 -14
- data/src/core/lib/channel/channelz.h +0 -1
- data/src/core/lib/channel/channelz_registry.h +0 -1
- data/src/core/lib/channel/handshaker.cc +2 -2
- data/src/core/lib/compression/compression_args.cc +3 -2
- data/src/core/lib/debug/stats.h +2 -2
- data/src/core/lib/debug/stats_data.h +13 -13
- data/src/core/lib/gpr/alloc.cc +3 -2
- data/src/core/lib/gpr/log.cc +53 -16
- data/src/core/lib/gpr/log_linux.cc +3 -1
- data/src/core/lib/gpr/log_posix.cc +3 -1
- data/src/core/lib/gpr/log_windows.cc +3 -1
- data/src/core/lib/gpr/spinlock.h +10 -2
- data/src/core/lib/gpr/string.cc +22 -21
- data/src/core/lib/gpr/string.h +5 -6
- data/src/core/lib/gpr/sync.cc +4 -4
- data/src/core/lib/gpr/time.cc +12 -12
- data/src/core/lib/gprpp/arena.h +3 -2
- data/src/core/lib/gprpp/ref_counted.h +2 -2
- data/src/core/lib/gprpp/ref_counted_ptr.h +9 -1
- data/src/core/lib/gprpp/thd_posix.cc +6 -1
- data/src/core/lib/gprpp/thd_windows.cc +3 -1
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +1 -1
- data/src/core/lib/http/parser.cc +1 -2
- data/src/core/lib/iomgr/call_combiner.cc +8 -5
- data/src/core/lib/iomgr/combiner.cc +2 -1
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/error.cc +15 -11
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -13
- data/src/core/lib/iomgr/ev_epollex_linux.cc +17 -13
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -7
- data/src/core/lib/iomgr/exec_ctx.h +6 -4
- data/src/core/lib/iomgr/executor.cc +2 -1
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/executor/threadpool.h +1 -1
- data/src/core/lib/iomgr/iomgr.cc +1 -1
- data/src/core/lib/iomgr/load_file.h +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +19 -14
- data/src/core/lib/iomgr/lockfree_event.h +2 -2
- data/src/core/lib/iomgr/parse_address.cc +52 -46
- data/src/core/lib/iomgr/parse_address.h +13 -9
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +1 -1
- data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
- data/src/core/lib/iomgr/python_util.h +1 -1
- data/src/core/lib/iomgr/resolve_address.cc +4 -4
- data/src/core/lib/iomgr/resource_quota.cc +4 -4
- data/src/core/lib/iomgr/sockaddr_utils.cc +10 -10
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_mutator.cc +3 -2
- data/src/core/lib/iomgr/tcp_client.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_custom.cc +7 -6
- data/src/core/lib/iomgr/tcp_custom.cc +22 -17
- data/src/core/lib/iomgr/tcp_posix.cc +9 -6
- data/src/core/lib/iomgr/tcp_server_custom.cc +28 -22
- data/src/core/lib/iomgr/timer_custom.cc +3 -3
- data/src/core/lib/iomgr/timer_generic.cc +3 -3
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -2
- data/src/core/lib/iomgr/udp_server.h +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +17 -18
- data/src/core/lib/json/json.h +10 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +5 -10
- data/src/core/lib/security/authorization/evaluate_args.h +1 -1
- data/src/core/lib/security/context/security_context.cc +4 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/credentials.cc +6 -6
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +413 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +80 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +15 -10
- data/src/core/lib/security/credentials/external/aws_request_signer.h +1 -2
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +217 -31
- data/src/core/lib/security/credentials/external/external_account_credentials.h +7 -5
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +5 -6
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -4
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +20 -18
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +5 -6
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +18 -12
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +18 -5
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +37 -44
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +5 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +1 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +1 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +326 -5
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +64 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +0 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
- data/src/core/lib/security/credentials/tls/tls_utils.cc +91 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +38 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +140 -10
- data/src/core/lib/security/credentials/xds/xds_credentials.h +27 -9
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +46 -13
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +23 -6
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +3 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -19
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +57 -12
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +2 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +2 -2
- data/src/core/lib/slice/slice_intern.cc +4 -5
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/surface/call.cc +32 -24
- data/src/core/lib/surface/call_details.cc +8 -8
- data/src/core/lib/surface/channel.cc +16 -10
- data/src/core/lib/surface/channel.h +3 -2
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +23 -18
- data/src/core/lib/surface/completion_queue.h +16 -16
- data/src/core/lib/surface/init.cc +6 -5
- data/src/core/lib/surface/lame_client.cc +20 -46
- data/src/core/lib/surface/lame_client.h +4 -0
- data/src/core/lib/surface/server.cc +59 -15
- data/src/core/lib/surface/server.h +37 -5
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/authority_override.cc +6 -4
- data/src/core/lib/transport/authority_override.h +5 -2
- data/src/core/lib/transport/connectivity_state.h +6 -4
- data/src/core/lib/transport/error_utils.h +1 -1
- data/src/core/lib/transport/metadata_batch.h +4 -4
- data/src/core/lib/transport/static_metadata.cc +1 -1
- data/src/core/lib/transport/status_metadata.cc +4 -3
- data/src/core/lib/transport/transport.h +7 -7
- data/src/core/lib/uri/uri_parser.cc +131 -249
- data/src/core/lib/uri/uri_parser.h +57 -21
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -4
- data/src/core/tsi/alts/crypt/gsec.cc +5 -4
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +23 -23
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
- data/src/core/tsi/fake_transport_security.cc +5 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +62 -49
- data/src/core/tsi/ssl_transport_security.h +6 -6
- data/src/core/tsi/transport_security.cc +6 -6
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +31 -13
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +28 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +399 -0
- data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
- data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
- data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
- data/third_party/upb/upb/decode.c +248 -167
- data/third_party/upb/upb/decode.h +20 -1
- data/third_party/upb/upb/decode.int.h +163 -0
- data/third_party/upb/upb/decode_fast.c +1040 -0
- data/third_party/upb/upb/decode_fast.h +126 -0
- data/third_party/upb/upb/def.c +525 -516
- data/third_party/upb/upb/def.h +16 -31
- data/third_party/upb/upb/def.hpp +37 -123
- data/third_party/upb/upb/encode.c +227 -169
- data/third_party/upb/upb/encode.h +27 -2
- data/third_party/upb/upb/json_decode.c +1443 -0
- data/third_party/upb/upb/json_decode.h +23 -0
- data/third_party/upb/upb/json_encode.c +713 -0
- data/third_party/upb/upb/json_encode.h +36 -0
- data/third_party/upb/upb/msg.c +167 -88
- data/third_party/upb/upb/msg.h +174 -34
- data/third_party/upb/upb/port_def.inc +74 -61
- data/third_party/upb/upb/port_undef.inc +3 -7
- data/third_party/upb/upb/reflection.c +36 -19
- data/third_party/upb/upb/table.c +34 -197
- data/third_party/upb/upb/table.int.h +14 -5
- data/third_party/upb/upb/text_encode.c +45 -22
- data/third_party/upb/upb/text_encode.h +4 -1
- data/third_party/upb/upb/upb.c +18 -41
- data/third_party/upb/upb/upb.h +36 -7
- data/third_party/upb/upb/upb.hpp +4 -4
- data/third_party/upb/upb/upb.int.h +29 -0
- metadata +60 -46
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -909
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -355
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -138
- data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +0 -265
- data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +0 -104
- data/src/core/lib/gprpp/map.h +0 -53
- data/third_party/upb/upb/port.c +0 -26
@@ -0,0 +1,197 @@
|
|
1
|
+
// Copyright 2018 The Abseil 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
|
+
// https://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 ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
|
16
|
+
#define ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
|
17
|
+
|
18
|
+
#include <tuple>
|
19
|
+
#include <type_traits>
|
20
|
+
#include <utility>
|
21
|
+
|
22
|
+
#include "absl/base/internal/throw_delegate.h"
|
23
|
+
#include "absl/container/internal/container_memory.h"
|
24
|
+
#include "absl/container/internal/raw_hash_set.h" // IWYU pragma: export
|
25
|
+
|
26
|
+
namespace absl {
|
27
|
+
ABSL_NAMESPACE_BEGIN
|
28
|
+
namespace container_internal {
|
29
|
+
|
30
|
+
template <class Policy, class Hash, class Eq, class Alloc>
|
31
|
+
class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
32
|
+
// P is Policy. It's passed as a template argument to support maps that have
|
33
|
+
// incomplete types as values, as in unordered_map<K, IncompleteType>.
|
34
|
+
// MappedReference<> may be a non-reference type.
|
35
|
+
template <class P>
|
36
|
+
using MappedReference = decltype(P::value(
|
37
|
+
std::addressof(std::declval<typename raw_hash_map::reference>())));
|
38
|
+
|
39
|
+
// MappedConstReference<> may be a non-reference type.
|
40
|
+
template <class P>
|
41
|
+
using MappedConstReference = decltype(P::value(
|
42
|
+
std::addressof(std::declval<typename raw_hash_map::const_reference>())));
|
43
|
+
|
44
|
+
using KeyArgImpl =
|
45
|
+
KeyArg<IsTransparent<Eq>::value && IsTransparent<Hash>::value>;
|
46
|
+
|
47
|
+
public:
|
48
|
+
using key_type = typename Policy::key_type;
|
49
|
+
using mapped_type = typename Policy::mapped_type;
|
50
|
+
template <class K>
|
51
|
+
using key_arg = typename KeyArgImpl::template type<K, key_type>;
|
52
|
+
|
53
|
+
static_assert(!std::is_reference<key_type>::value, "");
|
54
|
+
// TODO(alkis): remove this assertion and verify that reference mapped_type is
|
55
|
+
// supported.
|
56
|
+
static_assert(!std::is_reference<mapped_type>::value, "");
|
57
|
+
|
58
|
+
using iterator = typename raw_hash_map::raw_hash_set::iterator;
|
59
|
+
using const_iterator = typename raw_hash_map::raw_hash_set::const_iterator;
|
60
|
+
|
61
|
+
raw_hash_map() {}
|
62
|
+
using raw_hash_map::raw_hash_set::raw_hash_set;
|
63
|
+
|
64
|
+
// The last two template parameters ensure that both arguments are rvalues
|
65
|
+
// (lvalue arguments are handled by the overloads below). This is necessary
|
66
|
+
// for supporting bitfield arguments.
|
67
|
+
//
|
68
|
+
// union { int n : 1; };
|
69
|
+
// flat_hash_map<int, int> m;
|
70
|
+
// m.insert_or_assign(n, n);
|
71
|
+
template <class K = key_type, class V = mapped_type, K* = nullptr,
|
72
|
+
V* = nullptr>
|
73
|
+
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, V&& v) {
|
74
|
+
return insert_or_assign_impl(std::forward<K>(k), std::forward<V>(v));
|
75
|
+
}
|
76
|
+
|
77
|
+
template <class K = key_type, class V = mapped_type, K* = nullptr>
|
78
|
+
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, const V& v) {
|
79
|
+
return insert_or_assign_impl(std::forward<K>(k), v);
|
80
|
+
}
|
81
|
+
|
82
|
+
template <class K = key_type, class V = mapped_type, V* = nullptr>
|
83
|
+
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, V&& v) {
|
84
|
+
return insert_or_assign_impl(k, std::forward<V>(v));
|
85
|
+
}
|
86
|
+
|
87
|
+
template <class K = key_type, class V = mapped_type>
|
88
|
+
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, const V& v) {
|
89
|
+
return insert_or_assign_impl(k, v);
|
90
|
+
}
|
91
|
+
|
92
|
+
template <class K = key_type, class V = mapped_type, K* = nullptr,
|
93
|
+
V* = nullptr>
|
94
|
+
iterator insert_or_assign(const_iterator, key_arg<K>&& k, V&& v) {
|
95
|
+
return insert_or_assign(std::forward<K>(k), std::forward<V>(v)).first;
|
96
|
+
}
|
97
|
+
|
98
|
+
template <class K = key_type, class V = mapped_type, K* = nullptr>
|
99
|
+
iterator insert_or_assign(const_iterator, key_arg<K>&& k, const V& v) {
|
100
|
+
return insert_or_assign(std::forward<K>(k), v).first;
|
101
|
+
}
|
102
|
+
|
103
|
+
template <class K = key_type, class V = mapped_type, V* = nullptr>
|
104
|
+
iterator insert_or_assign(const_iterator, const key_arg<K>& k, V&& v) {
|
105
|
+
return insert_or_assign(k, std::forward<V>(v)).first;
|
106
|
+
}
|
107
|
+
|
108
|
+
template <class K = key_type, class V = mapped_type>
|
109
|
+
iterator insert_or_assign(const_iterator, const key_arg<K>& k, const V& v) {
|
110
|
+
return insert_or_assign(k, v).first;
|
111
|
+
}
|
112
|
+
|
113
|
+
// All `try_emplace()` overloads make the same guarantees regarding rvalue
|
114
|
+
// arguments as `std::unordered_map::try_emplace()`, namely that these
|
115
|
+
// functions will not move from rvalue arguments if insertions do not happen.
|
116
|
+
template <class K = key_type, class... Args,
|
117
|
+
typename std::enable_if<
|
118
|
+
!std::is_convertible<K, const_iterator>::value, int>::type = 0,
|
119
|
+
K* = nullptr>
|
120
|
+
std::pair<iterator, bool> try_emplace(key_arg<K>&& k, Args&&... args) {
|
121
|
+
return try_emplace_impl(std::forward<K>(k), std::forward<Args>(args)...);
|
122
|
+
}
|
123
|
+
|
124
|
+
template <class K = key_type, class... Args,
|
125
|
+
typename std::enable_if<
|
126
|
+
!std::is_convertible<K, const_iterator>::value, int>::type = 0>
|
127
|
+
std::pair<iterator, bool> try_emplace(const key_arg<K>& k, Args&&... args) {
|
128
|
+
return try_emplace_impl(k, std::forward<Args>(args)...);
|
129
|
+
}
|
130
|
+
|
131
|
+
template <class K = key_type, class... Args, K* = nullptr>
|
132
|
+
iterator try_emplace(const_iterator, key_arg<K>&& k, Args&&... args) {
|
133
|
+
return try_emplace(std::forward<K>(k), std::forward<Args>(args)...).first;
|
134
|
+
}
|
135
|
+
|
136
|
+
template <class K = key_type, class... Args>
|
137
|
+
iterator try_emplace(const_iterator, const key_arg<K>& k, Args&&... args) {
|
138
|
+
return try_emplace(k, std::forward<Args>(args)...).first;
|
139
|
+
}
|
140
|
+
|
141
|
+
template <class K = key_type, class P = Policy>
|
142
|
+
MappedReference<P> at(const key_arg<K>& key) {
|
143
|
+
auto it = this->find(key);
|
144
|
+
if (it == this->end()) {
|
145
|
+
base_internal::ThrowStdOutOfRange(
|
146
|
+
"absl::container_internal::raw_hash_map<>::at");
|
147
|
+
}
|
148
|
+
return Policy::value(&*it);
|
149
|
+
}
|
150
|
+
|
151
|
+
template <class K = key_type, class P = Policy>
|
152
|
+
MappedConstReference<P> at(const key_arg<K>& key) const {
|
153
|
+
auto it = this->find(key);
|
154
|
+
if (it == this->end()) {
|
155
|
+
base_internal::ThrowStdOutOfRange(
|
156
|
+
"absl::container_internal::raw_hash_map<>::at");
|
157
|
+
}
|
158
|
+
return Policy::value(&*it);
|
159
|
+
}
|
160
|
+
|
161
|
+
template <class K = key_type, class P = Policy, K* = nullptr>
|
162
|
+
MappedReference<P> operator[](key_arg<K>&& key) {
|
163
|
+
return Policy::value(&*try_emplace(std::forward<K>(key)).first);
|
164
|
+
}
|
165
|
+
|
166
|
+
template <class K = key_type, class P = Policy>
|
167
|
+
MappedReference<P> operator[](const key_arg<K>& key) {
|
168
|
+
return Policy::value(&*try_emplace(key).first);
|
169
|
+
}
|
170
|
+
|
171
|
+
private:
|
172
|
+
template <class K, class V>
|
173
|
+
std::pair<iterator, bool> insert_or_assign_impl(K&& k, V&& v) {
|
174
|
+
auto res = this->find_or_prepare_insert(k);
|
175
|
+
if (res.second)
|
176
|
+
this->emplace_at(res.first, std::forward<K>(k), std::forward<V>(v));
|
177
|
+
else
|
178
|
+
Policy::value(&*this->iterator_at(res.first)) = std::forward<V>(v);
|
179
|
+
return {this->iterator_at(res.first), res.second};
|
180
|
+
}
|
181
|
+
|
182
|
+
template <class K = key_type, class... Args>
|
183
|
+
std::pair<iterator, bool> try_emplace_impl(K&& k, Args&&... args) {
|
184
|
+
auto res = this->find_or_prepare_insert(k);
|
185
|
+
if (res.second)
|
186
|
+
this->emplace_at(res.first, std::piecewise_construct,
|
187
|
+
std::forward_as_tuple(std::forward<K>(k)),
|
188
|
+
std::forward_as_tuple(std::forward<Args>(args)...));
|
189
|
+
return {this->iterator_at(res.first), res.second};
|
190
|
+
}
|
191
|
+
};
|
192
|
+
|
193
|
+
} // namespace container_internal
|
194
|
+
ABSL_NAMESPACE_END
|
195
|
+
} // namespace absl
|
196
|
+
|
197
|
+
#endif // ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
|
@@ -0,0 +1,399 @@
|
|
1
|
+
// Copyright 2020 The Abseil 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
|
+
// https://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
|
+
#ifndef ABSL_STATUS_INTERNAL_STATUSOR_INTERNAL_H_
|
15
|
+
#define ABSL_STATUS_INTERNAL_STATUSOR_INTERNAL_H_
|
16
|
+
|
17
|
+
#include <type_traits>
|
18
|
+
#include <utility>
|
19
|
+
|
20
|
+
#include "absl/meta/type_traits.h"
|
21
|
+
#include "absl/status/status.h"
|
22
|
+
#include "absl/utility/utility.h"
|
23
|
+
|
24
|
+
namespace absl {
|
25
|
+
ABSL_NAMESPACE_BEGIN
|
26
|
+
|
27
|
+
template <typename T>
|
28
|
+
class ABSL_MUST_USE_RESULT StatusOr;
|
29
|
+
|
30
|
+
namespace internal_statusor {
|
31
|
+
|
32
|
+
// Detects whether `U` has conversion operator to `StatusOr<T>`, i.e. `operator
|
33
|
+
// StatusOr<T>()`.
|
34
|
+
template <typename T, typename U, typename = void>
|
35
|
+
struct HasConversionOperatorToStatusOr : std::false_type {};
|
36
|
+
|
37
|
+
template <typename T, typename U>
|
38
|
+
void test(char (*)[sizeof(std::declval<U>().operator absl::StatusOr<T>())]);
|
39
|
+
|
40
|
+
template <typename T, typename U>
|
41
|
+
struct HasConversionOperatorToStatusOr<T, U, decltype(test<T, U>(0))>
|
42
|
+
: std::true_type {};
|
43
|
+
|
44
|
+
// Detects whether `T` is constructible or convertible from `StatusOr<U>`.
|
45
|
+
template <typename T, typename U>
|
46
|
+
using IsConstructibleOrConvertibleFromStatusOr =
|
47
|
+
absl::disjunction<std::is_constructible<T, StatusOr<U>&>,
|
48
|
+
std::is_constructible<T, const StatusOr<U>&>,
|
49
|
+
std::is_constructible<T, StatusOr<U>&&>,
|
50
|
+
std::is_constructible<T, const StatusOr<U>&&>,
|
51
|
+
std::is_convertible<StatusOr<U>&, T>,
|
52
|
+
std::is_convertible<const StatusOr<U>&, T>,
|
53
|
+
std::is_convertible<StatusOr<U>&&, T>,
|
54
|
+
std::is_convertible<const StatusOr<U>&&, T>>;
|
55
|
+
|
56
|
+
// Detects whether `T` is constructible or convertible or assignable from
|
57
|
+
// `StatusOr<U>`.
|
58
|
+
template <typename T, typename U>
|
59
|
+
using IsConstructibleOrConvertibleOrAssignableFromStatusOr =
|
60
|
+
absl::disjunction<IsConstructibleOrConvertibleFromStatusOr<T, U>,
|
61
|
+
std::is_assignable<T&, StatusOr<U>&>,
|
62
|
+
std::is_assignable<T&, const StatusOr<U>&>,
|
63
|
+
std::is_assignable<T&, StatusOr<U>&&>,
|
64
|
+
std::is_assignable<T&, const StatusOr<U>&&>>;
|
65
|
+
|
66
|
+
// Detects whether direct initializing `StatusOr<T>` from `U` is ambiguous, i.e.
|
67
|
+
// when `U` is `StatusOr<V>` and `T` is constructible or convertible from `V`.
|
68
|
+
template <typename T, typename U>
|
69
|
+
struct IsDirectInitializationAmbiguous
|
70
|
+
: public absl::conditional_t<
|
71
|
+
std::is_same<absl::remove_cv_t<absl::remove_reference_t<U>>,
|
72
|
+
U>::value,
|
73
|
+
std::false_type,
|
74
|
+
IsDirectInitializationAmbiguous<
|
75
|
+
T, absl::remove_cv_t<absl::remove_reference_t<U>>>> {};
|
76
|
+
|
77
|
+
template <typename T, typename V>
|
78
|
+
struct IsDirectInitializationAmbiguous<T, absl::StatusOr<V>>
|
79
|
+
: public IsConstructibleOrConvertibleFromStatusOr<T, V> {};
|
80
|
+
|
81
|
+
// Checks against the constraints of the direction initialization, i.e. when
|
82
|
+
// `StatusOr<T>::StatusOr(U&&)` should participate in overload resolution.
|
83
|
+
template <typename T, typename U>
|
84
|
+
using IsDirectInitializationValid = absl::disjunction<
|
85
|
+
// Short circuits if T is basically U.
|
86
|
+
std::is_same<T, absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
87
|
+
absl::negation<absl::disjunction<
|
88
|
+
std::is_same<absl::StatusOr<T>,
|
89
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
90
|
+
std::is_same<absl::Status,
|
91
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
92
|
+
std::is_same<absl::in_place_t,
|
93
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
94
|
+
IsDirectInitializationAmbiguous<T, U>>>>;
|
95
|
+
|
96
|
+
// This trait detects whether `StatusOr<T>::operator=(U&&)` is ambiguous, which
|
97
|
+
// is equivalent to whether all the following conditions are met:
|
98
|
+
// 1. `U` is `StatusOr<V>`.
|
99
|
+
// 2. `T` is constructible and assignable from `V`.
|
100
|
+
// 3. `T` is constructible and assignable from `U` (i.e. `StatusOr<V>`).
|
101
|
+
// For example, the following code is considered ambiguous:
|
102
|
+
// (`T` is `bool`, `U` is `StatusOr<bool>`, `V` is `bool`)
|
103
|
+
// StatusOr<bool> s1 = true; // s1.ok() && s1.ValueOrDie() == true
|
104
|
+
// StatusOr<bool> s2 = false; // s2.ok() && s2.ValueOrDie() == false
|
105
|
+
// s1 = s2; // ambiguous, `s1 = s2.ValueOrDie()` or `s1 = bool(s2)`?
|
106
|
+
template <typename T, typename U>
|
107
|
+
struct IsForwardingAssignmentAmbiguous
|
108
|
+
: public absl::conditional_t<
|
109
|
+
std::is_same<absl::remove_cv_t<absl::remove_reference_t<U>>,
|
110
|
+
U>::value,
|
111
|
+
std::false_type,
|
112
|
+
IsForwardingAssignmentAmbiguous<
|
113
|
+
T, absl::remove_cv_t<absl::remove_reference_t<U>>>> {};
|
114
|
+
|
115
|
+
template <typename T, typename U>
|
116
|
+
struct IsForwardingAssignmentAmbiguous<T, absl::StatusOr<U>>
|
117
|
+
: public IsConstructibleOrConvertibleOrAssignableFromStatusOr<T, U> {};
|
118
|
+
|
119
|
+
// Checks against the constraints of the forwarding assignment, i.e. whether
|
120
|
+
// `StatusOr<T>::operator(U&&)` should participate in overload resolution.
|
121
|
+
template <typename T, typename U>
|
122
|
+
using IsForwardingAssignmentValid = absl::disjunction<
|
123
|
+
// Short circuits if T is basically U.
|
124
|
+
std::is_same<T, absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
125
|
+
absl::negation<absl::disjunction<
|
126
|
+
std::is_same<absl::StatusOr<T>,
|
127
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
128
|
+
std::is_same<absl::Status,
|
129
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
130
|
+
std::is_same<absl::in_place_t,
|
131
|
+
absl::remove_cv_t<absl::remove_reference_t<U>>>,
|
132
|
+
IsForwardingAssignmentAmbiguous<T, U>>>>;
|
133
|
+
|
134
|
+
class Helper {
|
135
|
+
public:
|
136
|
+
// Move type-agnostic error handling to the .cc.
|
137
|
+
static void HandleInvalidStatusCtorArg(Status*);
|
138
|
+
static void Crash(const absl::Status& status);
|
139
|
+
};
|
140
|
+
|
141
|
+
// Construct an instance of T in `p` through placement new, passing Args... to
|
142
|
+
// the constructor.
|
143
|
+
// This abstraction is here mostly for the gcc performance fix.
|
144
|
+
template <typename T, typename... Args>
|
145
|
+
void PlacementNew(void* p, Args&&... args) {
|
146
|
+
#if defined(__GNUC__) && !defined(__clang__)
|
147
|
+
// Teach gcc that 'p' cannot be null, fixing code size issues.
|
148
|
+
if (p == nullptr) __builtin_unreachable();
|
149
|
+
#endif
|
150
|
+
new (p) T(std::forward<Args>(args)...);
|
151
|
+
}
|
152
|
+
|
153
|
+
// Helper base class to hold the data and all operations.
|
154
|
+
// We move all this to a base class to allow mixing with the appropriate
|
155
|
+
// TraitsBase specialization.
|
156
|
+
template <typename T>
|
157
|
+
class StatusOrData {
|
158
|
+
template <typename U>
|
159
|
+
friend class StatusOrData;
|
160
|
+
|
161
|
+
public:
|
162
|
+
StatusOrData() = delete;
|
163
|
+
|
164
|
+
StatusOrData(const StatusOrData& other) {
|
165
|
+
if (other.ok()) {
|
166
|
+
MakeValue(other.data_);
|
167
|
+
MakeStatus();
|
168
|
+
} else {
|
169
|
+
MakeStatus(other.status_);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
StatusOrData(StatusOrData&& other) noexcept {
|
174
|
+
if (other.ok()) {
|
175
|
+
MakeValue(std::move(other.data_));
|
176
|
+
MakeStatus();
|
177
|
+
} else {
|
178
|
+
MakeStatus(std::move(other.status_));
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
template <typename U>
|
183
|
+
explicit StatusOrData(const StatusOrData<U>& other) {
|
184
|
+
if (other.ok()) {
|
185
|
+
MakeValue(other.data_);
|
186
|
+
MakeStatus();
|
187
|
+
} else {
|
188
|
+
MakeStatus(other.status_);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
template <typename U>
|
193
|
+
explicit StatusOrData(StatusOrData<U>&& other) {
|
194
|
+
if (other.ok()) {
|
195
|
+
MakeValue(std::move(other.data_));
|
196
|
+
MakeStatus();
|
197
|
+
} else {
|
198
|
+
MakeStatus(std::move(other.status_));
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
template <typename... Args>
|
203
|
+
explicit StatusOrData(absl::in_place_t, Args&&... args)
|
204
|
+
: data_(std::forward<Args>(args)...) {
|
205
|
+
MakeStatus();
|
206
|
+
}
|
207
|
+
|
208
|
+
explicit StatusOrData(const T& value) : data_(value) {
|
209
|
+
MakeStatus();
|
210
|
+
}
|
211
|
+
explicit StatusOrData(T&& value) : data_(std::move(value)) {
|
212
|
+
MakeStatus();
|
213
|
+
}
|
214
|
+
|
215
|
+
template <typename U,
|
216
|
+
absl::enable_if_t<std::is_constructible<absl::Status, U&&>::value,
|
217
|
+
int> = 0>
|
218
|
+
explicit StatusOrData(U&& v) : status_(v) {
|
219
|
+
EnsureNotOk();
|
220
|
+
}
|
221
|
+
|
222
|
+
StatusOrData& operator=(const StatusOrData& other) {
|
223
|
+
if (this == &other) return *this;
|
224
|
+
if (other.ok())
|
225
|
+
Assign(other.data_);
|
226
|
+
else
|
227
|
+
AssignStatus(other.status_);
|
228
|
+
return *this;
|
229
|
+
}
|
230
|
+
|
231
|
+
StatusOrData& operator=(StatusOrData&& other) {
|
232
|
+
if (this == &other) return *this;
|
233
|
+
if (other.ok())
|
234
|
+
Assign(std::move(other.data_));
|
235
|
+
else
|
236
|
+
AssignStatus(std::move(other.status_));
|
237
|
+
return *this;
|
238
|
+
}
|
239
|
+
|
240
|
+
~StatusOrData() {
|
241
|
+
if (ok()) {
|
242
|
+
status_.~Status();
|
243
|
+
data_.~T();
|
244
|
+
} else {
|
245
|
+
status_.~Status();
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
template <typename U>
|
250
|
+
void Assign(U&& value) {
|
251
|
+
if (ok()) {
|
252
|
+
data_ = std::forward<U>(value);
|
253
|
+
} else {
|
254
|
+
MakeValue(std::forward<U>(value));
|
255
|
+
status_ = OkStatus();
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
template <typename U>
|
260
|
+
void AssignStatus(U&& v) {
|
261
|
+
Clear();
|
262
|
+
status_ = static_cast<absl::Status>(std::forward<U>(v));
|
263
|
+
EnsureNotOk();
|
264
|
+
}
|
265
|
+
|
266
|
+
bool ok() const { return status_.ok(); }
|
267
|
+
|
268
|
+
protected:
|
269
|
+
// status_ will always be active after the constructor.
|
270
|
+
// We make it a union to be able to initialize exactly how we need without
|
271
|
+
// waste.
|
272
|
+
// Eg. in the copy constructor we use the default constructor of Status in
|
273
|
+
// the ok() path to avoid an extra Ref call.
|
274
|
+
union {
|
275
|
+
Status status_;
|
276
|
+
};
|
277
|
+
|
278
|
+
// data_ is active iff status_.ok()==true
|
279
|
+
struct Dummy {};
|
280
|
+
union {
|
281
|
+
// When T is const, we need some non-const object we can cast to void* for
|
282
|
+
// the placement new. dummy_ is that object.
|
283
|
+
Dummy dummy_;
|
284
|
+
T data_;
|
285
|
+
};
|
286
|
+
|
287
|
+
void Clear() {
|
288
|
+
if (ok()) data_.~T();
|
289
|
+
}
|
290
|
+
|
291
|
+
void EnsureOk() const {
|
292
|
+
if (ABSL_PREDICT_FALSE(!ok())) Helper::Crash(status_);
|
293
|
+
}
|
294
|
+
|
295
|
+
void EnsureNotOk() {
|
296
|
+
if (ABSL_PREDICT_FALSE(ok())) Helper::HandleInvalidStatusCtorArg(&status_);
|
297
|
+
}
|
298
|
+
|
299
|
+
// Construct the value (ie. data_) through placement new with the passed
|
300
|
+
// argument.
|
301
|
+
template <typename... Arg>
|
302
|
+
void MakeValue(Arg&&... arg) {
|
303
|
+
internal_statusor::PlacementNew<T>(&dummy_, std::forward<Arg>(arg)...);
|
304
|
+
}
|
305
|
+
|
306
|
+
// Construct the status (ie. status_) through placement new with the passed
|
307
|
+
// argument.
|
308
|
+
template <typename... Args>
|
309
|
+
void MakeStatus(Args&&... args) {
|
310
|
+
internal_statusor::PlacementNew<Status>(&status_,
|
311
|
+
std::forward<Args>(args)...);
|
312
|
+
}
|
313
|
+
};
|
314
|
+
|
315
|
+
// Helper base classes to allow implicitly deleted constructors and assignment
|
316
|
+
// operators in `StatusOr`. For example, `CopyCtorBase` will explicitly delete
|
317
|
+
// the copy constructor when T is not copy constructible and `StatusOr` will
|
318
|
+
// inherit that behavior implicitly.
|
319
|
+
template <typename T, bool = std::is_copy_constructible<T>::value>
|
320
|
+
struct CopyCtorBase {
|
321
|
+
CopyCtorBase() = default;
|
322
|
+
CopyCtorBase(const CopyCtorBase&) = default;
|
323
|
+
CopyCtorBase(CopyCtorBase&&) = default;
|
324
|
+
CopyCtorBase& operator=(const CopyCtorBase&) = default;
|
325
|
+
CopyCtorBase& operator=(CopyCtorBase&&) = default;
|
326
|
+
};
|
327
|
+
|
328
|
+
template <typename T>
|
329
|
+
struct CopyCtorBase<T, false> {
|
330
|
+
CopyCtorBase() = default;
|
331
|
+
CopyCtorBase(const CopyCtorBase&) = delete;
|
332
|
+
CopyCtorBase(CopyCtorBase&&) = default;
|
333
|
+
CopyCtorBase& operator=(const CopyCtorBase&) = default;
|
334
|
+
CopyCtorBase& operator=(CopyCtorBase&&) = default;
|
335
|
+
};
|
336
|
+
|
337
|
+
template <typename T, bool = std::is_move_constructible<T>::value>
|
338
|
+
struct MoveCtorBase {
|
339
|
+
MoveCtorBase() = default;
|
340
|
+
MoveCtorBase(const MoveCtorBase&) = default;
|
341
|
+
MoveCtorBase(MoveCtorBase&&) = default;
|
342
|
+
MoveCtorBase& operator=(const MoveCtorBase&) = default;
|
343
|
+
MoveCtorBase& operator=(MoveCtorBase&&) = default;
|
344
|
+
};
|
345
|
+
|
346
|
+
template <typename T>
|
347
|
+
struct MoveCtorBase<T, false> {
|
348
|
+
MoveCtorBase() = default;
|
349
|
+
MoveCtorBase(const MoveCtorBase&) = default;
|
350
|
+
MoveCtorBase(MoveCtorBase&&) = delete;
|
351
|
+
MoveCtorBase& operator=(const MoveCtorBase&) = default;
|
352
|
+
MoveCtorBase& operator=(MoveCtorBase&&) = default;
|
353
|
+
};
|
354
|
+
|
355
|
+
template <typename T, bool = std::is_copy_constructible<T>::value&&
|
356
|
+
std::is_copy_assignable<T>::value>
|
357
|
+
struct CopyAssignBase {
|
358
|
+
CopyAssignBase() = default;
|
359
|
+
CopyAssignBase(const CopyAssignBase&) = default;
|
360
|
+
CopyAssignBase(CopyAssignBase&&) = default;
|
361
|
+
CopyAssignBase& operator=(const CopyAssignBase&) = default;
|
362
|
+
CopyAssignBase& operator=(CopyAssignBase&&) = default;
|
363
|
+
};
|
364
|
+
|
365
|
+
template <typename T>
|
366
|
+
struct CopyAssignBase<T, false> {
|
367
|
+
CopyAssignBase() = default;
|
368
|
+
CopyAssignBase(const CopyAssignBase&) = default;
|
369
|
+
CopyAssignBase(CopyAssignBase&&) = default;
|
370
|
+
CopyAssignBase& operator=(const CopyAssignBase&) = delete;
|
371
|
+
CopyAssignBase& operator=(CopyAssignBase&&) = default;
|
372
|
+
};
|
373
|
+
|
374
|
+
template <typename T, bool = std::is_move_constructible<T>::value&&
|
375
|
+
std::is_move_assignable<T>::value>
|
376
|
+
struct MoveAssignBase {
|
377
|
+
MoveAssignBase() = default;
|
378
|
+
MoveAssignBase(const MoveAssignBase&) = default;
|
379
|
+
MoveAssignBase(MoveAssignBase&&) = default;
|
380
|
+
MoveAssignBase& operator=(const MoveAssignBase&) = default;
|
381
|
+
MoveAssignBase& operator=(MoveAssignBase&&) = default;
|
382
|
+
};
|
383
|
+
|
384
|
+
template <typename T>
|
385
|
+
struct MoveAssignBase<T, false> {
|
386
|
+
MoveAssignBase() = default;
|
387
|
+
MoveAssignBase(const MoveAssignBase&) = default;
|
388
|
+
MoveAssignBase(MoveAssignBase&&) = default;
|
389
|
+
MoveAssignBase& operator=(const MoveAssignBase&) = default;
|
390
|
+
MoveAssignBase& operator=(MoveAssignBase&&) = delete;
|
391
|
+
};
|
392
|
+
|
393
|
+
ABSL_ATTRIBUTE_NORETURN void ThrowBadStatusOrAccess(absl::Status status);
|
394
|
+
|
395
|
+
} // namespace internal_statusor
|
396
|
+
ABSL_NAMESPACE_END
|
397
|
+
} // namespace absl
|
398
|
+
|
399
|
+
#endif // ABSL_STATUS_INTERNAL_STATUSOR_INTERNAL_H_
|