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
@@ -20,6 +20,13 @@
|
|
20
20
|
*
|
21
21
|
* This file is private and must not be included by users!
|
22
22
|
*/
|
23
|
+
|
24
|
+
#if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
25
|
+
(defined(__cplusplus) && __cplusplus >= 201103L) || \
|
26
|
+
(defined(_MSC_VER) && _MSC_VER >= 1900))
|
27
|
+
#error upb requires C99 or C++11 or MSVC >= 2015.
|
28
|
+
#endif
|
29
|
+
|
23
30
|
#include <stdint.h>
|
24
31
|
#include <stddef.h>
|
25
32
|
|
@@ -68,66 +75,21 @@
|
|
68
75
|
#define UPB_UNLIKELY(x) (x)
|
69
76
|
#endif
|
70
77
|
|
71
|
-
/* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler
|
72
|
-
* doesn't provide these preprocessor symbols. */
|
73
|
-
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
74
|
-
#define UPB_BIG_ENDIAN
|
75
|
-
#endif
|
76
|
-
|
77
78
|
/* Macros for function attributes on compilers that support them. */
|
78
79
|
#ifdef __GNUC__
|
79
80
|
#define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
|
80
81
|
#define UPB_NOINLINE __attribute__((noinline))
|
81
82
|
#define UPB_NORETURN __attribute__((__noreturn__))
|
83
|
+
#elif defined(_MSC_VER)
|
84
|
+
#define UPB_NOINLINE
|
85
|
+
#define UPB_FORCEINLINE
|
86
|
+
#define UPB_NORETURN __declspec(noreturn)
|
82
87
|
#else /* !defined(__GNUC__) */
|
83
88
|
#define UPB_FORCEINLINE
|
84
89
|
#define UPB_NOINLINE
|
85
90
|
#define UPB_NORETURN
|
86
91
|
#endif
|
87
92
|
|
88
|
-
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
|
89
|
-
/* C99/C++11 versions. */
|
90
|
-
#include <stdio.h>
|
91
|
-
#define _upb_snprintf snprintf
|
92
|
-
#define _upb_vsnprintf vsnprintf
|
93
|
-
#define _upb_va_copy(a, b) va_copy(a, b)
|
94
|
-
#elif defined(_MSC_VER)
|
95
|
-
/* Microsoft C/C++ versions. */
|
96
|
-
#include <stdarg.h>
|
97
|
-
#include <stdio.h>
|
98
|
-
#if _MSC_VER < 1900
|
99
|
-
int msvc_snprintf(char* s, size_t n, const char* format, ...);
|
100
|
-
int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg);
|
101
|
-
#define UPB_MSVC_VSNPRINTF
|
102
|
-
#define _upb_snprintf msvc_snprintf
|
103
|
-
#define _upb_vsnprintf msvc_vsnprintf
|
104
|
-
#else
|
105
|
-
#define _upb_snprintf snprintf
|
106
|
-
#define _upb_vsnprintf vsnprintf
|
107
|
-
#endif
|
108
|
-
#define _upb_va_copy(a, b) va_copy(a, b)
|
109
|
-
#elif defined __GNUC__
|
110
|
-
/* A few hacky workarounds for functions not in C89.
|
111
|
-
* For internal use only!
|
112
|
-
* TODO(haberman): fix these by including our own implementations, or finding
|
113
|
-
* another workaround.
|
114
|
-
*/
|
115
|
-
#define _upb_snprintf __builtin_snprintf
|
116
|
-
#define _upb_vsnprintf __builtin_vsnprintf
|
117
|
-
#define _upb_va_copy(a, b) __va_copy(a, b)
|
118
|
-
#else
|
119
|
-
#error Need implementations of [v]snprintf and va_copy
|
120
|
-
#endif
|
121
|
-
|
122
|
-
#ifdef __cplusplus
|
123
|
-
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || \
|
124
|
-
(defined(_MSC_VER) && _MSC_VER >= 1900)
|
125
|
-
/* C++11 is present */
|
126
|
-
#else
|
127
|
-
#error upb requires C++11 for C++ support
|
128
|
-
#endif
|
129
|
-
#endif
|
130
|
-
|
131
93
|
#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
|
132
94
|
#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
|
133
95
|
|
@@ -155,25 +117,76 @@ int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg);
|
|
155
117
|
#define UPB_ASSERT(expr) assert(expr)
|
156
118
|
#endif
|
157
119
|
|
158
|
-
/* UPB_ASSERT_DEBUGVAR(): assert that uses functions or variables that only
|
159
|
-
* exist in debug mode. This turns into regular assert. */
|
160
|
-
#define UPB_ASSERT_DEBUGVAR(expr) assert(expr)
|
161
|
-
|
162
120
|
#if defined(__GNUC__) || defined(__clang__)
|
163
121
|
#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
|
164
122
|
#else
|
165
123
|
#define UPB_UNREACHABLE() do { assert(0); } while(0)
|
166
124
|
#endif
|
167
125
|
|
168
|
-
/*
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#define
|
126
|
+
/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
|
127
|
+
#ifdef __APPLE__
|
128
|
+
#define UPB_SETJMP(buf) _setjmp(buf)
|
129
|
+
#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
|
130
|
+
#else
|
131
|
+
#define UPB_SETJMP(buf) setjmp(buf)
|
132
|
+
#define UPB_LONGJMP(buf, val) longjmp(buf, val)
|
133
|
+
#endif
|
134
|
+
|
135
|
+
/* Configure whether fasttable is switched on or not. *************************/
|
136
|
+
|
137
|
+
#if defined(__x86_64__) && defined(__GNUC__)
|
138
|
+
#define UPB_FASTTABLE_SUPPORTED 1
|
139
|
+
#else
|
140
|
+
#define UPB_FASTTABLE_SUPPORTED 0
|
141
|
+
#endif
|
142
|
+
|
143
|
+
/* define UPB_ENABLE_FASTTABLE to force fast table support.
|
144
|
+
* This is useful when we want to ensure we are really getting fasttable,
|
145
|
+
* for example for testing or benchmarking. */
|
146
|
+
#if defined(UPB_ENABLE_FASTTABLE)
|
147
|
+
#if !UPB_FASTTABLE_SUPPORTED
|
148
|
+
#error fasttable is x86-64 + Clang/GCC only
|
149
|
+
#endif
|
150
|
+
#define UPB_FASTTABLE 1
|
151
|
+
/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
|
152
|
+
* This is useful for releasing code that might be used on multiple platforms,
|
153
|
+
* for example the PHP or Ruby C extensions. */
|
154
|
+
#elif defined(UPB_TRY_ENABLE_FASTTABLE)
|
155
|
+
#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
|
172
156
|
#else
|
173
|
-
#define
|
157
|
+
#define UPB_FASTTABLE 0
|
174
158
|
#endif
|
175
|
-
|
176
|
-
|
159
|
+
|
160
|
+
/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
|
161
|
+
* degrade to non-fasttable if we are using UPB_TRY_ENABLE_FASTTABLE. */
|
162
|
+
#if !UPB_FASTTABLE && defined(UPB_TRY_ENABLE_FASTTABLE)
|
163
|
+
#define UPB_FASTTABLE_INIT(...)
|
177
164
|
#else
|
178
|
-
#define
|
165
|
+
#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
|
179
166
|
#endif
|
167
|
+
|
168
|
+
#undef UPB_FASTTABLE_SUPPORTED
|
169
|
+
|
170
|
+
/* ASAN poisoning (for arena) *************************************************/
|
171
|
+
|
172
|
+
#if defined(__SANITIZE_ADDRESS__)
|
173
|
+
#define UPB_ASAN 1
|
174
|
+
#ifdef __cplusplus
|
175
|
+
extern "C" {
|
176
|
+
#endif
|
177
|
+
void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
178
|
+
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
179
|
+
#ifdef __cplusplus
|
180
|
+
} /* extern "C" */
|
181
|
+
#endif
|
182
|
+
#define UPB_POISON_MEMORY_REGION(addr, size) \
|
183
|
+
__asan_poison_memory_region((addr), (size))
|
184
|
+
#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
|
185
|
+
__asan_unpoison_memory_region((addr), (size))
|
186
|
+
#else
|
187
|
+
#define UPB_ASAN 0
|
188
|
+
#define UPB_POISON_MEMORY_REGION(addr, size) \
|
189
|
+
((void)(addr), (void)(size))
|
190
|
+
#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
|
191
|
+
((void)(addr), (void)(size))
|
192
|
+
#endif
|
@@ -18,11 +18,7 @@
|
|
18
18
|
#undef UPB_UNUSED
|
19
19
|
#undef UPB_ASSUME
|
20
20
|
#undef UPB_ASSERT
|
21
|
-
#undef UPB_ASSERT_DEBUGVAR
|
22
21
|
#undef UPB_UNREACHABLE
|
23
|
-
#undef
|
24
|
-
#undef
|
25
|
-
#undef
|
26
|
-
#undef _upb_snprintf
|
27
|
-
#undef _upb_vsnprintf
|
28
|
-
#undef _upb_va_copy
|
22
|
+
#undef UPB_POISON_MEMORY_REGION
|
23
|
+
#undef UPB_UNPOISON_MEMORY_REGION
|
24
|
+
#undef UPB_ASAN
|
@@ -48,6 +48,21 @@ static char _upb_fieldtype_to_mapsize[12] = {
|
|
48
48
|
0, /* UPB_TYPE_BYTES */
|
49
49
|
};
|
50
50
|
|
51
|
+
static const char _upb_fieldtype_to_sizelg2[12] = {
|
52
|
+
0,
|
53
|
+
0, /* UPB_TYPE_BOOL */
|
54
|
+
2, /* UPB_TYPE_FLOAT */
|
55
|
+
2, /* UPB_TYPE_INT32 */
|
56
|
+
2, /* UPB_TYPE_UINT32 */
|
57
|
+
2, /* UPB_TYPE_ENUM */
|
58
|
+
UPB_SIZE(2, 3), /* UPB_TYPE_MESSAGE */
|
59
|
+
3, /* UPB_TYPE_DOUBLE */
|
60
|
+
3, /* UPB_TYPE_INT64 */
|
61
|
+
3, /* UPB_TYPE_UINT64 */
|
62
|
+
UPB_SIZE(3, 4), /* UPB_TYPE_STRING */
|
63
|
+
UPB_SIZE(3, 4), /* UPB_TYPE_BYTES */
|
64
|
+
};
|
65
|
+
|
51
66
|
/** upb_msg *******************************************************************/
|
52
67
|
|
53
68
|
upb_msg *upb_msg_new(const upb_msgdef *m, upb_arena *a) {
|
@@ -81,20 +96,17 @@ bool upb_msg_has(const upb_msg *msg, const upb_fielddef *f) {
|
|
81
96
|
|
82
97
|
const upb_fielddef *upb_msg_whichoneof(const upb_msg *msg,
|
83
98
|
const upb_oneofdef *o) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
oneof_case = _upb_getoneofcase_field(msg, field);
|
96
|
-
|
97
|
-
return oneof_case ? upb_msgdef_itof(m, oneof_case) : NULL;
|
99
|
+
const upb_fielddef *f = upb_oneofdef_field(o, 0);
|
100
|
+
if (upb_oneofdef_issynthetic(o)) {
|
101
|
+
UPB_ASSERT(upb_oneofdef_fieldcount(o) == 1);
|
102
|
+
return upb_msg_has(msg, f) ? f : NULL;
|
103
|
+
} else {
|
104
|
+
const upb_msglayout_field *field = upb_fielddef_layout(f);
|
105
|
+
uint32_t oneof_case = _upb_getoneofcase_field(msg, field);
|
106
|
+
f = oneof_case ? upb_oneofdef_itof(o, oneof_case) : NULL;
|
107
|
+
UPB_ASSERT((f != NULL) == (oneof_case != 0));
|
108
|
+
return f;
|
109
|
+
}
|
98
110
|
}
|
99
111
|
|
100
112
|
upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f) {
|
@@ -124,7 +136,7 @@ upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f) {
|
|
124
136
|
val.double_val = upb_fielddef_defaultdouble(f);
|
125
137
|
break;
|
126
138
|
case UPB_TYPE_BOOL:
|
127
|
-
val.
|
139
|
+
val.bool_val = upb_fielddef_defaultbool(f);
|
128
140
|
break;
|
129
141
|
case UPB_TYPE_STRING:
|
130
142
|
case UPB_TYPE_BYTES:
|
@@ -207,11 +219,12 @@ void upb_msg_clear(upb_msg *msg, const upb_msgdef *m) {
|
|
207
219
|
bool upb_msg_next(const upb_msg *msg, const upb_msgdef *m,
|
208
220
|
const upb_symtab *ext_pool, const upb_fielddef **out_f,
|
209
221
|
upb_msgval *out_val, size_t *iter) {
|
210
|
-
|
222
|
+
int i = *iter;
|
223
|
+
int n = upb_msgdef_fieldcount(m);
|
211
224
|
const upb_msgval zero = {0};
|
212
|
-
const upb_fielddef *f;
|
213
225
|
UPB_UNUSED(ext_pool);
|
214
|
-
while (
|
226
|
+
while (++i < n) {
|
227
|
+
const upb_fielddef *f = upb_msgdef_field(m, i);
|
215
228
|
upb_msgval val = _upb_msg_getraw(msg, f);
|
216
229
|
|
217
230
|
/* Skip field if unset or empty. */
|
@@ -296,7 +309,7 @@ bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth) {
|
|
296
309
|
/** upb_array *****************************************************************/
|
297
310
|
|
298
311
|
upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type) {
|
299
|
-
return _upb_array_new(a, type);
|
312
|
+
return _upb_array_new(a, 4, _upb_fieldtype_to_sizelg2[type]);
|
300
313
|
}
|
301
314
|
|
302
315
|
size_t upb_array_size(const upb_array *arr) {
|
@@ -348,6 +361,10 @@ bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val) {
|
|
348
361
|
return _upb_map_get(map, &key, map->key_size, val, map->val_size);
|
349
362
|
}
|
350
363
|
|
364
|
+
void upb_map_clear(upb_map *map) {
|
365
|
+
_upb_map_clear(map);
|
366
|
+
}
|
367
|
+
|
351
368
|
bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
|
352
369
|
upb_arena *arena) {
|
353
370
|
return _upb_map_set(map, &key, map->key_size, &val, map->val_size, arena);
|
data/third_party/upb/upb/table.c
CHANGED
@@ -4,10 +4,12 @@
|
|
4
4
|
** Implementation is heavily inspired by Lua's ltable.c.
|
5
5
|
*/
|
6
6
|
|
7
|
-
#include "upb/table.int.h"
|
8
|
-
|
9
7
|
#include <string.h>
|
10
8
|
|
9
|
+
#include "third_party/wyhash/wyhash.h"
|
10
|
+
#include "upb/table.int.h"
|
11
|
+
|
12
|
+
/* Must be last. */
|
11
13
|
#include "upb/port_def.inc"
|
12
14
|
|
13
15
|
#define UPB_MAXARRSIZE 16 /* 64k. */
|
@@ -87,11 +89,7 @@ static upb_tabent *mutable_entries(upb_table *t) {
|
|
87
89
|
}
|
88
90
|
|
89
91
|
static bool isfull(upb_table *t) {
|
90
|
-
|
91
|
-
return true;
|
92
|
-
} else {
|
93
|
-
return ((double)(t->count + 1) / upb_table_size(t)) > MAX_LOAD;
|
94
|
-
}
|
92
|
+
return t->count == t->max_count;
|
95
93
|
}
|
96
94
|
|
97
95
|
static bool init(upb_table *t, uint8_t size_lg2, upb_alloc *a) {
|
@@ -100,6 +98,7 @@ static bool init(upb_table *t, uint8_t size_lg2, upb_alloc *a) {
|
|
100
98
|
t->count = 0;
|
101
99
|
t->size_lg2 = size_lg2;
|
102
100
|
t->mask = upb_table_size(t) ? upb_table_size(t) - 1 : 0;
|
101
|
+
t->max_count = upb_table_size(t) * MAX_LOAD;
|
103
102
|
bytes = upb_table_size(t) * sizeof(upb_tabent);
|
104
103
|
if (bytes > 0) {
|
105
104
|
t->entries = upb_malloc(a, bytes);
|
@@ -115,9 +114,17 @@ static void uninit(upb_table *t, upb_alloc *a) {
|
|
115
114
|
upb_free(a, mutable_entries(t));
|
116
115
|
}
|
117
116
|
|
118
|
-
static upb_tabent *emptyent(upb_table *t) {
|
119
|
-
upb_tabent *
|
120
|
-
|
117
|
+
static upb_tabent *emptyent(upb_table *t, upb_tabent *e) {
|
118
|
+
upb_tabent *begin = mutable_entries(t);
|
119
|
+
upb_tabent *end = begin + upb_table_size(t);
|
120
|
+
for (e = e + 1; e < end; e++) {
|
121
|
+
if (upb_tabent_isempty(e)) return e;
|
122
|
+
}
|
123
|
+
for (e = begin; e < end; e++) {
|
124
|
+
if (upb_tabent_isempty(e)) return e;
|
125
|
+
}
|
126
|
+
UPB_ASSERT(false);
|
127
|
+
return NULL;
|
121
128
|
}
|
122
129
|
|
123
130
|
static upb_tabent *getentry_mutable(upb_table *t, uint32_t hash) {
|
@@ -173,11 +180,11 @@ static void insert(upb_table *t, lookupkey_t key, upb_tabkey tabkey,
|
|
173
180
|
our_e->next = NULL;
|
174
181
|
} else {
|
175
182
|
/* Collision. */
|
176
|
-
upb_tabent *new_e = emptyent(t);
|
183
|
+
upb_tabent *new_e = emptyent(t, mainpos_e);
|
177
184
|
/* Head of collider's chain. */
|
178
185
|
upb_tabent *chain = getentry_mutable(t, hashfunc(mainpos_e->key));
|
179
186
|
if (chain == mainpos_e) {
|
180
|
-
/* Existing ent is in its main
|
187
|
+
/* Existing ent is in its main position (it has the same hash as us, and
|
181
188
|
* is the head of our chain). Insert to new ent and append to this chain. */
|
182
189
|
new_e->next = mainpos_e->next;
|
183
190
|
mainpos_e->next = new_e;
|
@@ -268,10 +275,14 @@ static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) {
|
|
268
275
|
return (uintptr_t)str;
|
269
276
|
}
|
270
277
|
|
278
|
+
static uint32_t table_hash(const char *p, size_t n) {
|
279
|
+
return wyhash(p, n, 0, _wyp);
|
280
|
+
}
|
281
|
+
|
271
282
|
static uint32_t strhash(upb_tabkey key) {
|
272
283
|
uint32_t len;
|
273
284
|
char *str = upb_tabstr(key, &len);
|
274
|
-
return
|
285
|
+
return table_hash(str, len);
|
275
286
|
}
|
276
287
|
|
277
288
|
static bool streql(upb_tabkey k1, lookupkey_t k2) {
|
@@ -280,9 +291,14 @@ static bool streql(upb_tabkey k1, lookupkey_t k2) {
|
|
280
291
|
return len == k2.str.len && (len == 0 || memcmp(str, k2.str.str, len) == 0);
|
281
292
|
}
|
282
293
|
|
283
|
-
bool upb_strtable_init2(upb_strtable *t, upb_ctype_t ctype,
|
294
|
+
bool upb_strtable_init2(upb_strtable *t, upb_ctype_t ctype,
|
295
|
+
size_t expected_size, upb_alloc *a) {
|
284
296
|
UPB_UNUSED(ctype); /* TODO(haberman): rm */
|
285
|
-
|
297
|
+
// Multiply by approximate reciprocal of MAX_LOAD (0.85), with pow2 denominator.
|
298
|
+
size_t need_entries = (expected_size + 1) * 1204 / 1024;
|
299
|
+
UPB_ASSERT(need_entries >= expected_size * 0.85);
|
300
|
+
int size_lg2 = _upb_lg2ceil(need_entries);
|
301
|
+
return init(&t->t, size_lg2, a);
|
286
302
|
}
|
287
303
|
|
288
304
|
void upb_strtable_clear(upb_strtable *t) {
|
@@ -333,20 +349,20 @@ bool upb_strtable_insert3(upb_strtable *t, const char *k, size_t len,
|
|
333
349
|
tabkey = strcopy(key, a);
|
334
350
|
if (tabkey == 0) return false;
|
335
351
|
|
336
|
-
hash =
|
352
|
+
hash = table_hash(key.str.str, key.str.len);
|
337
353
|
insert(&t->t, key, tabkey, v, hash, &strhash, &streql);
|
338
354
|
return true;
|
339
355
|
}
|
340
356
|
|
341
357
|
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
|
342
358
|
upb_value *v) {
|
343
|
-
uint32_t hash =
|
359
|
+
uint32_t hash = table_hash(key, len);
|
344
360
|
return lookup(&t->t, strkey2(key, len), v, hash, &streql);
|
345
361
|
}
|
346
362
|
|
347
363
|
bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
|
348
364
|
upb_value *val, upb_alloc *alloc) {
|
349
|
-
uint32_t hash =
|
365
|
+
uint32_t hash = table_hash(key, len);
|
350
366
|
upb_tabkey tabkey;
|
351
367
|
if (rm(&t->t, strkey2(key, len), val, &tabkey, hash, &streql)) {
|
352
368
|
if (alloc) {
|
@@ -699,182 +715,3 @@ bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
|
|
699
715
|
return i1->t == i2->t && i1->index == i2->index &&
|
700
716
|
i1->array_part == i2->array_part;
|
701
717
|
}
|
702
|
-
|
703
|
-
#if defined(UPB_UNALIGNED_READS_OK) || defined(__s390x__)
|
704
|
-
/* -----------------------------------------------------------------------------
|
705
|
-
* MurmurHash2, by Austin Appleby (released as public domain).
|
706
|
-
* Reformatted and C99-ified by Joshua Haberman.
|
707
|
-
* Note - This code makes a few assumptions about how your machine behaves -
|
708
|
-
* 1. We can read a 4-byte value from any address without crashing
|
709
|
-
* 2. sizeof(int) == 4 (in upb this limitation is removed by using uint32_t
|
710
|
-
* And it has a few limitations -
|
711
|
-
* 1. It will not work incrementally.
|
712
|
-
* 2. It will not produce the same results on little-endian and big-endian
|
713
|
-
* machines. */
|
714
|
-
uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) {
|
715
|
-
/* 'm' and 'r' are mixing constants generated offline.
|
716
|
-
* They're not really 'magic', they just happen to work well. */
|
717
|
-
const uint32_t m = 0x5bd1e995;
|
718
|
-
const int32_t r = 24;
|
719
|
-
|
720
|
-
/* Initialize the hash to a 'random' value */
|
721
|
-
uint32_t h = seed ^ len;
|
722
|
-
|
723
|
-
/* Mix 4 bytes at a time into the hash */
|
724
|
-
const uint8_t * data = (const uint8_t *)key;
|
725
|
-
while(len >= 4) {
|
726
|
-
uint32_t k;
|
727
|
-
memcpy(&k, data, sizeof(k));
|
728
|
-
|
729
|
-
k *= m;
|
730
|
-
k ^= k >> r;
|
731
|
-
k *= m;
|
732
|
-
|
733
|
-
h *= m;
|
734
|
-
h ^= k;
|
735
|
-
|
736
|
-
data += 4;
|
737
|
-
len -= 4;
|
738
|
-
}
|
739
|
-
|
740
|
-
/* Handle the last few bytes of the input array */
|
741
|
-
switch(len) {
|
742
|
-
case 3: h ^= data[2] << 16;
|
743
|
-
case 2: h ^= data[1] << 8;
|
744
|
-
case 1: h ^= data[0]; h *= m;
|
745
|
-
};
|
746
|
-
|
747
|
-
/* Do a few final mixes of the hash to ensure the last few
|
748
|
-
* bytes are well-incorporated. */
|
749
|
-
h ^= h >> 13;
|
750
|
-
h *= m;
|
751
|
-
h ^= h >> 15;
|
752
|
-
|
753
|
-
return h;
|
754
|
-
}
|
755
|
-
|
756
|
-
#else /* !UPB_UNALIGNED_READS_OK */
|
757
|
-
|
758
|
-
/* -----------------------------------------------------------------------------
|
759
|
-
* MurmurHashAligned2, by Austin Appleby
|
760
|
-
* Same algorithm as MurmurHash2, but only does aligned reads - should be safer
|
761
|
-
* on certain platforms.
|
762
|
-
* Performance will be lower than MurmurHash2 */
|
763
|
-
|
764
|
-
#define MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
|
765
|
-
|
766
|
-
uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed) {
|
767
|
-
const uint32_t m = 0x5bd1e995;
|
768
|
-
const int32_t r = 24;
|
769
|
-
const uint8_t * data = (const uint8_t *)key;
|
770
|
-
uint32_t h = (uint32_t)(seed ^ len);
|
771
|
-
uint8_t align = (uintptr_t)data & 3;
|
772
|
-
|
773
|
-
if(align && (len >= 4)) {
|
774
|
-
/* Pre-load the temp registers */
|
775
|
-
uint32_t t = 0, d = 0;
|
776
|
-
int32_t sl;
|
777
|
-
int32_t sr;
|
778
|
-
|
779
|
-
switch(align) {
|
780
|
-
case 1: t |= data[2] << 16; /* fallthrough */
|
781
|
-
case 2: t |= data[1] << 8; /* fallthrough */
|
782
|
-
case 3: t |= data[0];
|
783
|
-
}
|
784
|
-
|
785
|
-
t <<= (8 * align);
|
786
|
-
|
787
|
-
data += 4-align;
|
788
|
-
len -= 4-align;
|
789
|
-
|
790
|
-
sl = 8 * (4-align);
|
791
|
-
sr = 8 * align;
|
792
|
-
|
793
|
-
/* Mix */
|
794
|
-
|
795
|
-
while(len >= 4) {
|
796
|
-
uint32_t k;
|
797
|
-
|
798
|
-
d = *(uint32_t *)data;
|
799
|
-
t = (t >> sr) | (d << sl);
|
800
|
-
|
801
|
-
k = t;
|
802
|
-
|
803
|
-
MIX(h,k,m);
|
804
|
-
|
805
|
-
t = d;
|
806
|
-
|
807
|
-
data += 4;
|
808
|
-
len -= 4;
|
809
|
-
}
|
810
|
-
|
811
|
-
/* Handle leftover data in temp registers */
|
812
|
-
|
813
|
-
d = 0;
|
814
|
-
|
815
|
-
if(len >= align) {
|
816
|
-
uint32_t k;
|
817
|
-
|
818
|
-
switch(align) {
|
819
|
-
case 3: d |= data[2] << 16; /* fallthrough */
|
820
|
-
case 2: d |= data[1] << 8; /* fallthrough */
|
821
|
-
case 1: d |= data[0]; /* fallthrough */
|
822
|
-
}
|
823
|
-
|
824
|
-
k = (t >> sr) | (d << sl);
|
825
|
-
MIX(h,k,m);
|
826
|
-
|
827
|
-
data += align;
|
828
|
-
len -= align;
|
829
|
-
|
830
|
-
/* ----------
|
831
|
-
* Handle tail bytes */
|
832
|
-
|
833
|
-
switch(len) {
|
834
|
-
case 3: h ^= data[2] << 16; /* fallthrough */
|
835
|
-
case 2: h ^= data[1] << 8; /* fallthrough */
|
836
|
-
case 1: h ^= data[0]; h *= m; /* fallthrough */
|
837
|
-
};
|
838
|
-
} else {
|
839
|
-
switch(len) {
|
840
|
-
case 3: d |= data[2] << 16; /* fallthrough */
|
841
|
-
case 2: d |= data[1] << 8; /* fallthrough */
|
842
|
-
case 1: d |= data[0]; /* fallthrough */
|
843
|
-
case 0: h ^= (t >> sr) | (d << sl); h *= m;
|
844
|
-
}
|
845
|
-
}
|
846
|
-
|
847
|
-
h ^= h >> 13;
|
848
|
-
h *= m;
|
849
|
-
h ^= h >> 15;
|
850
|
-
|
851
|
-
return h;
|
852
|
-
} else {
|
853
|
-
while(len >= 4) {
|
854
|
-
uint32_t k = *(uint32_t *)data;
|
855
|
-
|
856
|
-
MIX(h,k,m);
|
857
|
-
|
858
|
-
data += 4;
|
859
|
-
len -= 4;
|
860
|
-
}
|
861
|
-
|
862
|
-
/* ----------
|
863
|
-
* Handle tail bytes */
|
864
|
-
|
865
|
-
switch(len) {
|
866
|
-
case 3: h ^= data[2] << 16; /* fallthrough */
|
867
|
-
case 2: h ^= data[1] << 8; /* fallthrough */
|
868
|
-
case 1: h ^= data[0]; h *= m;
|
869
|
-
};
|
870
|
-
|
871
|
-
h ^= h >> 13;
|
872
|
-
h *= m;
|
873
|
-
h ^= h >> 15;
|
874
|
-
|
875
|
-
return h;
|
876
|
-
}
|
877
|
-
}
|
878
|
-
#undef MIX
|
879
|
-
|
880
|
-
#endif /* UPB_UNALIGNED_READS_OK */
|