global_subchannel_pool.h
Go to the documentation of this file.
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_GLOBAL_SUBCHANNEL_POOL_H
20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_GLOBAL_SUBCHANNEL_POOL_H
21 
23 
24 #include <map>
25 
26 #include "absl/base/thread_annotations.h"
27 
31 
32 namespace grpc_core {
33 
34 // The global subchannel pool. It shares subchannels among channels. There
35 // should be only one instance of this class.
37  public:
38  // Gets the singleton instance.
40 
41  // Implements interface methods.
43  const SubchannelKey& key, RefCountedPtr<Subchannel> constructed) override
46  Subchannel* subchannel) override
50 
51  private:
53  ~GlobalSubchannelPool() override {}
54 
55  // A map from subchannel key to subchannel.
56  std::map<SubchannelKey, Subchannel*> subchannel_map_ ABSL_GUARDED_BY(mu_);
57  // To protect subchannel_map_.
59 };
60 
61 } // namespace grpc_core
62 
63 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_GLOBAL_SUBCHANNEL_POOL_H */
grpc_core::GlobalSubchannelPool::RegisterSubchannel
RefCountedPtr< Subchannel > RegisterSubchannel(const SubchannelKey &key, RefCountedPtr< Subchannel > constructed) override ABSL_LOCKS_EXCLUDED(mu_)
Definition: global_subchannel_pool.cc:34
grpc_core::GlobalSubchannelPool::UnregisterSubchannel
void UnregisterSubchannel(const SubchannelKey &key, Subchannel *subchannel) override ABSL_LOCKS_EXCLUDED(mu_)
Definition: global_subchannel_pool.cc:46
grpc_core::GlobalSubchannelPool::GlobalSubchannelPool
GlobalSubchannelPool()
Definition: global_subchannel_pool.h:52
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::GlobalSubchannelPool::ABSL_GUARDED_BY
std::map< SubchannelKey, Subchannel * > subchannel_map_ ABSL_GUARDED_BY(mu_)
subchannel
RingHashSubchannelData * subchannel
Definition: ring_hash.cc:285
subchannel_pool_interface.h
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
grpc_core::GlobalSubchannelPool
Definition: global_subchannel_pool.h:36
grpc_core::GlobalSubchannelPool::instance
static RefCountedPtr< GlobalSubchannelPool > instance()
Definition: global_subchannel_pool.cc:29
grpc_core::GlobalSubchannelPool::FindSubchannel
RefCountedPtr< Subchannel > FindSubchannel(const SubchannelKey &key) override ABSL_LOCKS_EXCLUDED(mu_)
Definition: global_subchannel_pool.cc:57
grpc_core::GlobalSubchannelPool::~GlobalSubchannelPool
~GlobalSubchannelPool() override
Definition: global_subchannel_pool.h:53
grpc_core::SubchannelKey
Definition: subchannel_pool_interface.h:40
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
grpc_core::Subchannel
Definition: subchannel.h:166
key
const char * key
Definition: hpack_parser_table.cc:164
grpc_core::SubchannelPoolInterface
Definition: subchannel_pool_interface.h:76
ABSL_LOCKS_EXCLUDED
#define ABSL_LOCKS_EXCLUDED(...)
Definition: abseil-cpp/absl/base/thread_annotations.h:163
ref_counted_ptr.h
grpc_core::GlobalSubchannelPool::mu_
Mutex mu_
Definition: global_subchannel_pool.h:58
sync.h
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:26