aboutsummaryrefslogtreecommitdiff
path: root/src/core/ext/filters/client_channel/subchannel_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ext/filters/client_channel/subchannel_interface.h')
-rw-r--r--src/core/ext/filters/client_channel/subchannel_interface.h45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/core/ext/filters/client_channel/subchannel_interface.h b/src/core/ext/filters/client_channel/subchannel_interface.h
index 10b1bf124c..2e448dc5a6 100644
--- a/src/core/ext/filters/client_channel/subchannel_interface.h
+++ b/src/core/ext/filters/client_channel/subchannel_interface.h
@@ -21,42 +21,22 @@
#include <grpc/support/port_platform.h>
-#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
namespace grpc_core {
-// TODO(roth): In a subsequent PR, remove this from this API.
-class ConnectedSubchannelInterface
- : public RefCounted<ConnectedSubchannelInterface> {
- public:
- virtual const grpc_channel_args* args() const GRPC_ABSTRACT;
-
- protected:
- template <typename TraceFlagT = TraceFlag>
- explicit ConnectedSubchannelInterface(TraceFlagT* trace_flag = nullptr)
- : RefCounted<ConnectedSubchannelInterface>(trace_flag) {}
-};
-
+// The interface for subchannels that is exposed to LB policy implementations.
class SubchannelInterface : public RefCounted<SubchannelInterface> {
public:
- class ConnectivityStateWatcher {
+ class ConnectivityStateWatcherInterface {
public:
- virtual ~ConnectivityStateWatcher() = default;
+ virtual ~ConnectivityStateWatcherInterface() = default;
// Will be invoked whenever the subchannel's connectivity state
// changes. There will be only one invocation of this method on a
// given watcher instance at any given time.
- //
- // When the state changes to READY, connected_subchannel will
- // contain a ref to the connected subchannel. When it changes from
- // READY to some other state, the implementation must release its
- // ref to the connected subchannel.
- virtual void OnConnectivityStateChange(
- grpc_connectivity_state new_state,
- RefCountedPtr<ConnectedSubchannelInterface>
- connected_subchannel) // NOLINT
+ virtual void OnConnectivityStateChange(grpc_connectivity_state new_state)
GRPC_ABSTRACT;
// TODO(roth): Remove this as soon as we move to EventManager-based
@@ -66,12 +46,14 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
GRPC_ABSTRACT_BASE_CLASS
};
+ template <typename TraceFlagT = TraceFlag>
+ explicit SubchannelInterface(TraceFlagT* trace_flag = nullptr)
+ : RefCounted<SubchannelInterface>(trace_flag) {}
+
virtual ~SubchannelInterface() = default;
// Returns the current connectivity state of the subchannel.
- virtual grpc_connectivity_state CheckConnectivityState(
- RefCountedPtr<ConnectedSubchannelInterface>* connected_subchannel)
- GRPC_ABSTRACT;
+ virtual grpc_connectivity_state CheckConnectivityState() GRPC_ABSTRACT;
// Starts watching the subchannel's connectivity state.
// The first callback to the watcher will be delivered when the
@@ -86,12 +68,12 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
// the previous watcher using CancelConnectivityStateWatch().
virtual void WatchConnectivityState(
grpc_connectivity_state initial_state,
- UniquePtr<ConnectivityStateWatcher> watcher) GRPC_ABSTRACT;
+ UniquePtr<ConnectivityStateWatcherInterface> watcher) GRPC_ABSTRACT;
// Cancels a connectivity state watch.
// If the watcher has already been destroyed, this is a no-op.
- virtual void CancelConnectivityStateWatch(ConnectivityStateWatcher* watcher)
- GRPC_ABSTRACT;
+ virtual void CancelConnectivityStateWatch(
+ ConnectivityStateWatcherInterface* watcher) GRPC_ABSTRACT;
// Attempt to connect to the backend. Has no effect if already connected.
// If the subchannel is currently in backoff delay due to a previously
@@ -105,6 +87,9 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
// attempt will be started as soon as AttemptToConnect() is called.
virtual void ResetBackoff() GRPC_ABSTRACT;
+ // TODO(roth): Need a better non-grpc-specific abstraction here.
+ virtual const grpc_channel_args* channel_args() GRPC_ABSTRACT;
+
GRPC_ABSTRACT_BASE_CLASS
};