Skip to content

Commit 9e8abc0

Browse files
authored
Refactor: Change access modifiers of ProxyStatistics, SelectTarget, and CheckTimeout from private to protected (#192)
1 parent 1bcfa53 commit 9e8abc0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

trpc/client/service_proxy.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class ServiceProxy {
6565
const ClientCodecPtr& GetClientCodec() { return codec_; }
6666

6767
/// @brief Stop used resources by service proxy (thread-safe).
68-
void Stop();
68+
virtual void Stop();
6969

7070
/// @brief Destroy used resources by service proxy (thread-safe).
71-
void Destroy();
71+
virtual void Destroy();
7272

7373
/// @brief Pre-allocate a connection, used for scenarios that require fixed connections for data transmission
7474
/// (thread-safe).
@@ -118,9 +118,18 @@ class ServiceProxy {
118118
/// in the options for non-direct connection models.
119119
const std::string& GetServiceName();
120120

121+
// Collect statistics on the service proxy and report them to the tvar.
122+
void ProxyStatistics(const ClientContextPtr& ctx);
123+
124+
// Used to determine if the request has timed out. Returns true if timed out, false if normal.
125+
bool CheckTimeout(const ClientContextPtr& context);
126+
121127
/// @brief Use the proxy option parameters to set the context.
122128
void FillClientContext(const ClientContextPtr& context);
123129

130+
// Routing selection interface, retrieve IP and port based on service name and store in ctx.
131+
bool SelectTarget(const ClientContextPtr& context);
132+
124133
/// @brief Run filters by filter point.
125134
int RunFilters(const FilterPoint& point, const ClientContextPtr& context);
126135

@@ -138,9 +147,6 @@ class ServiceProxy {
138147
// Check if the tvar variable required for statistical has been created, and create it if it has not been created.
139148
void PrepareStatistics(const std::string& service_name);
140149

141-
// Collect statistics on the service proxy and report them to the tvar.
142-
void ProxyStatistics(const ClientContextPtr& ctx);
143-
144150
// Determine if pipeline is supported.
145151
bool SupportPipeline(const std::shared_ptr<ServiceProxyOption>& option);
146152

@@ -156,9 +162,6 @@ class ServiceProxy {
156162
// Execute IO tracking for rpcz.
157163
FilterStatus RunIoFilters(const FilterPoint& point, const std::any& msg) noexcept;
158164

159-
// Routing selection interface, retrieve IP and port based on service name and store in ctx.
160-
bool SelectTarget(const ClientContextPtr& context);
161-
162165
// Get connection type by config
163166
ConnectionType GetClientConnectType();
164167

@@ -169,9 +172,6 @@ class ServiceProxy {
169172
// plugin.
170173
void InitSelectorFilter();
171174

172-
// Used to determine if the request has timed out. Returns true if timed out, false if normal.
173-
bool CheckTimeout(const ClientContextPtr& context);
174-
175175
// Error handling, it will set error information to context.
176176
void HandleError(const ClientContextPtr& context, int ret, std::string&& err_msg);
177177

trpc/client/service_proxy_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void ServiceProxyManager::SetOptionDefaultValue(const std::string& name, std::sh
6767
if (option->name_space.empty()) {
6868
option->name_space = TrpcConfig::GetInstance()->GetGlobalConfig().env_namespace;
6969
}
70-
70+
7171
// If callee_name is not set, set it to name of proxy.
7272
if (option->callee_name.empty()) {
7373
option->callee_name = name;

0 commit comments

Comments
 (0)