Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
grpc_core::ClientChannel Class Reference

#include <client_channel.h>

Classes

class  CallData
 
class  ClientChannelControlHelper
 
class  ConnectivityWatcherAdder
 
class  ConnectivityWatcherRemover
 
class  ExternalConnectivityWatcher
 
struct  LbQueuedCall
 
class  LoadBalancedCall
 
struct  ResolverQueuedCall
 
class  ResolverResultHandler
 
class  SubchannelWrapper
 

Public Member Functions

void AddConnectivityWatcher (grpc_connectivity_state initial_state, OrphanablePtr< AsyncConnectivityStateWatcherInterface > watcher)
 
void AddExternalConnectivityWatcher (grpc_polling_entity pollent, grpc_connectivity_state *state, grpc_closure *on_complete, grpc_closure *watcher_timer_init)
 
void CancelExternalConnectivityWatcher (grpc_closure *on_complete)
 
grpc_connectivity_state CheckConnectivityState (bool try_to_connect)
 
OrphanablePtr< LoadBalancedCallCreateLoadBalancedCall (const grpc_call_element_args &args, grpc_polling_entity *pollent, grpc_closure *on_call_destruction_complete, ConfigSelector::CallDispatchController *call_dispatch_controller, bool is_transparent_retry)
 
int NumExternalConnectivityWatchers () const
 
void RemoveConnectivityWatcher (AsyncConnectivityStateWatcherInterface *watcher)
 

Static Public Member Functions

static ClientChannelGetFromChannel (Channel *channel)
 

Static Public Attributes

static const grpc_channel_filter kFilterVtable
 

Private Member Functions

std::unique_ptr< LoadBalancingPolicy::SubchannelPicker > picker_ ABSL_GUARDED_BY (data_plane_mu_)
 
LbQueuedCall *lb_queued_calls_ ABSL_GUARDED_BY (data_plane_mu_)
 
std::map< grpc_closure *, RefCountedPtr< ExternalConnectivityWatcher > > external_watchers_ ABSL_GUARDED_BY (external_watchers_mu_)
 
std::string info_lb_policy_name_ ABSL_GUARDED_BY (info_mu_)
 
std::string info_service_config_json_ ABSL_GUARDED_BY (info_mu_)
 
ResolverQueuedCall *resolver_queued_calls_ ABSL_GUARDED_BY (resolution_mu_)
 
absl::Status resolver_transient_failure_error_ ABSL_GUARDED_BY (resolution_mu_)
 
bool received_service_config_data_ ABSL_GUARDED_BY (resolution_mu_)
 
RefCountedPtr< ServiceConfig > service_config_ ABSL_GUARDED_BY (resolution_mu_)
 
RefCountedPtr< ConfigSelector > config_selector_ ABSL_GUARDED_BY (resolution_mu_)
 
RefCountedPtr< DynamicFilters > dynamic_filters_ ABSL_GUARDED_BY (resolution_mu_)
 
void AddLbQueuedCall (LbQueuedCall *call, grpc_polling_entity *pollent) ABSL_EXCLUSIVE_LOCKS_REQUIRED(data_plane_mu_)
 
void AddResolverQueuedCall (ResolverQueuedCall *call, grpc_polling_entity *pollent) ABSL_EXCLUSIVE_LOCKS_REQUIRED(resolution_mu_)
 
 ClientChannel (grpc_channel_element_args *args, grpc_error_handle *error)
 
OrphanablePtr< LoadBalancingPolicyCreateLbPolicyLocked (const grpc_channel_args &args) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void CreateOrUpdateLbPolicyLocked (RefCountedPtr< LoadBalancingPolicy::Config > lb_policy_config, const absl::optional< std::string > &health_check_service_name, Resolver::Result result) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void CreateResolverLocked () ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void DestroyResolverAndLbPolicyLocked () ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
grpc_error_handle DoPingLocked (grpc_transport_op *op) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void OnResolverErrorLocked (absl::Status status) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void OnResolverResultChangedLocked (Resolver::Result result) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void RemoveLbQueuedCall (LbQueuedCall *to_remove, grpc_polling_entity *pollent) ABSL_EXCLUSIVE_LOCKS_REQUIRED(data_plane_mu_)
 
void RemoveResolverQueuedCall (ResolverQueuedCall *to_remove, grpc_polling_entity *pollent) ABSL_EXCLUSIVE_LOCKS_REQUIRED(resolution_mu_)
 
void StartTransportOpLocked (grpc_transport_op *op) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void TryToConnectLocked () ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void UpdateServiceConfigInControlPlaneLocked (RefCountedPtr< ServiceConfig > service_config, RefCountedPtr< ConfigSelector > config_selector, std::string lb_policy_name) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void UpdateServiceConfigInDataPlaneLocked () ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
void UpdateStateAndPickerLocked (grpc_connectivity_state state, const absl::Status &status, const char *reason, std::unique_ptr< LoadBalancingPolicy::SubchannelPicker > picker) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_)
 
 ~ClientChannel ()
 

Static Private Member Functions

static void Destroy (grpc_channel_element *elem)
 
static void GetChannelInfo (grpc_channel_element *elem, const grpc_channel_info *info)
 
static grpc_error_handle Init (grpc_channel_element *elem, grpc_channel_element_args *args)
 
static void StartTransportOp (grpc_channel_element *elem, grpc_transport_op *op)
 

Private Attributes

const grpc_channel_argschannel_args_
 
channelz::ChannelNodechannelz_node_
 
ClientChannelFactoryclient_channel_factory_
 
Mutex data_plane_mu_
 
const bool deadline_checking_enabled_
 
std::string default_authority_
 
RefCountedPtr< ServiceConfigdefault_service_config_
 
Mutex external_watchers_mu_
 
Mutex info_mu_
 
grpc_pollset_setinterested_parties_
 
grpc_channel_stackowning_stack_
 
Mutex resolution_mu_
 
const size_t service_config_parser_index_
 
std::string uri_to_resolve_
 
std::shared_ptr< WorkSerializerwork_serializer_
 
ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BYwork_serializer_
 
OrphanablePtr< Resolver > resolver_ ABSL_GUARDED_BYwork_serializer_
 
bool previous_resolution_contained_addresses_ ABSL_GUARDED_BY work_serializer_ = false
 
RefCountedPtr< ServiceConfig > saved_service_config_ ABSL_GUARDED_BYwork_serializer_
 
RefCountedPtr< ConfigSelector > saved_config_selector_ ABSL_GUARDED_BYwork_serializer_
 
OrphanablePtr< LoadBalancingPolicy > lb_policy_ ABSL_GUARDED_BYwork_serializer_
 
RefCountedPtr< SubchannelPoolInterface > subchannel_pool_ ABSL_GUARDED_BYwork_serializer_
 
std::map< Subchannel *, int > subchannel_refcount_map_ ABSL_GUARDED_BYwork_serializer_
 
std::set< SubchannelWrapper * > subchannel_wrappers_ ABSL_GUARDED_BYwork_serializer_
 
int keepalive_time_ ABSL_GUARDED_BY work_serializer_ = -1
 
grpc_error_handle disconnect_error_ ABSL_GUARDED_BY work_serializer_
 

Detailed Description

Definition at line 109 of file client_channel.h.

Constructor & Destructor Documentation

◆ ClientChannel()

grpc_core::ClientChannel::ClientChannel ( grpc_channel_element_args args,
grpc_error_handle error 
)
private

Definition at line 1049 of file client_channel.cc.

◆ ~ClientChannel()

grpc_core::ClientChannel::~ClientChannel ( )
private

Definition at line 1137 of file client_channel.cc.

Member Function Documentation

◆ ABSL_GUARDED_BY() [1/11]

std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( data_plane_mu_  )
private

◆ ABSL_GUARDED_BY() [2/11]

LbQueuedCall* lb_queued_calls_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( data_plane_mu_  )
private

◆ ABSL_GUARDED_BY() [3/11]

std::map<grpc_closure*, RefCountedPtr<ExternalConnectivityWatcher> > external_watchers_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( external_watchers_mu_  )
private

◆ ABSL_GUARDED_BY() [4/11]

std::string info_lb_policy_name_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( info_mu_  )
private

◆ ABSL_GUARDED_BY() [5/11]

std::string info_service_config_json_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( info_mu_  )
private

◆ ABSL_GUARDED_BY() [6/11]

ResolverQueuedCall* resolver_queued_calls_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ ABSL_GUARDED_BY() [7/11]

absl::Status resolver_transient_failure_error_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ ABSL_GUARDED_BY() [8/11]

bool received_service_config_data_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ ABSL_GUARDED_BY() [9/11]

RefCountedPtr<ServiceConfig> service_config_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ ABSL_GUARDED_BY() [10/11]

RefCountedPtr<ConfigSelector> config_selector_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ ABSL_GUARDED_BY() [11/11]

RefCountedPtr<DynamicFilters> dynamic_filters_ grpc_core::ClientChannel::ABSL_GUARDED_BY ( resolution_mu_  )
private

◆ AddConnectivityWatcher()

void grpc_core::ClientChannel::AddConnectivityWatcher ( grpc_connectivity_state  initial_state,
OrphanablePtr< AsyncConnectivityStateWatcherInterface watcher 
)

Definition at line 1864 of file client_channel.cc.

◆ AddExternalConnectivityWatcher()

void grpc_core::ClientChannel::AddExternalConnectivityWatcher ( grpc_polling_entity  pollent,
grpc_connectivity_state state,
grpc_closure on_complete,
grpc_closure watcher_timer_init 
)
inline

Definition at line 130 of file client_channel.h.

◆ AddLbQueuedCall()

void grpc_core::ClientChannel::AddLbQueuedCall ( LbQueuedCall call,
grpc_polling_entity pollent 
)
private

Definition at line 1815 of file client_channel.cc.

◆ AddResolverQueuedCall()

void grpc_core::ClientChannel::AddResolverQueuedCall ( ResolverQueuedCall call,
grpc_polling_entity pollent 
)
private

Definition at line 1436 of file client_channel.cc.

◆ CancelExternalConnectivityWatcher()

void grpc_core::ClientChannel::CancelExternalConnectivityWatcher ( grpc_closure on_complete)
inline

Definition at line 140 of file client_channel.h.

◆ CheckConnectivityState()

grpc_connectivity_state grpc_core::ClientChannel::CheckConnectivityState ( bool  try_to_connect)

Definition at line 1848 of file client_channel.cc.

◆ CreateLbPolicyLocked()

OrphanablePtr< LoadBalancingPolicy > grpc_core::ClientChannel::CreateLbPolicyLocked ( const grpc_channel_args args)
private

Definition at line 1417 of file client_channel.cc.

◆ CreateLoadBalancedCall()

OrphanablePtr< ClientChannel::LoadBalancedCall > grpc_core::ClientChannel::CreateLoadBalancedCall ( const grpc_call_element_args args,
grpc_polling_entity pollent,
grpc_closure on_call_destruction_complete,
ConfigSelector::CallDispatchController call_dispatch_controller,
bool  is_transparent_retry 
)

Definition at line 1150 of file client_channel.cc.

◆ CreateOrUpdateLbPolicyLocked()

void grpc_core::ClientChannel::CreateOrUpdateLbPolicyLocked ( RefCountedPtr< LoadBalancingPolicy::Config lb_policy_config,
const absl::optional< std::string > &  health_check_service_name,
Resolver::Result  result 
)
private

Definition at line 1382 of file client_channel.cc.

◆ CreateResolverLocked()

void grpc_core::ClientChannel::CreateResolverLocked ( )
private

Definition at line 1561 of file client_channel.cc.

◆ Destroy()

void grpc_core::ClientChannel::Destroy ( grpc_channel_element elem)
staticprivate

Definition at line 1025 of file client_channel.cc.

◆ DestroyResolverAndLbPolicyLocked()

void grpc_core::ClientChannel::DestroyResolverAndLbPolicyLocked ( )
private

Definition at line 1580 of file client_channel.cc.

◆ DoPingLocked()

grpc_error_handle grpc_core::ClientChannel::DoPingLocked ( grpc_transport_op op)
private

Definition at line 1691 of file client_channel.cc.

◆ GetChannelInfo()

void grpc_core::ClientChannel::GetChannelInfo ( grpc_channel_element elem,
const grpc_channel_info info 
)
staticprivate

Definition at line 1802 of file client_channel.cc.

◆ GetFromChannel()

ClientChannel * grpc_core::ClientChannel::GetFromChannel ( Channel channel)
static

Definition at line 1009 of file client_channel.cc.

◆ Init()

grpc_error_handle grpc_core::ClientChannel::Init ( grpc_channel_element elem,
grpc_channel_element_args args 
)
staticprivate

Definition at line 1016 of file client_channel.cc.

◆ NumExternalConnectivityWatchers()

int grpc_core::ClientChannel::NumExternalConnectivityWatchers ( ) const
inline

Definition at line 145 of file client_channel.h.

◆ OnResolverErrorLocked()

void grpc_core::ClientChannel::OnResolverErrorLocked ( absl::Status  status)
private

Definition at line 1348 of file client_channel.cc.

◆ OnResolverResultChangedLocked()

void grpc_core::ClientChannel::OnResolverResultChangedLocked ( Resolver::Result  result)
private

Definition at line 1222 of file client_channel.cc.

◆ RemoveConnectivityWatcher()

void grpc_core::ClientChannel::RemoveConnectivityWatcher ( AsyncConnectivityStateWatcherInterface watcher)

Definition at line 1870 of file client_channel.cc.

◆ RemoveLbQueuedCall()

void grpc_core::ClientChannel::RemoveLbQueuedCall ( LbQueuedCall to_remove,
grpc_polling_entity pollent 
)
private

Definition at line 1825 of file client_channel.cc.

◆ RemoveResolverQueuedCall()

void grpc_core::ClientChannel::RemoveResolverQueuedCall ( ResolverQueuedCall to_remove,
grpc_polling_entity pollent 
)
private

Definition at line 1446 of file client_channel.cc.

◆ StartTransportOp()

void grpc_core::ClientChannel::StartTransportOp ( grpc_channel_element elem,
grpc_transport_op op 
)
staticprivate

Definition at line 1785 of file client_channel.cc.

◆ StartTransportOpLocked()

void grpc_core::ClientChannel::StartTransportOpLocked ( grpc_transport_op op)
private

Definition at line 1727 of file client_channel.cc.

◆ TryToConnectLocked()

void grpc_core::ClientChannel::TryToConnectLocked ( )
private

Definition at line 1839 of file client_channel.cc.

◆ UpdateServiceConfigInControlPlaneLocked()

void grpc_core::ClientChannel::UpdateServiceConfigInControlPlaneLocked ( RefCountedPtr< ServiceConfig service_config,
RefCountedPtr< ConfigSelector config_selector,
std::string  lb_policy_name 
)
private

Definition at line 1460 of file client_channel.cc.

◆ UpdateServiceConfigInDataPlaneLocked()

void grpc_core::ClientChannel::UpdateServiceConfigInDataPlaneLocked ( )
private

Definition at line 1485 of file client_channel.cc.

◆ UpdateStateAndPickerLocked()

void grpc_core::ClientChannel::UpdateStateAndPickerLocked ( grpc_connectivity_state  state,
const absl::Status status,
const char *  reason,
std::unique_ptr< LoadBalancingPolicy::SubchannelPicker picker 
)
private

Definition at line 1599 of file client_channel.cc.

Member Data Documentation

◆ channel_args_

const grpc_channel_args* grpc_core::ClientChannel::channel_args_
private

Definition at line 299 of file client_channel.h.

◆ channelz_node_

channelz::ChannelNode* grpc_core::ClientChannel::channelz_node_
private

Definition at line 303 of file client_channel.h.

◆ client_channel_factory_

ClientChannelFactory* grpc_core::ClientChannel::client_channel_factory_
private

Definition at line 298 of file client_channel.h.

◆ data_plane_mu_

Mutex grpc_core::ClientChannel::data_plane_mu_
mutableprivate

Definition at line 327 of file client_channel.h.

◆ deadline_checking_enabled_

const bool grpc_core::ClientChannel::deadline_checking_enabled_
private

Definition at line 296 of file client_channel.h.

◆ default_authority_

std::string grpc_core::ClientChannel::default_authority_
private

Definition at line 302 of file client_channel.h.

◆ default_service_config_

RefCountedPtr<ServiceConfig> grpc_core::ClientChannel::default_service_config_
private

Definition at line 300 of file client_channel.h.

◆ external_watchers_mu_

Mutex grpc_core::ClientChannel::external_watchers_mu_
mutableprivate

Definition at line 373 of file client_channel.h.

◆ info_mu_

Mutex grpc_core::ClientChannel::info_mu_
private

Definition at line 365 of file client_channel.h.

◆ interested_parties_

grpc_pollset_set* grpc_core::ClientChannel::interested_parties_
private

Definition at line 304 of file client_channel.h.

◆ kFilterVtable

const grpc_channel_filter grpc_core::ClientChannel::kFilterVtable
static

◆ owning_stack_

grpc_channel_stack* grpc_core::ClientChannel::owning_stack_
private

Definition at line 297 of file client_channel.h.

◆ resolution_mu_

Mutex grpc_core::ClientChannel::resolution_mu_
mutableprivate

Definition at line 310 of file client_channel.h.

◆ service_config_parser_index_

const size_t grpc_core::ClientChannel::service_config_parser_index_
private

Definition at line 305 of file client_channel.h.

◆ uri_to_resolve_

std::string grpc_core::ClientChannel::uri_to_resolve_
private

Definition at line 301 of file client_channel.h.

◆ work_serializer_ [1/12]

std::shared_ptr<WorkSerializer> grpc_core::ClientChannel::work_serializer_
private

Definition at line 336 of file client_channel.h.

◆ work_serializer_ [2/12]

ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 337 of file client_channel.h.

◆ work_serializer_ [3/12]

OrphanablePtr<Resolver> resolver_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 338 of file client_channel.h.

◆ work_serializer_ [4/12]

bool previous_resolution_contained_addresses_ ABSL_GUARDED_BY grpc_core::ClientChannel::work_serializer_ = false
private

Definition at line 340 of file client_channel.h.

◆ work_serializer_ [5/12]

RefCountedPtr<ServiceConfig> saved_service_config_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 342 of file client_channel.h.

◆ work_serializer_ [6/12]

RefCountedPtr<ConfigSelector> saved_config_selector_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 344 of file client_channel.h.

◆ work_serializer_ [7/12]

OrphanablePtr<LoadBalancingPolicy> lb_policy_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 346 of file client_channel.h.

◆ work_serializer_ [8/12]

RefCountedPtr<SubchannelPoolInterface> subchannel_pool_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 348 of file client_channel.h.

◆ work_serializer_ [9/12]

std::map<Subchannel*, int> subchannel_refcount_map_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 351 of file client_channel.h.

◆ work_serializer_ [10/12]

std::set<SubchannelWrapper*> subchannel_wrappers_ ABSL_GUARDED_BY* grpc_core::ClientChannel::work_serializer_
private

Definition at line 356 of file client_channel.h.

◆ work_serializer_ [11/12]

int keepalive_time_ ABSL_GUARDED_BY grpc_core::ClientChannel::work_serializer_ = -1
private

Definition at line 357 of file client_channel.h.

◆ work_serializer_ [12/12]

grpc_error_handle disconnect_error_ ABSL_GUARDED_BY grpc_core::ClientChannel::work_serializer_
private
Initial value:

Definition at line 358 of file client_channel.h.


The documentation for this class was generated from the following files:
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc_core::ClientChannel::CallData::StartTransportStreamOpBatch
static void StartTransportStreamOpBatch(grpc_call_element *elem, grpc_transport_stream_op_batch *batch)
Definition: client_channel.cc:1929
grpc_core::ClientChannel::CallData::SetPollent
static void SetPollent(grpc_call_element *elem, grpc_polling_entity *pollent)
Definition: client_channel.cc:2026
grpc_core::ClientChannel::Init
static grpc_error_handle Init(grpc_channel_element *elem, grpc_channel_element_args *args)
Definition: client_channel.cc:1016
grpc_channel_stack_no_post_init
void grpc_channel_stack_no_post_init(grpc_channel_stack *, grpc_channel_element *)
Definition: channel_stack.cc:282
grpc_core::ClientChannel::StartTransportOp
static void StartTransportOp(grpc_channel_element *elem, grpc_transport_op *op)
Definition: client_channel.cc:1785
grpc_core::ClientChannel::Destroy
static void Destroy(grpc_channel_element *elem)
Definition: client_channel.cc:1025
grpc_core::ClientChannel::GetChannelInfo
static void GetChannelInfo(grpc_channel_element *elem, const grpc_channel_info *info)
Definition: client_channel.cc:1802
grpc_core::ClientChannel::ClientChannel
ClientChannel(grpc_channel_element_args *args, grpc_error_handle *error)
Definition: client_channel.cc:1049
grpc_core::ClientChannel::CallData::Destroy
static void Destroy(grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_schedule_closure)
Definition: client_channel.cc:1914
grpc_core::ClientChannel::CallData::Init
static grpc_error_handle Init(grpc_call_element *elem, const grpc_call_element_args *args)
Definition: client_channel.cc:1907


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:35