diff options
author | ncteisen <ncteisen@gmail.com> | 2018-07-18 18:31:09 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-07-19 08:15:49 -0700 |
commit | bbee13661c82c13e2f1b728c94f9535112f54d92 (patch) | |
tree | ed60505ea44cdde179e837ff13050445afe7809b /src/core/ext/filters/client_channel/client_channel_channelz.h | |
parent | 481c1d57e7fc92f74c79b9aa0f7c8f0eaa51000b (diff) |
Add channelz subchannel support
Diffstat (limited to 'src/core/ext/filters/client_channel/client_channel_channelz.h')
-rw-r--r-- | src/core/ext/filters/client_channel/client_channel_channelz.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.h b/src/core/ext/filters/client_channel/client_channel_channelz.h index 6f27b5c8b7..b1bd8db89e 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.h +++ b/src/core/ext/filters/client_channel/client_channel_channelz.h @@ -26,6 +26,8 @@ #include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/inlined_vector.h" +typedef struct grpc_subchannel grpc_subchannel; + namespace grpc_core { // TODO(ncteisen), this only contains the uuids of the children for now, @@ -55,16 +57,45 @@ class ClientChannelNode : public ChannelNode { static grpc_arg CreateChannelArg(); protected: - GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE - GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW ClientChannelNode(grpc_channel* channel, size_t channel_tracer_max_nodes, bool is_top_level_channel); virtual ~ClientChannelNode() {} private: + GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE + GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW grpc_channel_element* client_channel_; }; +// Subtype of SubchannelNode that overrides and provides client_channel +// specific functionality like querying for connectivity_state and +// subchannel target. +class ClientChannelSubchannelNode : public SubchannelNode { + public: + ClientChannelSubchannelNode(size_t channel_tracer_max_nodes, + grpc_subchannel* subchannel); + ~ClientChannelSubchannelNode() override {} + + // Override this functionality since subchannels have a notion of + // channel connectivity. + void PopulateConnectivityState(grpc_json* json) override; + + // Override this functionality since client_channels subchannels hold + // their own target. + void PopulateTarget(grpc_json* json) override; + + void MarkSubchannelDestroyed() { + GPR_ASSERT(subchannel_ != nullptr); + subchannel_ = nullptr; + } + + private: + GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE + GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW + grpc_subchannel* subchannel_; + UniquePtr<char> target_; +}; + } // namespace channelz } // namespace grpc_core |