connector.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H
18 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H
19 
21 
23 
33 
34 namespace grpc_core {
35 
36 // Interface for connection-establishment functionality.
37 // Each transport that supports client channels (e.g., not inproc) must
38 // supply an implementation of this.
39 class SubchannelConnector : public InternallyRefCounted<SubchannelConnector> {
40  public:
41  struct Args {
42  // Address to connect to.
44  // Set of pollsets interested in this connection.
46  // Deadline for connection.
48  // Channel args to be passed to handshakers and transport.
50  };
51 
52  struct Result {
53  // The connected transport.
55  // Channel args to be passed to filters.
56  const grpc_channel_args* channel_args = nullptr;
57  // Channelz socket node of the connected transport, if any.
59 
60  void Reset() {
61  transport = nullptr;
62  channel_args = nullptr;
63  socket_node.reset();
64  }
65  };
66 
67  // Attempts to connect.
68  // When complete, populates *result and invokes notify.
69  // Only one connection attempt may be in progress at any one time.
70  virtual void Connect(const Args& args, Result* result,
71  grpc_closure* notify) = 0;
72 
73  // Cancels any in-flight connection attempt and shuts down the
74  // connector.
75  virtual void Shutdown(grpc_error_handle error) = 0;
76 
77  void Orphan() override {
78  Shutdown(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
79  Unref();
80  }
81 };
82 
83 } // namespace grpc_core
84 
85 #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H
grpc_core::SubchannelConnector::Args
Definition: connector.h:41
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
orphanable.h
grpc_core::SubchannelConnector::Orphan
void Orphan() override
Definition: connector.h:77
grpc_core::InternallyRefCounted< SubchannelConnector >::Unref
void Unref()
Definition: orphanable.h:100
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::SubchannelConnector
Definition: connector.h:39
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
grpc_core::SubchannelConnector::Shutdown
virtual void Shutdown(grpc_error_handle error)=0
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_resolved_address
Definition: resolved_address.h:34
closure.h
resolved_address.h
channelz.h
grpc_channel_args
Definition: grpc_types.h:132
grpc_core::SubchannelConnector::Args::interested_parties
grpc_pollset_set * interested_parties
Definition: connector.h:45
grpc_types.h
grpc_core::SubchannelConnector::Result::transport
grpc_transport * transport
Definition: connector.h:54
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::SubchannelConnector::Args::channel_args
const grpc_channel_args * channel_args
Definition: connector.h:49
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
hpack_encoder_fixtures::Args
Args({0, 16384})
re2::Result
TestInstance::Result Result
Definition: bloaty/third_party/re2/re2/testing/tester.cc:96
time.h
error.h
grpc_core::InternallyRefCounted
Definition: orphanable.h:73
grpc_core::SubchannelConnector::Result::Reset
void Reset()
Definition: connector.h:60
grpc_core::SubchannelConnector::Result::socket_node
RefCountedPtr< channelz::SocketNode > socket_node
Definition: connector.h:58
grpc_core::SubchannelConnector::Result
Definition: connector.h:52
transport_fwd.h
grpc_core::SubchannelConnector::Result::channel_args
const grpc_channel_args * channel_args
Definition: connector.h:56
grpc_core::SubchannelConnector::Connect
virtual void Connect(const Args &args, Result *result, grpc_closure *notify)=0
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
grpc_core::SubchannelConnector::Args::deadline
Timestamp deadline
Definition: connector.h:47
ref_counted_ptr.h
grpc_transport
Definition: transport_impl.h:89
iomgr_fwd.h
grpc_error
Definition: error_internal.h:42
grpc_closure
Definition: closure.h:56
grpc_core::SubchannelConnector::Args::address
grpc_resolved_address * address
Definition: connector.h:43
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:54