grpc 1.49.1 → 1.50.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 +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +33 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +112 -96
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +84 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +13 -15
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +1 -1
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +1 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +33 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
@@ -19,7 +19,6 @@
|
|
19
19
|
#include <stddef.h>
|
20
20
|
#include <stdint.h>
|
21
21
|
|
22
|
-
#include <algorithm>
|
23
22
|
#include <atomic>
|
24
23
|
#include <map>
|
25
24
|
#include <memory>
|
@@ -32,7 +31,6 @@
|
|
32
31
|
#include "absl/status/status.h"
|
33
32
|
#include "absl/status/statusor.h"
|
34
33
|
#include "absl/strings/str_cat.h"
|
35
|
-
#include "absl/strings/str_join.h"
|
36
34
|
#include "absl/strings/string_view.h"
|
37
35
|
#include "absl/types/optional.h"
|
38
36
|
#include "absl/types/variant.h"
|
@@ -44,21 +42,24 @@
|
|
44
42
|
#include "src/core/ext/filters/client_channel/lb_policy/xds/xds.h"
|
45
43
|
#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h"
|
46
44
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
45
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
47
46
|
#include "src/core/ext/xds/xds_client.h"
|
48
47
|
#include "src/core/ext/xds/xds_client_grpc.h"
|
49
48
|
#include "src/core/ext/xds/xds_client_stats.h"
|
50
49
|
#include "src/core/ext/xds/xds_endpoint.h"
|
51
50
|
#include "src/core/lib/channel/channel_args.h"
|
51
|
+
#include "src/core/lib/config/core_configuration.h"
|
52
52
|
#include "src/core/lib/debug/trace.h"
|
53
|
-
#include "src/core/lib/gpr/string.h"
|
54
53
|
#include "src/core/lib/gprpp/debug_location.h"
|
55
54
|
#include "src/core/lib/gprpp/orphanable.h"
|
56
55
|
#include "src/core/lib/gprpp/ref_counted.h"
|
57
56
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
58
57
|
#include "src/core/lib/gprpp/sync.h"
|
59
|
-
#include "src/core/lib/
|
58
|
+
#include "src/core/lib/gprpp/validation_errors.h"
|
60
59
|
#include "src/core/lib/iomgr/pollset_set.h"
|
61
60
|
#include "src/core/lib/json/json.h"
|
61
|
+
#include "src/core/lib/json/json_args.h"
|
62
|
+
#include "src/core/lib/json/json_object_loader.h"
|
62
63
|
#include "src/core/lib/load_balancing/lb_policy.h"
|
63
64
|
#include "src/core/lib/load_balancing/lb_policy_factory.h"
|
64
65
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
@@ -105,7 +106,8 @@ class CircuitBreakerCallCounterMap {
|
|
105
106
|
std::map<Key, CallCounter*> map_ ABSL_GUARDED_BY(mu_);
|
106
107
|
};
|
107
108
|
|
108
|
-
CircuitBreakerCallCounterMap* g_call_counter_map =
|
109
|
+
CircuitBreakerCallCounterMap* const g_call_counter_map =
|
110
|
+
new CircuitBreakerCallCounterMap;
|
109
111
|
|
110
112
|
RefCountedPtr<CircuitBreakerCallCounterMap::CallCounter>
|
111
113
|
CircuitBreakerCallCounterMap::GetOrCreate(const std::string& cluster,
|
@@ -143,18 +145,13 @@ constexpr absl::string_view kXdsClusterImpl = "xds_cluster_impl_experimental";
|
|
143
145
|
// Config for xDS Cluster Impl LB policy.
|
144
146
|
class XdsClusterImplLbConfig : public LoadBalancingPolicy::Config {
|
145
147
|
public:
|
146
|
-
XdsClusterImplLbConfig(
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
cluster_name_(std::move(cluster_name)),
|
154
|
-
eds_service_name_(std::move(eds_service_name)),
|
155
|
-
lrs_load_reporting_server_(std::move(lrs_load_reporting_server)),
|
156
|
-
max_concurrent_requests_(max_concurrent_requests),
|
157
|
-
drop_config_(std::move(drop_config)) {}
|
148
|
+
XdsClusterImplLbConfig() = default;
|
149
|
+
|
150
|
+
XdsClusterImplLbConfig(const XdsClusterImplLbConfig&) = delete;
|
151
|
+
XdsClusterImplLbConfig& operator=(const XdsClusterImplLbConfig&) = delete;
|
152
|
+
|
153
|
+
XdsClusterImplLbConfig(XdsClusterImplLbConfig&& other) = delete;
|
154
|
+
XdsClusterImplLbConfig& operator=(XdsClusterImplLbConfig&& other) = delete;
|
158
155
|
|
159
156
|
absl::string_view name() const override { return kXdsClusterImpl; }
|
160
157
|
|
@@ -163,8 +160,8 @@ class XdsClusterImplLbConfig : public LoadBalancingPolicy::Config {
|
|
163
160
|
}
|
164
161
|
const std::string& cluster_name() const { return cluster_name_; }
|
165
162
|
const std::string& eds_service_name() const { return eds_service_name_; }
|
166
|
-
const absl::optional<
|
167
|
-
|
163
|
+
const absl::optional<GrpcXdsBootstrap::GrpcXdsServer>&
|
164
|
+
lrs_load_reporting_server() const {
|
168
165
|
return lrs_load_reporting_server_;
|
169
166
|
};
|
170
167
|
uint32_t max_concurrent_requests() const { return max_concurrent_requests_; }
|
@@ -172,11 +169,15 @@ class XdsClusterImplLbConfig : public LoadBalancingPolicy::Config {
|
|
172
169
|
return drop_config_;
|
173
170
|
}
|
174
171
|
|
172
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
|
173
|
+
void JsonPostLoad(const Json& json, const JsonArgs& args,
|
174
|
+
ValidationErrors* errors);
|
175
|
+
|
175
176
|
private:
|
176
177
|
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_;
|
177
178
|
std::string cluster_name_;
|
178
179
|
std::string eds_service_name_;
|
179
|
-
absl::optional<
|
180
|
+
absl::optional<GrpcXdsBootstrap::GrpcXdsServer> lrs_load_reporting_server_;
|
180
181
|
uint32_t max_concurrent_requests_;
|
181
182
|
RefCountedPtr<XdsEndpointResource::DropConfig> drop_config_;
|
182
183
|
};
|
@@ -188,7 +189,7 @@ class XdsClusterImplLb : public LoadBalancingPolicy {
|
|
188
189
|
|
189
190
|
absl::string_view name() const override { return kXdsClusterImpl; }
|
190
191
|
|
191
|
-
|
192
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
192
193
|
void ExitIdleLocked() override;
|
193
194
|
void ResetBackoffLocked() override;
|
194
195
|
|
@@ -266,9 +267,9 @@ class XdsClusterImplLb : public LoadBalancingPolicy {
|
|
266
267
|
|
267
268
|
OrphanablePtr<LoadBalancingPolicy> CreateChildPolicyLocked(
|
268
269
|
const ChannelArgs& args);
|
269
|
-
|
270
|
-
|
271
|
-
|
270
|
+
absl::Status UpdateChildPolicyLocked(
|
271
|
+
absl::StatusOr<ServerAddressList> addresses, std::string resolution_note,
|
272
|
+
const ChannelArgs& args);
|
272
273
|
|
273
274
|
void MaybeUpdatePickerLocked();
|
274
275
|
|
@@ -480,7 +481,7 @@ void XdsClusterImplLb::ResetBackoffLocked() {
|
|
480
481
|
if (child_policy_ != nullptr) child_policy_->ResetBackoffLocked();
|
481
482
|
}
|
482
483
|
|
483
|
-
|
484
|
+
absl::Status XdsClusterImplLb::UpdateLocked(UpdateArgs args) {
|
484
485
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_cluster_impl_lb_trace)) {
|
485
486
|
gpr_log(GPR_INFO, "[xds_cluster_impl_lb %p] Received update", this);
|
486
487
|
}
|
@@ -499,7 +500,8 @@ void XdsClusterImplLb::UpdateLocked(UpdateArgs args) {
|
|
499
500
|
"[xds_cluster_impl_lb %p] Failed to get cluster drop stats for "
|
500
501
|
"LRS server %s, cluster %s, EDS service name %s, load "
|
501
502
|
"reporting for drops will not be done.",
|
502
|
-
this,
|
503
|
+
this,
|
504
|
+
config_->lrs_load_reporting_server()->server_uri().c_str(),
|
503
505
|
config_->cluster_name().c_str(),
|
504
506
|
config_->eds_service_name().c_str());
|
505
507
|
}
|
@@ -521,8 +523,8 @@ void XdsClusterImplLb::UpdateLocked(UpdateArgs args) {
|
|
521
523
|
MaybeUpdatePickerLocked();
|
522
524
|
}
|
523
525
|
// Update child policy.
|
524
|
-
UpdateChildPolicyLocked(std::move(args.addresses),
|
525
|
-
|
526
|
+
return UpdateChildPolicyLocked(std::move(args.addresses),
|
527
|
+
std::move(args.resolution_note), args.args);
|
526
528
|
}
|
527
529
|
|
528
530
|
void XdsClusterImplLb::MaybeUpdatePickerLocked() {
|
@@ -578,7 +580,7 @@ OrphanablePtr<LoadBalancingPolicy> XdsClusterImplLb::CreateChildPolicyLocked(
|
|
578
580
|
return lb_policy;
|
579
581
|
}
|
580
582
|
|
581
|
-
|
583
|
+
absl::Status XdsClusterImplLb::UpdateChildPolicyLocked(
|
582
584
|
absl::StatusOr<ServerAddressList> addresses, std::string resolution_note,
|
583
585
|
const ChannelArgs& args) {
|
584
586
|
// Create policy if needed.
|
@@ -598,7 +600,7 @@ void XdsClusterImplLb::UpdateChildPolicyLocked(
|
|
598
600
|
"[xds_cluster_impl_lb %p] Updating child policy handler %p", this,
|
599
601
|
child_policy_.get());
|
600
602
|
}
|
601
|
-
child_policy_->UpdateLocked(std::move(update_args));
|
603
|
+
return child_policy_->UpdateLocked(std::move(update_args));
|
602
604
|
}
|
603
605
|
|
604
606
|
//
|
@@ -638,7 +640,8 @@ RefCountedPtr<SubchannelInterface> XdsClusterImplLb::Helper::CreateSubchannel(
|
|
638
640
|
"not be generated (not wrapping subchannel)",
|
639
641
|
this,
|
640
642
|
xds_cluster_impl_policy_->config_->lrs_load_reporting_server()
|
641
|
-
->server_uri
|
643
|
+
->server_uri()
|
644
|
+
.c_str(),
|
642
645
|
xds_cluster_impl_policy_->config_->cluster_name().c_str(),
|
643
646
|
xds_cluster_impl_policy_->config_->eds_service_name().c_str());
|
644
647
|
}
|
@@ -688,6 +691,71 @@ void XdsClusterImplLb::Helper::AddTraceEvent(TraceSeverity severity,
|
|
688
691
|
// factory
|
689
692
|
//
|
690
693
|
|
694
|
+
struct DropCategory {
|
695
|
+
std::string category;
|
696
|
+
uint32_t requests_per_million;
|
697
|
+
|
698
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&) {
|
699
|
+
static const auto* loader =
|
700
|
+
JsonObjectLoader<DropCategory>()
|
701
|
+
.Field("category", &DropCategory::category)
|
702
|
+
.Field("requests_per_million", &DropCategory::requests_per_million)
|
703
|
+
.Finish();
|
704
|
+
return loader;
|
705
|
+
}
|
706
|
+
};
|
707
|
+
|
708
|
+
const JsonLoaderInterface* XdsClusterImplLbConfig::JsonLoader(const JsonArgs&) {
|
709
|
+
static const auto* loader =
|
710
|
+
JsonObjectLoader<XdsClusterImplLbConfig>()
|
711
|
+
// Note: Some fields require custom processing, so they are
|
712
|
+
// handled in JsonPostLoad() instead.
|
713
|
+
.Field("clusterName", &XdsClusterImplLbConfig::cluster_name_)
|
714
|
+
.OptionalField("edsServiceName",
|
715
|
+
&XdsClusterImplLbConfig::eds_service_name_)
|
716
|
+
.OptionalField("lrsLoadReportingServer",
|
717
|
+
&XdsClusterImplLbConfig::lrs_load_reporting_server_)
|
718
|
+
.OptionalField("maxConcurrentRequests",
|
719
|
+
&XdsClusterImplLbConfig::max_concurrent_requests_)
|
720
|
+
.Finish();
|
721
|
+
return loader;
|
722
|
+
}
|
723
|
+
|
724
|
+
void XdsClusterImplLbConfig::JsonPostLoad(const Json& json,
|
725
|
+
const JsonArgs& args,
|
726
|
+
ValidationErrors* errors) {
|
727
|
+
// Parse "childPolicy" field.
|
728
|
+
{
|
729
|
+
ValidationErrors::ScopedField field(errors, ".childPolicy");
|
730
|
+
auto it = json.object_value().find("childPolicy");
|
731
|
+
if (it == json.object_value().end()) {
|
732
|
+
errors->AddError("field not present");
|
733
|
+
} else {
|
734
|
+
auto lb_config = CoreConfiguration::Get()
|
735
|
+
.lb_policy_registry()
|
736
|
+
.ParseLoadBalancingConfig(it->second);
|
737
|
+
if (!lb_config.ok()) {
|
738
|
+
errors->AddError(lb_config.status().message());
|
739
|
+
} else {
|
740
|
+
child_policy_ = std::move(*lb_config);
|
741
|
+
}
|
742
|
+
}
|
743
|
+
}
|
744
|
+
// Parse "dropCategories" field.
|
745
|
+
{
|
746
|
+
auto value = LoadJsonObjectField<std::vector<DropCategory>>(
|
747
|
+
json.object_value(), args, "dropCategories", errors);
|
748
|
+
if (value.has_value()) {
|
749
|
+
drop_config_ = MakeRefCounted<XdsEndpointResource::DropConfig>();
|
750
|
+
for (size_t i = 0; i < value->size(); ++i) {
|
751
|
+
DropCategory& drop_category = (*value)[i];
|
752
|
+
drop_config_->AddCategory(std::move(drop_category.category),
|
753
|
+
drop_category.requests_per_million);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
}
|
757
|
+
}
|
758
|
+
|
691
759
|
class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
692
760
|
public:
|
693
761
|
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
@@ -716,165 +784,17 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|
716
784
|
"configuration. Please use loadBalancingConfig field of service "
|
717
785
|
"config instead.");
|
718
786
|
}
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
auto it = json.object_value().find("childPolicy");
|
723
|
-
if (it == json.object_value().end()) {
|
724
|
-
errors.emplace_back("field:childPolicy error:required field missing");
|
725
|
-
} else {
|
726
|
-
auto config =
|
727
|
-
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(it->second);
|
728
|
-
if (!config.ok()) {
|
729
|
-
errors.emplace_back(absl::StrCat("field:childPolicy error:",
|
730
|
-
config.status().message()));
|
731
|
-
} else {
|
732
|
-
child_policy = std::move(*config);
|
733
|
-
}
|
734
|
-
}
|
735
|
-
// Cluster name.
|
736
|
-
std::string cluster_name;
|
737
|
-
it = json.object_value().find("clusterName");
|
738
|
-
if (it == json.object_value().end()) {
|
739
|
-
errors.emplace_back("field:clusterName error:required field missing");
|
740
|
-
} else if (it->second.type() != Json::Type::STRING) {
|
741
|
-
errors.emplace_back("field:clusterName error:type should be string");
|
742
|
-
} else {
|
743
|
-
cluster_name = it->second.string_value();
|
744
|
-
}
|
745
|
-
// EDS service name.
|
746
|
-
std::string eds_service_name;
|
747
|
-
it = json.object_value().find("edsServiceName");
|
748
|
-
if (it != json.object_value().end()) {
|
749
|
-
if (it->second.type() != Json::Type::STRING) {
|
750
|
-
errors.emplace_back("field:edsServiceName error:type should be string");
|
751
|
-
} else {
|
752
|
-
eds_service_name = it->second.string_value();
|
753
|
-
}
|
754
|
-
}
|
755
|
-
// LRS load reporting server name.
|
756
|
-
absl::optional<XdsBootstrap::XdsServer> lrs_load_reporting_server;
|
757
|
-
it = json.object_value().find("lrsLoadReportingServer");
|
758
|
-
if (it != json.object_value().end()) {
|
759
|
-
if (it->second.type() != Json::Type::OBJECT) {
|
760
|
-
errors.emplace_back(
|
761
|
-
"field:lrsLoadReportingServer error:type should be object");
|
762
|
-
} else {
|
763
|
-
grpc_error_handle parser_error;
|
764
|
-
lrs_load_reporting_server = XdsBootstrap::XdsServer::Parse(
|
765
|
-
it->second.object_value(), &parser_error);
|
766
|
-
if (!GRPC_ERROR_IS_NONE(parser_error)) {
|
767
|
-
errors.emplace_back(
|
768
|
-
absl::StrCat("error parsing lrs_load_reporting_server: ",
|
769
|
-
grpc_error_std_string(parser_error)));
|
770
|
-
GRPC_ERROR_UNREF(parser_error);
|
771
|
-
}
|
772
|
-
}
|
773
|
-
}
|
774
|
-
// Max concurrent requests.
|
775
|
-
uint32_t max_concurrent_requests = 1024;
|
776
|
-
it = json.object_value().find("maxConcurrentRequests");
|
777
|
-
if (it != json.object_value().end()) {
|
778
|
-
if (it->second.type() != Json::Type::NUMBER) {
|
779
|
-
errors.emplace_back(
|
780
|
-
"field:max_concurrent_requests error:must be of type number");
|
781
|
-
} else {
|
782
|
-
max_concurrent_requests =
|
783
|
-
gpr_parse_nonnegative_int(it->second.string_value().c_str());
|
784
|
-
}
|
785
|
-
}
|
786
|
-
// Drop config.
|
787
|
-
auto drop_config = MakeRefCounted<XdsEndpointResource::DropConfig>();
|
788
|
-
it = json.object_value().find("dropCategories");
|
789
|
-
if (it == json.object_value().end()) {
|
790
|
-
errors.emplace_back("field:dropCategories error:required field missing");
|
791
|
-
} else {
|
792
|
-
absl::Status status = ParseDropCategories(it->second, drop_config.get());
|
793
|
-
if (!status.ok()) errors.emplace_back(status.message());
|
794
|
-
}
|
795
|
-
if (!errors.empty()) {
|
796
|
-
return absl::InvalidArgumentError(absl::StrCat(
|
797
|
-
"errors parseing xds_cluster_impl_experimental LB policy config: [",
|
798
|
-
absl::StrJoin(errors, "; "), "]"));
|
799
|
-
}
|
800
|
-
return MakeRefCounted<XdsClusterImplLbConfig>(
|
801
|
-
std::move(child_policy), std::move(cluster_name),
|
802
|
-
std::move(eds_service_name), std::move(lrs_load_reporting_server),
|
803
|
-
max_concurrent_requests, std::move(drop_config));
|
804
|
-
}
|
805
|
-
|
806
|
-
private:
|
807
|
-
static absl::Status ParseDropCategories(
|
808
|
-
const Json& json, XdsEndpointResource::DropConfig* drop_config) {
|
809
|
-
if (json.type() != Json::Type::ARRAY) {
|
810
|
-
return absl::InvalidArgumentError("dropCategories field is not an array");
|
811
|
-
}
|
812
|
-
std::vector<std::string> errors;
|
813
|
-
for (size_t i = 0; i < json.array_value().size(); ++i) {
|
814
|
-
const Json& entry = json.array_value()[i];
|
815
|
-
absl::Status status = ParseDropCategory(entry, drop_config);
|
816
|
-
if (!status.ok()) {
|
817
|
-
errors.emplace_back(
|
818
|
-
absl::StrCat("error parsing index ", i, ": ", status.message()));
|
819
|
-
}
|
820
|
-
}
|
821
|
-
if (!errors.empty()) {
|
822
|
-
return absl::InvalidArgumentError(
|
823
|
-
absl::StrCat("errors parsing dropCategories field: [",
|
824
|
-
absl::StrJoin(errors, "; "), "]"));
|
825
|
-
}
|
826
|
-
return absl::OkStatus();
|
827
|
-
}
|
828
|
-
|
829
|
-
static absl::Status ParseDropCategory(
|
830
|
-
const Json& json, XdsEndpointResource::DropConfig* drop_config) {
|
831
|
-
if (json.type() != Json::Type::OBJECT) {
|
832
|
-
return absl::InvalidArgumentError(
|
833
|
-
"dropCategories entry is not an object");
|
834
|
-
}
|
835
|
-
std::vector<std::string> errors;
|
836
|
-
std::string category;
|
837
|
-
auto it = json.object_value().find("category");
|
838
|
-
if (it == json.object_value().end()) {
|
839
|
-
errors.emplace_back("\"category\" field not present");
|
840
|
-
} else if (it->second.type() != Json::Type::STRING) {
|
841
|
-
errors.emplace_back("\"category\" field is not a string");
|
842
|
-
} else {
|
843
|
-
category = it->second.string_value();
|
844
|
-
}
|
845
|
-
uint32_t requests_per_million = 0;
|
846
|
-
it = json.object_value().find("requests_per_million");
|
847
|
-
if (it == json.object_value().end()) {
|
848
|
-
errors.emplace_back("\"requests_per_million\" field is not present");
|
849
|
-
} else if (it->second.type() != Json::Type::NUMBER) {
|
850
|
-
errors.emplace_back("\"requests_per_million\" field is not a number");
|
851
|
-
} else {
|
852
|
-
requests_per_million =
|
853
|
-
gpr_parse_nonnegative_int(it->second.string_value().c_str());
|
854
|
-
}
|
855
|
-
if (!errors.empty()) {
|
856
|
-
return absl::InvalidArgumentError(absl::StrJoin(errors, "; "));
|
857
|
-
}
|
858
|
-
drop_config->AddCategory(std::move(category), requests_per_million);
|
859
|
-
return absl::OkStatus();
|
787
|
+
return LoadRefCountedFromJson<XdsClusterImplLbConfig>(
|
788
|
+
json, JsonArgs(),
|
789
|
+
"errors validating xds_cluster_impl LB policy config");
|
860
790
|
}
|
861
791
|
};
|
862
792
|
|
863
793
|
} // namespace
|
864
794
|
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
// Plugin registration
|
869
|
-
//
|
870
|
-
|
871
|
-
void grpc_lb_policy_xds_cluster_impl_init() {
|
872
|
-
grpc_core::g_call_counter_map = new grpc_core::CircuitBreakerCallCounterMap();
|
873
|
-
grpc_core::LoadBalancingPolicyRegistry::Builder::
|
874
|
-
RegisterLoadBalancingPolicyFactory(
|
875
|
-
absl::make_unique<grpc_core::XdsClusterImplLbFactory>());
|
795
|
+
void RegisterXdsClusterImplLbPolicy(CoreConfiguration::Builder* builder) {
|
796
|
+
builder->lb_policy_registry()->RegisterLoadBalancingPolicyFactory(
|
797
|
+
absl::make_unique<XdsClusterImplLbFactory>());
|
876
798
|
}
|
877
799
|
|
878
|
-
|
879
|
-
delete grpc_core::g_call_counter_map;
|
880
|
-
}
|
800
|
+
} // namespace grpc_core
|