Commit bc7165fb authored by jamesge's avatar jamesge

Remove fetch related methods from DiscoveryClient

parent 6f4dd466
...@@ -41,14 +41,6 @@ struct DiscoveryRegisterParam { ...@@ -41,14 +41,6 @@ struct DiscoveryRegisterParam {
bool IsValid() const; bool IsValid() const;
}; };
struct DiscoveryFetchsParam {
std::string appid;
std::string env;
std::string status;
bool IsValid() const;
};
// ONE DiscoveryClient corresponds to ONE service instance. // ONE DiscoveryClient corresponds to ONE service instance.
// If your program has multiple service instances to register, // If your program has multiple service instances to register,
// you need multiple DiscoveryClient. // you need multiple DiscoveryClient.
...@@ -59,7 +51,6 @@ public: ...@@ -59,7 +51,6 @@ public:
~DiscoveryClient(); ~DiscoveryClient();
int Register(const DiscoveryRegisterParam& req); int Register(const DiscoveryRegisterParam& req);
int Fetchs(const DiscoveryFetchsParam& req, std::vector<ServerNode>* servers) const;
private: private:
static void* PeriodicRenew(void* arg); static void* PeriodicRenew(void* arg);
......
...@@ -117,8 +117,10 @@ private: ...@@ -117,8 +117,10 @@ private:
pthread_t _tid; pthread_t _tid;
}; };
#ifndef UNIT_TEST
static PassiveStatus<double>* s_cumulated_time_bvar = NULL; static PassiveStatus<double>* s_cumulated_time_bvar = NULL;
static bvar::PerSecond<bvar::PassiveStatus<double> >* s_sampling_thread_usage_bvar = NULL; static bvar::PerSecond<bvar::PassiveStatus<double> >* s_sampling_thread_usage_bvar = NULL;
#endif
void SamplerCollector::run() { void SamplerCollector::run() {
#ifndef UNIT_TEST #ifndef UNIT_TEST
......
...@@ -47,9 +47,6 @@ DECLARE_string(discovery_env); ...@@ -47,9 +47,6 @@ DECLARE_string(discovery_env);
DECLARE_int32(discovery_renew_interval_s); DECLARE_int32(discovery_renew_interval_s);
// Defined in discovery_naming_service.cpp // Defined in discovery_naming_service.cpp
int ParseFetchsResult(const butil::IOBuf& buf,
const char* service_name,
std::vector<brpc::ServerNode>* servers);
int ParseNodesResult(const butil::IOBuf& buf, std::string* server_addr); int ParseNodesResult(const butil::IOBuf& buf, std::string* server_addr);
} // policy } // policy
...@@ -534,21 +531,6 @@ static std::string s_nodes_result = R"({ ...@@ -534,21 +531,6 @@ static std::string s_nodes_result = R"({
})"; })";
TEST(NamingServiceTest, discovery_parse_function) {
std::vector<brpc::ServerNode> servers;
brpc::policy::DiscoveryNamingService dcns;
butil::IOBuf buf;
buf.append(s_fetchs_result);
ASSERT_EQ(0, brpc::policy::ParseFetchsResult(buf, "admin.test", &servers));
ASSERT_EQ((size_t)1, servers.size());
ASSERT_EQ(servers[0].tag, "{\"weight\":\"10\",\"cluster\":\"\"}");
buf.clear();
buf.append(s_nodes_result);
std::string server;
ASSERT_EQ(0, brpc::policy::ParseNodesResult(buf, &server));
ASSERT_EQ("127.0.0.1:8635", server);
}
class DiscoveryNamingServiceImpl : public test::DiscoveryNamingService { class DiscoveryNamingServiceImpl : public test::DiscoveryNamingService {
public: public:
DiscoveryNamingServiceImpl() DiscoveryNamingServiceImpl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment