MCPcopy Create free account
hub / github.com/Tencent/phxsql / ReportEndPoint

Method ReportEndPoint

phxsqlclient/phxsqlclient_leakybucket.cpp:93–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93int PhxSQLClientDisasterStrategy_LeakyBucket::ReportEndPoint(const MySQLEndPoint_t & tEndPoint, int iRet,
94 int iCostInMS) {
95 if (!iRet) {
96 return phxsql::OK;
97 }
98
99 std::string sKey = tEndPoint.ToString();
100
101 auto find_itr = m_mapBucket.find(sKey);
102 if (find_itr == m_mapBucket.end()) {
103 MmapLeakyBucket * bucket = new MmapLeakyBucket();
104
105 MmapLeakyBucket::Config_t tConfig;
106 tConfig.iBucketSize = m_iBucketSize;
107 tConfig.tRefillPeriod = m_iFillPeriod;
108
109 bucket->Init(&tConfig, string(PHXSQL_LEAKEYBUCKET_DIR + "/" + sKey).c_str());
110
111 m_mapBucket[sKey] = bucket;
112
113 find_itr = m_mapBucket.find(sKey);
114 }
115
116 find_itr->second->Apply(1);
117 return 0;
118}
119
120PhxSQLClient_LeakyBucket::PhxSQLClient_LeakyBucket(const char *pcUser, const char *pcPasswd, const char *pcDB,
121 uint32_t iClientFlag, int iBucketSize, int iFillPeriod) :

Callers

nothing calls this directly

Calls 3

ToStringMethod · 0.80
InitMethod · 0.45
ApplyMethod · 0.45

Tested by

no test coverage detected