GRPC Core  9.0.0
client_channel.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 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_CLIENT_CHANNEL_H
20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H
21 
23 
28 
30 
31 // Channel arg key for server URI string.
32 #define GRPC_ARG_SERVER_URI "grpc.server_uri"
33 
34 /* A client channel is a channel that begins disconnected, and can connect
35  to some endpoint on demand. If that endpoint disconnects, it will be
36  connected to again later.
37 
38  Calls on a disconnected client channel are queued until a connection is
39  established. */
40 
42 
44  grpc_channel_element* elem, int try_to_connect);
45 
48 
49 // Starts a one-time connectivity state watch. When the channel's state
50 // becomes different from *state, sets *state to the new state and
51 // schedules on_complete. The watcher_timer_init callback is invoked as
52 // soon as the watch is actually started (i.e., after hopping into the
53 // client channel combiner). I/O will be serviced via pollent.
54 //
55 // This is intended to be used when starting a watch from outside of C-core
56 // via grpc_channel_watch_connectivity_state(). It should not be used
57 // by other callers.
61  grpc_closure* watcher_timer_init);
62 
63 // Starts and stops a connectivity watch. The watcher will be initially
64 // notified as soon as the state changes from initial_state and then on
65 // every subsequent state change until either the watch is stopped or
66 // it is notified that the state has changed to SHUTDOWN.
67 //
68 // This is intended to be used when starting watches from code inside of
69 // C-core (e.g., for a nested control plane channel for things like xds).
73  watcher);
77 
78 /* Debug helper: pull the subchannel call from a call stack element */
81 
82 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */
Definition: connectivity_state.h:60
Definition: ref_counted_ptr.h:35
Definition: trace.h:61
grpc_closure on_complete
Definition: client_channel.cc:473
grpc_call_element * elem
Definition: client_channel.cc:112
void grpc_client_channel_start_connectivity_watch(grpc_channel_element *elem, grpc_connectivity_state initial_state, grpc_core::OrphanablePtr< grpc_core::AsyncConnectivityStateWatcherInterface > watcher)
Definition: client_channel.cc:4027
grpc_core::TraceFlag grpc_client_channel_trace
int grpc_client_channel_num_external_connectivity_watchers(grpc_channel_element *elem)
Definition: client_channel.cc:4005
grpc_core::RefCountedPtr< grpc_core::SubchannelCall > grpc_client_channel_get_subchannel_call(grpc_call_element *elem)
Definition: client_channel.cc:4043
const grpc_channel_filter grpc_client_channel_filter
Definition: client_channel.cc:3985
void grpc_client_channel_watch_connectivity_state(grpc_channel_element *elem, grpc_polling_entity pollent, grpc_connectivity_state *state, grpc_closure *on_complete, grpc_closure *watcher_timer_init)
Definition: client_channel.cc:4011
grpc_connectivity_state grpc_client_channel_check_connectivity_state(grpc_channel_element *elem, int try_to_connect)
Definition: client_channel.cc:3999
void grpc_client_channel_stop_connectivity_watch(grpc_channel_element *elem, grpc_core::AsyncConnectivityStateWatcherInterface *watcher)
Definition: client_channel.cc:4035
grpc_connectivity_state
Connectivity state of a channel.
Definition: connectivity_state.h:27
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:68
Definition: channel_stack.h:167
Definition: channel_stack.h:159
Definition: channel_stack.h:99
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: polling_entity.h:37