grpc 1.19.0 → 1.20.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 +4131 -7903
- data/include/grpc/grpc.h +11 -6
- data/include/grpc/grpc_security.h +51 -9
- data/include/grpc/impl/codegen/byte_buffer.h +13 -0
- data/include/grpc/impl/codegen/grpc_types.h +4 -0
- data/include/grpc/impl/codegen/port_platform.h +37 -6
- data/include/grpc/impl/codegen/sync_posix.h +18 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +560 -236
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +2 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +22 -34
- data/src/core/ext/filters/client_channel/client_channel_factory.h +19 -38
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +7 -4
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.cc +105 -28
- data/src/core/ext/filters/client_channel/lb_policy.h +259 -141
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +29 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +789 -803
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +2 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +8 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +127 -219
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +103 -282
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +709 -906
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +0 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +8 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -6
- data/src/core/ext/filters/client_channel/resolver.cc +54 -1
- data/src/core/ext/filters/client_channel/resolver.h +51 -22
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +34 -86
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +29 -41
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +32 -78
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +109 -72
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +13 -8
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +28 -63
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -1
- data/src/core/ext/filters/client_channel/resolver_registry.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver_registry.h +5 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +69 -49
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +11 -8
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +568 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +141 -0
- data/src/core/ext/filters/client_channel/server_address.cc +0 -48
- data/src/core/ext/filters/client_channel/server_address.h +0 -10
- data/src/core/{lib/transport → ext/filters/client_channel}/service_config.cc +10 -5
- data/src/core/{lib/transport → ext/filters/client_channel}/service_config.h +16 -12
- data/src/core/ext/filters/client_channel/subchannel.cc +11 -16
- data/src/core/ext/filters/client_channel/subchannel.h +3 -0
- data/src/core/ext/filters/max_age/max_age_filter.cc +4 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +2 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +45 -45
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +133 -134
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +37 -29
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +9 -5
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +6 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +5 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +9 -9
- data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +8 -0
- data/src/core/lib/channel/channel_args.cc +2 -0
- data/src/core/lib/channel/channel_args.h +3 -0
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channel_trace.h +4 -4
- data/src/core/lib/channel/channelz.cc +32 -19
- data/src/core/lib/channel/channelz.h +4 -4
- data/src/core/lib/channel/channelz_registry.cc +1 -1
- data/src/core/lib/channel/context.h +0 -3
- data/src/core/lib/channel/handshaker_registry.cc +7 -3
- data/src/core/lib/compression/algorithm_metadata.h +3 -3
- data/src/core/lib/compression/compression.cc +1 -1
- data/src/core/lib/compression/compression_internal.cc +2 -2
- data/src/core/lib/compression/stream_compression_gzip.cc +1 -1
- data/src/core/lib/debug/trace.h +2 -1
- data/src/core/lib/gpr/cpu_posix.cc +5 -3
- data/src/core/lib/gpr/sync_posix.cc +65 -4
- data/src/core/lib/gprpp/atomic.h +75 -5
- data/src/core/lib/gprpp/fork.cc +0 -2
- data/src/core/lib/gprpp/orphanable.h +3 -2
- data/src/core/lib/gprpp/ref_counted.h +9 -11
- data/src/core/lib/gprpp/thd.h +42 -7
- data/src/core/lib/gprpp/thd_posix.cc +31 -13
- data/src/core/lib/gprpp/thd_windows.cc +47 -34
- data/src/core/lib/http/httpcli.cc +3 -2
- data/src/core/lib/http/httpcli_security_connector.cc +0 -1
- data/src/core/lib/http/parser.cc +2 -1
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/endpoint.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/error.cc +9 -9
- data/src/core/lib/iomgr/error.h +4 -3
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +6 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +14 -9
- data/src/core/lib/iomgr/ev_poll_posix.cc +7 -481
- data/src/core/lib/iomgr/ev_posix.cc +7 -3
- data/src/core/lib/iomgr/ev_posix.h +8 -0
- data/src/core/lib/iomgr/executor.cc +13 -0
- data/src/core/lib/iomgr/executor.h +2 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +2 -4
- data/src/core/lib/iomgr/iomgr.cc +5 -0
- data/src/core/lib/iomgr/iomgr.h +7 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +9 -2
- data/src/core/lib/iomgr/iomgr_internal.cc +6 -0
- data/src/core/lib/iomgr/iomgr_internal.h +9 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +10 -2
- data/src/core/lib/iomgr/iomgr_windows.cc +10 -2
- data/src/core/lib/iomgr/port.h +19 -0
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -4
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +158 -54
- data/src/core/lib/iomgr/tcp_windows.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -19
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +10 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -6
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +129 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.h +62 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +28 -17
- data/src/core/lib/security/security_connector/ssl_utils.cc +134 -0
- data/src/core/lib/security/security_connector/ssl_utils.h +32 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +426 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +122 -0
- data/src/core/lib/security/transport/auth_filters.h +2 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +35 -39
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +4 -3
- data/src/core/lib/slice/percent_encoding.cc +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +27 -30
- data/src/core/lib/slice/slice_hash_table.h +2 -2
- data/src/core/lib/slice/slice_intern.cc +1 -1
- data/src/core/lib/slice/slice_internal.h +14 -3
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -4
- data/src/core/lib/surface/byte_buffer_reader.cc +17 -0
- data/src/core/lib/surface/call.cc +8 -3
- data/src/core/lib/surface/completion_queue.cc +134 -148
- data/src/core/lib/surface/init.cc +78 -30
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/lame_client.cc +4 -6
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/metadata.cc +66 -33
- data/src/core/lib/transport/metadata_batch.cc +1 -1
- data/src/core/lib/transport/metadata_batch.h +1 -1
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -1
- data/src/core/lib/transport/transport.h +4 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +1 -5
- data/src/core/tsi/ssl_transport_security.h +24 -4
- data/src/ruby/bin/math_pb.rb +18 -16
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +13 -10
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +18 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +58 -56
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -0
- data/third_party/cares/cares/ares.h +12 -0
- data/third_party/cares/cares/ares_create_query.c +5 -1
- data/third_party/cares/cares/ares_data.c +74 -73
- data/third_party/cares/cares/ares_destroy.c +6 -1
- data/third_party/cares/cares/ares_gethostbyaddr.c +5 -5
- data/third_party/cares/cares/ares_gethostbyname.c +15 -4
- data/third_party/cares/cares/ares_getnameinfo.c +11 -0
- data/third_party/cares/cares/ares_init.c +274 -173
- data/third_party/cares/cares/ares_library_init.c +21 -3
- data/third_party/cares/cares/ares_options.c +6 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +7 -6
- data/third_party/cares/cares/ares_parse_ptr_reply.c +4 -2
- data/third_party/cares/cares/ares_platform.c +7 -0
- data/third_party/cares/cares/ares_private.h +19 -11
- data/third_party/cares/cares/ares_process.c +27 -2
- data/third_party/cares/cares/ares_rules.h +1 -1
- data/third_party/cares/cares/ares_search.c +7 -0
- data/third_party/cares/cares/ares_send.c +6 -0
- data/third_party/cares/cares/ares_strsplit.c +174 -0
- data/third_party/cares/cares/ares_strsplit.h +43 -0
- data/third_party/cares/cares/ares_version.h +4 -4
- data/third_party/cares/cares/config-win32.h +1 -1
- data/third_party/cares/cares/inet_ntop.c +2 -3
- data/third_party/cares/config_darwin/ares_config.h +3 -0
- data/third_party/cares/config_freebsd/ares_config.h +3 -0
- data/third_party/cares/config_linux/ares_config.h +3 -0
- data/third_party/cares/config_openbsd/ares_config.h +3 -0
- metadata +39 -37
- data/src/core/ext/filters/client_channel/request_routing.cc +0 -946
- data/src/core/ext/filters/client_channel/request_routing.h +0 -181
- data/src/core/lib/gprpp/atomic_with_atm.h +0 -57
- data/src/core/lib/gprpp/atomic_with_std.h +0 -35
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +0 -107
- data/src/core/lib/iomgr/wakeup_fd_cv.h +0 -69
@@ -1,181 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2018 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_REQUEST_ROUTING_H
|
20
|
-
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_REQUEST_ROUTING_H
|
21
|
-
|
22
|
-
#include <grpc/support/port_platform.h>
|
23
|
-
|
24
|
-
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
25
|
-
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
|
26
|
-
#include "src/core/ext/filters/client_channel/lb_policy.h"
|
27
|
-
#include "src/core/ext/filters/client_channel/resolver.h"
|
28
|
-
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
|
29
|
-
#include "src/core/lib/channel/channel_args.h"
|
30
|
-
#include "src/core/lib/channel/channel_stack.h"
|
31
|
-
#include "src/core/lib/debug/trace.h"
|
32
|
-
#include "src/core/lib/gprpp/inlined_vector.h"
|
33
|
-
#include "src/core/lib/gprpp/orphanable.h"
|
34
|
-
#include "src/core/lib/iomgr/call_combiner.h"
|
35
|
-
#include "src/core/lib/iomgr/closure.h"
|
36
|
-
#include "src/core/lib/iomgr/polling_entity.h"
|
37
|
-
#include "src/core/lib/iomgr/pollset_set.h"
|
38
|
-
#include "src/core/lib/transport/connectivity_state.h"
|
39
|
-
#include "src/core/lib/transport/metadata_batch.h"
|
40
|
-
|
41
|
-
namespace grpc_core {
|
42
|
-
|
43
|
-
class RequestRouter {
|
44
|
-
public:
|
45
|
-
class Request {
|
46
|
-
public:
|
47
|
-
// Synchronous callback that applies the service config to a call.
|
48
|
-
// Returns false if the call should be failed.
|
49
|
-
typedef bool (*ApplyServiceConfigCallback)(void* user_data);
|
50
|
-
|
51
|
-
Request(grpc_call_stack* owning_call, grpc_call_combiner* call_combiner,
|
52
|
-
grpc_polling_entity* pollent,
|
53
|
-
grpc_metadata_batch* send_initial_metadata,
|
54
|
-
uint32_t* send_initial_metadata_flags,
|
55
|
-
ApplyServiceConfigCallback apply_service_config,
|
56
|
-
void* apply_service_config_user_data, grpc_closure* on_route_done);
|
57
|
-
|
58
|
-
~Request();
|
59
|
-
|
60
|
-
// TODO(roth): It seems a bit ugly to expose this member in a
|
61
|
-
// non-const way. Find a better API to avoid this.
|
62
|
-
LoadBalancingPolicy::PickState* pick() { return &pick_; }
|
63
|
-
|
64
|
-
private:
|
65
|
-
friend class RequestRouter;
|
66
|
-
|
67
|
-
class ResolverResultWaiter;
|
68
|
-
class AsyncPickCanceller;
|
69
|
-
|
70
|
-
void ProcessServiceConfigAndStartLbPickLocked();
|
71
|
-
void StartLbPickLocked();
|
72
|
-
static void LbPickDoneLocked(void* arg, grpc_error* error);
|
73
|
-
|
74
|
-
void MaybeAddCallToInterestedPartiesLocked();
|
75
|
-
void MaybeRemoveCallFromInterestedPartiesLocked();
|
76
|
-
|
77
|
-
// Populated by caller.
|
78
|
-
grpc_call_stack* owning_call_;
|
79
|
-
grpc_call_combiner* call_combiner_;
|
80
|
-
grpc_polling_entity* pollent_;
|
81
|
-
ApplyServiceConfigCallback apply_service_config_;
|
82
|
-
void* apply_service_config_user_data_;
|
83
|
-
grpc_closure* on_route_done_;
|
84
|
-
LoadBalancingPolicy::PickState pick_;
|
85
|
-
|
86
|
-
// Internal state.
|
87
|
-
RequestRouter* request_router_ = nullptr;
|
88
|
-
bool pollent_added_to_interested_parties_ = false;
|
89
|
-
grpc_closure on_pick_done_;
|
90
|
-
AsyncPickCanceller* pick_canceller_ = nullptr;
|
91
|
-
};
|
92
|
-
|
93
|
-
// Synchronous callback that takes the service config JSON string and
|
94
|
-
// LB policy name.
|
95
|
-
// Returns true if the service config has changed since the last result.
|
96
|
-
typedef bool (*ProcessResolverResultCallback)(void* user_data,
|
97
|
-
const grpc_channel_args& args,
|
98
|
-
const char** lb_policy_name,
|
99
|
-
grpc_json** lb_policy_config);
|
100
|
-
|
101
|
-
RequestRouter(grpc_channel_stack* owning_stack, grpc_combiner* combiner,
|
102
|
-
grpc_client_channel_factory* client_channel_factory,
|
103
|
-
grpc_pollset_set* interested_parties, TraceFlag* tracer,
|
104
|
-
ProcessResolverResultCallback process_resolver_result,
|
105
|
-
void* process_resolver_result_user_data, const char* target_uri,
|
106
|
-
const grpc_channel_args* args, grpc_error** error);
|
107
|
-
|
108
|
-
~RequestRouter();
|
109
|
-
|
110
|
-
void set_channelz_node(channelz::ClientChannelNode* channelz_node) {
|
111
|
-
channelz_node_ = channelz_node;
|
112
|
-
}
|
113
|
-
|
114
|
-
void RouteCallLocked(Request* request);
|
115
|
-
|
116
|
-
// TODO(roth): Add methods to cancel picks.
|
117
|
-
|
118
|
-
void ShutdownLocked(grpc_error* error);
|
119
|
-
|
120
|
-
void ExitIdleLocked();
|
121
|
-
void ResetConnectionBackoffLocked();
|
122
|
-
|
123
|
-
grpc_connectivity_state GetConnectivityState();
|
124
|
-
void NotifyOnConnectivityStateChange(grpc_connectivity_state* state,
|
125
|
-
grpc_closure* closure);
|
126
|
-
|
127
|
-
LoadBalancingPolicy* lb_policy() const { return lb_policy_.get(); }
|
128
|
-
|
129
|
-
private:
|
130
|
-
using TraceStringVector = InlinedVector<char*, 3>;
|
131
|
-
|
132
|
-
class ReresolutionRequestHandler;
|
133
|
-
class LbConnectivityWatcher;
|
134
|
-
|
135
|
-
void StartResolvingLocked();
|
136
|
-
void OnResolverShutdownLocked(grpc_error* error);
|
137
|
-
void CreateNewLbPolicyLocked(const char* lb_policy_name, grpc_json* lb_config,
|
138
|
-
grpc_connectivity_state* connectivity_state,
|
139
|
-
grpc_error** connectivity_error,
|
140
|
-
TraceStringVector* trace_strings);
|
141
|
-
void MaybeAddTraceMessagesForAddressChangesLocked(
|
142
|
-
TraceStringVector* trace_strings);
|
143
|
-
void ConcatenateAndAddChannelTraceLocked(
|
144
|
-
TraceStringVector* trace_strings) const;
|
145
|
-
static void OnResolverResultChangedLocked(void* arg, grpc_error* error);
|
146
|
-
|
147
|
-
void SetConnectivityStateLocked(grpc_connectivity_state state,
|
148
|
-
grpc_error* error, const char* reason);
|
149
|
-
|
150
|
-
// Passed in from caller at construction time.
|
151
|
-
grpc_channel_stack* owning_stack_;
|
152
|
-
grpc_combiner* combiner_;
|
153
|
-
grpc_client_channel_factory* client_channel_factory_;
|
154
|
-
grpc_pollset_set* interested_parties_;
|
155
|
-
TraceFlag* tracer_;
|
156
|
-
|
157
|
-
channelz::ClientChannelNode* channelz_node_ = nullptr;
|
158
|
-
|
159
|
-
// Resolver and associated state.
|
160
|
-
OrphanablePtr<Resolver> resolver_;
|
161
|
-
ProcessResolverResultCallback process_resolver_result_;
|
162
|
-
void* process_resolver_result_user_data_;
|
163
|
-
bool started_resolving_ = false;
|
164
|
-
grpc_channel_args* resolver_result_ = nullptr;
|
165
|
-
bool previous_resolution_contained_addresses_ = false;
|
166
|
-
grpc_closure_list waiting_for_resolver_result_closures_;
|
167
|
-
grpc_closure on_resolver_result_changed_;
|
168
|
-
|
169
|
-
// LB policy and associated state.
|
170
|
-
OrphanablePtr<LoadBalancingPolicy> lb_policy_;
|
171
|
-
bool exit_idle_when_lb_policy_arrives_ = false;
|
172
|
-
|
173
|
-
// Subchannel pool to pass to LB policy.
|
174
|
-
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
|
175
|
-
|
176
|
-
grpc_connectivity_state_tracker state_tracker_;
|
177
|
-
};
|
178
|
-
|
179
|
-
} // namespace grpc_core
|
180
|
-
|
181
|
-
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_REQUEST_ROUTING_H */
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2017 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_ATM_H
|
20
|
-
#define GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_ATM_H
|
21
|
-
|
22
|
-
#include <grpc/support/port_platform.h>
|
23
|
-
|
24
|
-
#include <grpc/support/atm.h>
|
25
|
-
|
26
|
-
namespace grpc_core {
|
27
|
-
|
28
|
-
enum MemoryOrderRelaxed { memory_order_relaxed };
|
29
|
-
|
30
|
-
template <class T>
|
31
|
-
class atomic;
|
32
|
-
|
33
|
-
template <>
|
34
|
-
class atomic<bool> {
|
35
|
-
public:
|
36
|
-
atomic() { gpr_atm_no_barrier_store(&x_, static_cast<gpr_atm>(false)); }
|
37
|
-
explicit atomic(bool x) {
|
38
|
-
gpr_atm_no_barrier_store(&x_, static_cast<gpr_atm>(x));
|
39
|
-
}
|
40
|
-
|
41
|
-
bool compare_exchange_strong(bool& expected, bool update, MemoryOrderRelaxed,
|
42
|
-
MemoryOrderRelaxed) {
|
43
|
-
if (!gpr_atm_no_barrier_cas(&x_, static_cast<gpr_atm>(expected),
|
44
|
-
static_cast<gpr_atm>(update))) {
|
45
|
-
expected = gpr_atm_no_barrier_load(&x_) != 0;
|
46
|
-
return false;
|
47
|
-
}
|
48
|
-
return true;
|
49
|
-
}
|
50
|
-
|
51
|
-
private:
|
52
|
-
gpr_atm x_;
|
53
|
-
};
|
54
|
-
|
55
|
-
} // namespace grpc_core
|
56
|
-
|
57
|
-
#endif /* GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_ATM_H */
|
@@ -1,35 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2017 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#ifndef GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_STD_H
|
20
|
-
#define GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_STD_H
|
21
|
-
|
22
|
-
#include <grpc/support/port_platform.h>
|
23
|
-
|
24
|
-
#include <atomic>
|
25
|
-
|
26
|
-
namespace grpc_core {
|
27
|
-
|
28
|
-
template <class T>
|
29
|
-
using atomic = std::atomic<T>;
|
30
|
-
|
31
|
-
typedef std::memory_order memory_order;
|
32
|
-
|
33
|
-
} // namespace grpc_core
|
34
|
-
|
35
|
-
#endif /* GRPC_CORE_LIB_GPRPP_ATOMIC_WITH_STD_H */
|
@@ -1,107 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2016 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#include <grpc/support/port_platform.h>
|
20
|
-
|
21
|
-
#include "src/core/lib/iomgr/port.h"
|
22
|
-
|
23
|
-
#ifdef GRPC_POSIX_WAKEUP_FD
|
24
|
-
|
25
|
-
#include "src/core/lib/iomgr/wakeup_fd_cv.h"
|
26
|
-
|
27
|
-
#include <errno.h>
|
28
|
-
#include <string.h>
|
29
|
-
|
30
|
-
#include <grpc/support/alloc.h>
|
31
|
-
#include <grpc/support/log.h>
|
32
|
-
#include <grpc/support/sync.h>
|
33
|
-
#include <grpc/support/time.h>
|
34
|
-
|
35
|
-
#include "src/core/lib/gpr/useful.h"
|
36
|
-
#include "src/core/lib/gprpp/thd.h"
|
37
|
-
|
38
|
-
#define MAX_TABLE_RESIZE 256
|
39
|
-
|
40
|
-
extern grpc_cv_fd_table g_cvfds;
|
41
|
-
|
42
|
-
static grpc_error* cv_fd_init(grpc_wakeup_fd* fd_info) {
|
43
|
-
unsigned int i, newsize;
|
44
|
-
int idx;
|
45
|
-
gpr_mu_lock(&g_cvfds.mu);
|
46
|
-
if (!g_cvfds.free_fds) {
|
47
|
-
newsize = GPR_MIN(g_cvfds.size * 2, g_cvfds.size + MAX_TABLE_RESIZE);
|
48
|
-
g_cvfds.cvfds = static_cast<grpc_fd_node*>(
|
49
|
-
gpr_realloc(g_cvfds.cvfds, sizeof(grpc_fd_node) * newsize));
|
50
|
-
for (i = g_cvfds.size; i < newsize; i++) {
|
51
|
-
g_cvfds.cvfds[i].is_set = 0;
|
52
|
-
g_cvfds.cvfds[i].cvs = nullptr;
|
53
|
-
g_cvfds.cvfds[i].next_free = g_cvfds.free_fds;
|
54
|
-
g_cvfds.free_fds = &g_cvfds.cvfds[i];
|
55
|
-
}
|
56
|
-
g_cvfds.size = newsize;
|
57
|
-
}
|
58
|
-
|
59
|
-
idx = static_cast<int>(g_cvfds.free_fds - g_cvfds.cvfds);
|
60
|
-
g_cvfds.free_fds = g_cvfds.free_fds->next_free;
|
61
|
-
g_cvfds.cvfds[idx].cvs = nullptr;
|
62
|
-
g_cvfds.cvfds[idx].is_set = 0;
|
63
|
-
fd_info->read_fd = GRPC_IDX_TO_FD(idx);
|
64
|
-
fd_info->write_fd = -1;
|
65
|
-
gpr_mu_unlock(&g_cvfds.mu);
|
66
|
-
return GRPC_ERROR_NONE;
|
67
|
-
}
|
68
|
-
|
69
|
-
static grpc_error* cv_fd_wakeup(grpc_wakeup_fd* fd_info) {
|
70
|
-
grpc_cv_node* cvn;
|
71
|
-
gpr_mu_lock(&g_cvfds.mu);
|
72
|
-
g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)].is_set = 1;
|
73
|
-
cvn = g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)].cvs;
|
74
|
-
while (cvn) {
|
75
|
-
gpr_cv_signal(cvn->cv);
|
76
|
-
cvn = cvn->next;
|
77
|
-
}
|
78
|
-
gpr_mu_unlock(&g_cvfds.mu);
|
79
|
-
return GRPC_ERROR_NONE;
|
80
|
-
}
|
81
|
-
|
82
|
-
static grpc_error* cv_fd_consume(grpc_wakeup_fd* fd_info) {
|
83
|
-
gpr_mu_lock(&g_cvfds.mu);
|
84
|
-
g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)].is_set = 0;
|
85
|
-
gpr_mu_unlock(&g_cvfds.mu);
|
86
|
-
return GRPC_ERROR_NONE;
|
87
|
-
}
|
88
|
-
|
89
|
-
static void cv_fd_destroy(grpc_wakeup_fd* fd_info) {
|
90
|
-
if (fd_info->read_fd == 0) {
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
gpr_mu_lock(&g_cvfds.mu);
|
94
|
-
// Assert that there are no active pollers
|
95
|
-
GPR_ASSERT(!g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)].cvs);
|
96
|
-
g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)].next_free = g_cvfds.free_fds;
|
97
|
-
g_cvfds.free_fds = &g_cvfds.cvfds[GRPC_FD_TO_IDX(fd_info->read_fd)];
|
98
|
-
gpr_mu_unlock(&g_cvfds.mu);
|
99
|
-
}
|
100
|
-
|
101
|
-
static int cv_check_availability(void) { return 1; }
|
102
|
-
|
103
|
-
const grpc_wakeup_fd_vtable grpc_cv_wakeup_fd_vtable = {
|
104
|
-
cv_fd_init, cv_fd_consume, cv_fd_wakeup, cv_fd_destroy,
|
105
|
-
cv_check_availability};
|
106
|
-
|
107
|
-
#endif /* GRPC_POSIX_WAKUP_FD */
|
@@ -1,69 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2016 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
/*
|
20
|
-
* wakeup_fd_cv uses condition variables to implement wakeup fds.
|
21
|
-
*
|
22
|
-
* It is intended for use only in cases when eventfd() and pipe() are not
|
23
|
-
* available. It can only be used with the "poll" engine.
|
24
|
-
*
|
25
|
-
* Implementation:
|
26
|
-
* A global table of cv wakeup fds is mantained. A cv wakeup fd is a negative
|
27
|
-
* file descriptor. poll() is then run in a background thread with only the
|
28
|
-
* real socket fds while we wait on a condition variable trigged by either the
|
29
|
-
* poll() completion or a wakeup_fd() call.
|
30
|
-
*
|
31
|
-
*/
|
32
|
-
|
33
|
-
#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_CV_H
|
34
|
-
#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_CV_H
|
35
|
-
|
36
|
-
#include <grpc/support/port_platform.h>
|
37
|
-
|
38
|
-
#include <grpc/support/sync.h>
|
39
|
-
|
40
|
-
#include "src/core/lib/iomgr/ev_posix.h"
|
41
|
-
|
42
|
-
#define GRPC_FD_TO_IDX(fd) (-(fd)-1)
|
43
|
-
#define GRPC_IDX_TO_FD(idx) (-(idx)-1)
|
44
|
-
|
45
|
-
typedef struct grpc_cv_node {
|
46
|
-
gpr_cv* cv;
|
47
|
-
struct grpc_cv_node* next;
|
48
|
-
struct grpc_cv_node* prev;
|
49
|
-
} grpc_cv_node;
|
50
|
-
|
51
|
-
typedef struct grpc_fd_node {
|
52
|
-
int is_set;
|
53
|
-
grpc_cv_node* cvs;
|
54
|
-
struct grpc_fd_node* next_free;
|
55
|
-
} grpc_fd_node;
|
56
|
-
|
57
|
-
typedef struct grpc_cv_fd_table {
|
58
|
-
gpr_mu mu;
|
59
|
-
gpr_refcount pollcount;
|
60
|
-
gpr_cv shutdown_cv;
|
61
|
-
grpc_fd_node* cvfds;
|
62
|
-
grpc_fd_node* free_fds;
|
63
|
-
unsigned int size;
|
64
|
-
grpc_poll_function_type poll;
|
65
|
-
} grpc_cv_fd_table;
|
66
|
-
|
67
|
-
extern const grpc_wakeup_fd_vtable grpc_cv_wakeup_fd_vtable;
|
68
|
-
|
69
|
-
#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_CV_H */
|